comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pytz/exceptions.py @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
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 '''