From 0391e72a6e1ad0bd626f7446da62c72d4d35bec3 Mon Sep 17 00:00:00 2001 From: Roy Williams Date: Tue, 29 Nov 2016 23:04:53 -0800 Subject: [PATCH] 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 --- third_party/2and3/pytz/__init__.pyi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/third_party/2and3/pytz/__init__.pyi b/third_party/2and3/pytz/__init__.pyi index dc9c8fc4a..6bc917e5e 100644 --- a/third_party/2and3/pytz/__init__.pyi +++ b/third_party/2and3/pytz/__init__.pyi @@ -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: ...