Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/pytz/exceptions.py
7771 views
1
'''
2
Custom exceptions raised by pytz.
3
'''
4
5
__all__ = [
6
'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError',
7
'NonExistentTimeError',
8
]
9
10
11
class Error(Exception):
12
'''Base class for all exceptions raised by the pytz library'''
13
14
15
class UnknownTimeZoneError(KeyError, Error):
16
'''Exception raised when pytz is passed an unknown timezone.
17
18
>>> isinstance(UnknownTimeZoneError(), LookupError)
19
True
20
21
This class is actually a subclass of KeyError to provide backwards
22
compatibility with code relying on the undocumented behavior of earlier
23
pytz releases.
24
25
>>> isinstance(UnknownTimeZoneError(), KeyError)
26
True
27
28
And also a subclass of pytz.exceptions.Error, as are other pytz
29
exceptions.
30
31
>>> isinstance(UnknownTimeZoneError(), Error)
32
True
33
34
'''
35
pass
36
37
38
class InvalidTimeError(Error):
39
'''Base class for invalid time exceptions.'''
40
41
42
class 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 will
46
occur twice (once before the clocks are set back, once after). Both
47
possibilities may be correct, unless further information is supplied.
48
49
See DstTzInfo.normalize() for more info
50
'''
51
52
53
class NonExistentTimeError(InvalidTimeError):
54
'''Exception raised when attempting to create a wallclock time that
55
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
61