Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/dateutil/tz/__init__.py: 63%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

19 statements  

1# -*- coding: utf-8 -*- 

2import sys 

3 

4from . import _tzpath 

5from ._tzpath import reset_tzpath 

6from .tz import * 

7from .tz import __doc__ 

8 

9__all__ = [ 

10 "tzutc", 

11 "tzoffset", 

12 "tzlocal", 

13 "tzfile", 

14 "tzrange", 

15 "tzstr", 

16 "tzical", 

17 "tzwin", 

18 "tzwinlocal", 

19 "gettz", 

20 "enfold", 

21 "datetime_ambiguous", 

22 "datetime_exists", 

23 "resolve_imaginary", 

24 "available_iana_timezones", 

25 "UTC", 

26 "TZPATH", 

27 "reset_tzpath", 

28 "DeprecatedTzFormatWarning", 

29 "DeprecatedTzKeyWarning", 

30] 

31 

32if sys.version_info < (3, 7): 

33 # Module-level __getattr__ was added in Python 3.7, so instead of lazily 

34 # populating TZPATH on every access, we will register a callback with 

35 # reset_tzpath to update the top-level tuple. 

36 TZPATH = _tzpath.TZPATH 

37 

38 def _tzpath_callback(new_tzpath): 

39 global TZPATH 

40 TZPATH = new_tzpath 

41 

42 _tzpath.TZPATH_CALLBACKS.append(_tzpath_callback) 

43 

44else: 

45 

46 def __getattr__(name): 

47 if name == "TZPATH": 

48 return _tzpath.TZPATH 

49 else: 

50 raise AttributeError( 

51 "Module %s has no attribute %s" % (repr(__name__), repr(name)) 

52 ) 

53 

54 

55def __dir__(): 

56 return sorted(list(globals()) + ["TZPATH"]) 

57 

58 

59class DeprecatedTzFormatWarning(Warning): 

60 """Warning raised when time zones are parsed from deprecated formats."""