Add __new__ to time.struct_time (#1394)

This is needed because otherwise pytype uses the `__new__` inherited from the `NamedTuple` base class.
This commit is contained in:
rchen152
2017-06-06 15:36:01 -07:00
committed by Guido van Rossum
parent 0679e0232c
commit 16ec7cbdf0
2 changed files with 13 additions and 0 deletions

View File

@@ -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]

View File

@@ -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 -----