diff options
| author | Paul Ganssle <paul@ganssle.io> | 2019-04-23 13:38:23 -0400 |
|---|---|---|
| committer | Paul Ganssle <paul@ganssle.io> | 2019-04-23 13:54:56 -0400 |
| commit | a6ea0336780765fc054dfd7bfe31fe6497ee26e1 (patch) | |
| tree | cf370fca6fcb7fa6382f20a3217df4abc5fa7f8d /dateutil | |
| parent | 31fe64f3a6c9fa6916334363357dc40e97590ccb (diff) | |
| download | dateutil-git-a6ea0336780765fc054dfd7bfe31fe6497ee26e1.tar.gz | |
Move UTC definition into dateutil.tz.tz
To allow the UTC object to be accessible from the functions in
`dateutil.tz.tz` such as `gettz` and datetime_exists, it is necessary to
define the UTC constant here and import it into `dateutil.tz`. This is a
very minor performance improvement, avoiding a call to the `tzutc()`
constructor.
Diffstat (limited to 'dateutil')
| -rw-r--r-- | dateutil/tz/__init__.py | 5 | ||||
| -rw-r--r-- | dateutil/tz/tz.py | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/dateutil/tz/__init__.py b/dateutil/tz/__init__.py index 5a2d9cd..af1352c 100644 --- a/dateutil/tz/__init__.py +++ b/dateutil/tz/__init__.py @@ -2,11 +2,6 @@ from .tz import * from .tz import __doc__ -#: Convenience constant providing a :class:`tzutc()` instance -#: -#: .. versionadded:: 2.7.0 -UTC = tzutc() - __all__ = ["tzutc", "tzoffset", "tzlocal", "tzfile", "tzrange", "tzstr", "tzical", "tzwin", "tzwinlocal", "gettz", "enfold", "datetime_ambiguous", "datetime_exists", diff --git a/dateutil/tz/tz.py b/dateutil/tz/tz.py index d05414e..bef0a9c 100644 --- a/dateutil/tz/tz.py +++ b/dateutil/tz/tz.py @@ -123,6 +123,12 @@ class tzutc(datetime.tzinfo): __reduce__ = object.__reduce__ +#: Convenience constant providing a :class:`tzutc()` instance +#: +#: .. versionadded:: 2.7.0 +UTC = tzutc() + + @six.add_metaclass(_TzOffsetFactory) class tzoffset(datetime.tzinfo): """ |
