mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Change datetime.datetime.astimezone tz argument type from timezone to tzinfo (#186)
timezone inherits from tzinfo, so using tzinfo is more general (and e.g.
pytz types inherit directly from tzinfo).
This is the correct type, as quoted from astimezone's code:
elif not isinstance(tz, tzinfo):
raise TypeError("tz argument must be an instance of tzinfo")
This commit is contained in:
committed by
Guido van Rossum
parent
c2194c9761
commit
eab591bb08
@@ -198,7 +198,7 @@ class datetime:
|
||||
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
|
||||
Union[_tzinfo, bool] = ...) -> datetime: ...
|
||||
def astimezone(self, tz: timezone = ...) -> datetime: ...
|
||||
def astimezone(self, tz: _tzinfo = ...) -> datetime: ...
|
||||
def ctime(self) -> str: ...
|
||||
def isoformat(self, sep: str = ...) -> str: ...
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user