From 16ec7cbdf001bbf318d0afa77c4790b4baf9b8af Mon Sep 17 00:00:00 2001 From: rchen152 Date: Tue, 6 Jun 2017 15:36:01 -0700 Subject: [PATCH] Add __new__ to time.struct_time (#1394) This is needed because otherwise pytype uses the `__new__` inherited from the `NamedTuple` base class. --- stdlib/2/time.pyi | 3 +++ stdlib/3/time.pyi | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/stdlib/2/time.pyi b/stdlib/2/time.pyi index 7a7a71802..e75d8e0d7 100644 --- a/stdlib/2/time.pyi +++ b/stdlib/2/time.pyi @@ -17,6 +17,9 @@ class struct_time(NamedTuple('_struct_time', def __init__(self, o: Tuple[int, int, int, int, int, int, int, int, int], _arg: Any = ...) -> None: ... + def __new__(cls, o: Tuple[int, int, int, + int, int, int, + int, int, int], _arg: Any = ...) -> struct_time: ... _TIME_TUPLE = Tuple[int, int, int, int, int, int, int, int, int] diff --git a/stdlib/3/time.pyi b/stdlib/3/time.pyi index 57884b2a9..597fb8e53 100644 --- a/stdlib/3/time.pyi +++ b/stdlib/3/time.pyi @@ -45,6 +45,15 @@ if sys.version_info >= (3, 3): ], _arg: Any = ..., ) -> None: ... + def __new__( + cls, + o: Union[ + Tuple[int, int, int, int, int, int, int, int, int], + Tuple[int, int, int, int, int, int, int, int, int, str], + Tuple[int, int, int, int, int, int, int, int, int, str, int] + ], + _arg: Any = ..., + ) -> struct_time: ... else: class struct_time( NamedTuple( @@ -55,6 +64,7 @@ else: ) ): def __init__(self, o: TimeTuple, _arg: Any = ...) -> None: ... + def __new__(cls, o: TimeTuple, _arg: Any = ...) -> struct_time: ... # ----- functions -----