Add missing __match_args__ attributes to several unix-only structseq classes (#7587)

This commit is contained in:
Alex Waygood
2022-04-04 21:33:49 +01:00
committed by GitHub
parent be64b01e6c
commit 414f324083
6 changed files with 46 additions and 5 deletions

View File

@@ -1,11 +1,13 @@
import sys
from _typeshed import structseq
from typing import Any
from typing_extensions import final
from typing_extensions import Final, final
if sys.platform != "win32":
@final
class struct_group(structseq[Any], tuple[str, str | None, int, list[str]]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("gr_name", "gr_passwd", "gr_gid", "gr_mem")
@property
def gr_name(self) -> str: ...
@property

View File

@@ -920,6 +920,8 @@ else:
if sys.platform != "darwin":
@final
class waitid_result(structseq[int], tuple[int, int, int, int, int]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("si_pid", "si_uid", "si_signo", "si_status", "si_code")
@property
def si_pid(self) -> int: ...
@property
@@ -977,6 +979,8 @@ else:
if sys.platform != "win32":
@final
class sched_param(structseq[int], tuple[int]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("sched_priority",)
def __new__(cls: type[Self], sched_priority: int) -> Self: ...
@property
def sched_priority(self) -> int: ...

View File

@@ -1,11 +1,13 @@
import sys
from _typeshed import structseq
from typing import Any
from typing_extensions import final
from typing_extensions import Final, final
if sys.platform != "win32":
@final
class struct_passwd(structseq[Any], tuple[str, str, int, int, str, str, str]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("pw_name", "pw_passwd", "pw_uid", "pw_gid", "pw_gecos", "pw_dir", "pw_shell")
@property
def pw_name(self) -> str: ...
@property

View File

@@ -1,7 +1,7 @@
import sys
from _typeshed import structseq
from typing import overload
from typing_extensions import final
from typing_extensions import Final, final
if sys.platform != "win32":
RLIMIT_AS: int
@@ -29,6 +29,25 @@ if sys.platform != "win32":
class struct_rusage(
structseq[float], tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
):
if sys.version_info >= (3, 10):
__match_args__: Final = (
"ru_utime",
"ru_stime",
"ru_maxrss",
"ru_ixrss",
"ru_idrss",
"ru_isrss",
"ru_minflt",
"ru_majflt",
"ru_nswap",
"ru_inblock",
"ru_oublock",
"ru_msgsnd",
"ru_msgrcv",
"ru_nsignals",
"ru_nvcsw",
"ru_nivcsw",
)
@property
def ru_utime(self) -> float: ...
@property

View File

@@ -3,7 +3,7 @@ from _typeshed import structseq
from enum import IntEnum
from types import FrameType
from typing import Any, Callable, Iterable, Union
from typing_extensions import final
from typing_extensions import Final, final
NSIG: int
@@ -148,6 +148,8 @@ else:
SIGRTMIN: Signals
@final
class struct_siginfo(structseq[int], tuple[int, int, int, int, int, int, int]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("si_signo", "si_code", "si_errno", "si_pid", "si_uid", "si_status", "si_band")
@property
def si_signo(self) -> int: ...
@property

View File

@@ -1,11 +1,23 @@
import sys
from _typeshed import structseq
from typing import Any
from typing_extensions import final
from typing_extensions import Final, final
if sys.platform != "win32":
@final
class struct_spwd(structseq[Any], tuple[str, str, int, int, int, int, int, int, int]):
if sys.version_info >= (3, 10):
__match_args__: Final = (
"sp_namp",
"sp_pwdp",
"sp_lstchg",
"sp_min",
"sp_max",
"sp_warn",
"sp_inact",
"sp_expire",
"sp_flag",
)
@property
def sp_namp(self) -> str: ...
@property