Convert namedtuples to class syntax (#3321)

This commit is contained in:
Sebastian Rittau
2019-10-20 10:37:33 +02:00
committed by GitHub
parent 2b9dc7b9c2
commit ec7960a8cb
41 changed files with 397 additions and 383 deletions

View File

@@ -32,15 +32,19 @@ if sys.version_info >= (3, 8) and sys.platform == "darwin":
CLOCK_UPTIME_RAW: int
if sys.version_info >= (3, 3):
class struct_time(
NamedTuple(
'_struct_time',
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int),
('tm_zone', str), ('tm_gmtoff', int)]
)
):
class _struct_time(NamedTuple):
tm_year: int
tm_mon: int
tm_mday: int
tm_hour: int
tm_min: int
tm_sec: int
tm_wday: int
tm_yday: int
tm_isdst: int
tm_zone: str
tm_gmtoff: int
class struct_time(_struct_time):
def __init__(
self,
o: Union[
@@ -60,14 +64,17 @@ if sys.version_info >= (3, 3):
_arg: Any = ...,
) -> struct_time: ...
else:
class struct_time(
NamedTuple(
'_struct_time',
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int)]
)
):
class _struct_time(NamedTuple):
tm_year: int
tm_mon: int
tm_mday: int
tm_hour: int
tm_min: int
tm_sec: int
tm_wday: int
tm_yday: int
tm_isdst: int
class struct_time(_struct_time):
def __init__(self, o: _TimeTuple, _arg: Any = ...) -> None: ...
def __new__(cls, o: _TimeTuple, _arg: Any = ...) -> struct_time: ...