Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
exceptions.py60 linesDownload Raw Back to pytz
1'''2Custom exceptions raised by pytz.3'''4 5__all__ = [6    'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError',7    'NonExistentTimeError',8]9 10 11class Error(Exception):12    '''Base class for all exceptions raised by the pytz library'''13 14 15class UnknownTimeZoneError(KeyError, Error):16    '''Exception raised when pytz is passed an unknown timezone.17 18    >>> isinstance(UnknownTimeZoneError(), LookupError)19    True20 21    This class is actually a subclass of KeyError to provide backwards22    compatibility with code relying on the undocumented behavior of earlier23    pytz releases.24 25    >>> isinstance(UnknownTimeZoneError(), KeyError)26    True27 28    And also a subclass of pytz.exceptions.Error, as are other pytz29    exceptions.30 31    >>> isinstance(UnknownTimeZoneError(), Error)32    True33 34    '''35    pass36 37 38class InvalidTimeError(Error):39    '''Base class for invalid time exceptions.'''40 41 42class AmbiguousTimeError(InvalidTimeError):43    '''Exception raised when attempting to create an ambiguous wallclock time.44 45    At the end of a DST transition period, a particular wallclock time will46    occur twice (once before the clocks are set back, once after). Both47    possibilities may be correct, unless further information is supplied.48 49    See DstTzInfo.normalize() for more info50    '''51 52 53class NonExistentTimeError(InvalidTimeError):54    '''Exception raised when attempting to create a wallclock time that55    cannot exist.56 57    At the start of a DST transition period, the wallclock time jumps forward.58    The instants jumped over never occur.59    '''60 
codekingpro/portable-devtools · Team Ai