Expose pytz.UTC as an instance as opposed to as a class (#723)

* Expose pytz.UTC as an instance as opposed to as a class

pytz shadows UTC after declaring it with a singleton:
https://github.com/newvem/pytz/blob/master/pytz/__init__.py#L135

This fixes https://github.com/python/typeshed/issues/710
This commit is contained in:
Roy Williams
2016-11-29 23:04:53 -08:00
committed by Łukasz Langa
parent 1dff8e4a45
commit 0391e72a6e

View File

@@ -11,7 +11,7 @@ country_timezones = ... # type: Dict
country_names = ... # type: Dict
class UTC(dt.tzinfo):
class _UTCclass(dt.tzinfo):
zone = ... # type: str
def fromutc(self, dt: dt.datetime) -> dt.datetime: ...
def utcoffset(self, dt: Optional[dt.datetime]) -> dt.timedelta: ... # type: ignore
@@ -20,6 +20,7 @@ class UTC(dt.tzinfo):
def localize(self, dt: dt.datetime, is_dst: bool=...) -> dt.datetime: ...
def normalize(self, dt: dt.datetime, is_dst: bool=...) -> dt.datetime: ...
utc = ... # type: UTC
utc = ... # type: _UTCclass
UTC = ... # type: _UTCclass
def timezone(zone: str) -> UTC: ...
def timezone(zone: str) -> dt.tzinfo: ...