__init__.py 703 B

12345678910111213141516171819202122232425262728293031
  1. __all__ = [
  2. "ZoneInfo",
  3. "reset_tzpath",
  4. "available_timezones",
  5. "TZPATH",
  6. "ZoneInfoNotFoundError",
  7. "InvalidTZPathWarning",
  8. ]
  9. from . import _tzpath
  10. from ._common import ZoneInfoNotFoundError
  11. try:
  12. from _zoneinfo import ZoneInfo
  13. except ImportError: # pragma: nocover
  14. from ._zoneinfo import ZoneInfo
  15. reset_tzpath = _tzpath.reset_tzpath
  16. available_timezones = _tzpath.available_timezones
  17. InvalidTZPathWarning = _tzpath.InvalidTZPathWarning
  18. def __getattr__(name):
  19. if name == "TZPATH":
  20. return _tzpath.TZPATH
  21. else:
  22. raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
  23. def __dir__():
  24. return sorted(list(globals()) + ["TZPATH"])