Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exceptions.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. '''
  2. Custom exceptions raised by pytz.
  3. '''
  4. __all__ = [
  5. 'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError',
  6. 'NonExistentTimeError',
  7. ]
  8. class UnknownTimeZoneError(KeyError):
  9. '''Exception raised when pytz is passed an unknown timezone.
  10. >>> isinstance(UnknownTimeZoneError(), LookupError)
  11. True
  12. This class is actually a subclass of KeyError to provide backwards
  13. compatibility with code relying on the undocumented behavior of earlier
  14. pytz releases.
  15. >>> isinstance(UnknownTimeZoneError(), KeyError)
  16. True
  17. '''
  18. pass
  19. class InvalidTimeError(Exception):
  20. '''Base class for invalid time exceptions.'''
  21. class AmbiguousTimeError(InvalidTimeError):
  22. '''Exception raised when attempting to create an ambiguous wallclock time.
  23. At the end of a DST transition period, a particular wallclock time will
  24. occur twice (once before the clocks are set back, once after). Both
  25. possibilities may be correct, unless further information is supplied.
  26. See DstTzInfo.normalize() for more info
  27. '''
  28. class NonExistentTimeError(InvalidTimeError):
  29. '''Exception raised when attempting to create a wallclock time that
  30. cannot exist.
  31. At the start of a DST transition period, the wallclock time jumps forward.
  32. The instants jumped over never occur.
  33. '''