mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-25 21:31:09 +08:00
A new shade of Black (#11362)
This commit is contained in:
@@ -553,5 +553,6 @@ if sys.platform != "win32":
|
||||
major: int
|
||||
minor: int
|
||||
patch: int
|
||||
|
||||
ncurses_version: _ncurses_version
|
||||
window = _CursesWindow # undocumented
|
||||
|
||||
@@ -45,6 +45,7 @@ if sys.platform == "win32":
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
|
||||
def UuidCreate() -> str: ...
|
||||
def FCICreate(__cabname: str, __files: list[str]) -> None: ...
|
||||
def OpenDatabase(__path: str, __persist: int) -> _Database: ...
|
||||
|
||||
@@ -32,6 +32,7 @@ def get_native_id() -> int: ... # only available on some platforms
|
||||
class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread")
|
||||
|
||||
@property
|
||||
def exc_type(self) -> type[BaseException]: ...
|
||||
@property
|
||||
|
||||
@@ -25,6 +25,7 @@ if sys.version_info >= (3, 11):
|
||||
STATE_CON_MADE: str
|
||||
STATE_EOF: str
|
||||
STATE_CON_LOST: str
|
||||
|
||||
def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ...
|
||||
|
||||
else:
|
||||
|
||||
@@ -96,6 +96,7 @@ if sys.platform != "win32":
|
||||
def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ...
|
||||
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
|
||||
else:
|
||||
class SafeChildWatcher(BaseChildWatcher):
|
||||
def __enter__(self) -> Self: ...
|
||||
@@ -120,6 +121,7 @@ if sys.platform != "win32":
|
||||
else:
|
||||
def get_child_watcher(self) -> AbstractChildWatcher: ...
|
||||
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
|
||||
|
||||
SelectorEventLoop = _UnixSelectorEventLoop
|
||||
|
||||
DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
|
||||
@@ -136,6 +138,7 @@ if sys.platform != "win32":
|
||||
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
|
||||
else:
|
||||
class MultiLoopChildWatcher(AbstractChildWatcher):
|
||||
def is_active(self) -> bool: ...
|
||||
|
||||
@@ -69,6 +69,7 @@ if sys.platform == "win32":
|
||||
def recvfrom_into(
|
||||
self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0
|
||||
) -> futures.Future[tuple[int, socket._RetAddress]]: ...
|
||||
|
||||
SelectorEventLoop = _WindowsSelectorEventLoop
|
||||
|
||||
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
@@ -80,4 +81,5 @@ if sys.platform == "win32":
|
||||
_loop_factory: ClassVar[type[ProactorEventLoop]]
|
||||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
|
||||
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
|
||||
|
||||
@@ -166,6 +166,7 @@ if sys.version_info >= (3, 12):
|
||||
OCTOBER: Literal[10]
|
||||
NOVEMBER: Literal[11]
|
||||
DECEMBER: Literal[12]
|
||||
|
||||
JANUARY = Month.JANUARY
|
||||
FEBRUARY = Month.FEBRUARY
|
||||
MARCH = Month.MARCH
|
||||
@@ -187,6 +188,7 @@ if sys.version_info >= (3, 12):
|
||||
FRIDAY: Literal[4]
|
||||
SATURDAY: Literal[5]
|
||||
SUNDAY: Literal[6]
|
||||
|
||||
MONDAY = Day.MONDAY
|
||||
TUESDAY = Day.TUESDAY
|
||||
WEDNESDAY = Day.WEDNESDAY
|
||||
|
||||
@@ -118,6 +118,7 @@ class closing(AbstractContextManager[_SupportsCloseT]):
|
||||
if sys.version_info >= (3, 10):
|
||||
class _SupportsAclose(Protocol):
|
||||
def aclose(self) -> Awaitable[object]: ...
|
||||
|
||||
_SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose)
|
||||
|
||||
class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]):
|
||||
|
||||
@@ -37,4 +37,5 @@ if sys.platform != "win32":
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
|
||||
def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _gdbm: ...
|
||||
|
||||
@@ -33,4 +33,5 @@ if sys.platform != "win32":
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
|
||||
def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _dbm: ...
|
||||
|
||||
@@ -175,6 +175,7 @@ if sys.version_info >= (3, 11):
|
||||
name: str
|
||||
clsname: str
|
||||
member: Enum | None
|
||||
|
||||
_magic_enum_attr = property
|
||||
else:
|
||||
_magic_enum_attr = types.DynamicClassAttribute
|
||||
@@ -261,6 +262,7 @@ if sys.version_info >= (3, 11):
|
||||
CONTINUOUS: str
|
||||
NAMED_FLAGS: str
|
||||
UNIQUE: str
|
||||
|
||||
CONTINUOUS = EnumCheck.CONTINUOUS
|
||||
NAMED_FLAGS = EnumCheck.NAMED_FLAGS
|
||||
UNIQUE = EnumCheck.UNIQUE
|
||||
@@ -274,6 +276,7 @@ if sys.version_info >= (3, 11):
|
||||
CONFORM: str
|
||||
EJECT: str
|
||||
KEEP: str
|
||||
|
||||
STRICT = FlagBoundary.STRICT
|
||||
CONFORM = FlagBoundary.CONFORM
|
||||
EJECT = FlagBoundary.EJECT
|
||||
|
||||
@@ -7,6 +7,7 @@ if sys.platform != "win32":
|
||||
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
|
||||
|
||||
@@ -43,6 +43,7 @@ class PackageNotFoundError(ModuleNotFoundError):
|
||||
if sys.version_info >= (3, 11):
|
||||
class DeprecatedTuple:
|
||||
def __getitem__(self, item: int) -> str: ...
|
||||
|
||||
_EntryPointBase = DeprecatedTuple
|
||||
else:
|
||||
class _EntryPointBase(NamedTuple):
|
||||
|
||||
@@ -430,6 +430,7 @@ if sys.version_info < (3, 11):
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
defaults: tuple[Any, ...]
|
||||
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
|
||||
class FullArgSpec(NamedTuple):
|
||||
|
||||
@@ -56,6 +56,7 @@ if sys.platform == "win32":
|
||||
def gen_id(self, file: str) -> str: ...
|
||||
def append(self, full: str, file: str, logical: str) -> tuple[int, str]: ...
|
||||
def commit(self, db: _Database) -> None: ...
|
||||
|
||||
_directories: set[str]
|
||||
|
||||
class Directory:
|
||||
|
||||
@@ -86,4 +86,5 @@ class AbstractReducer(metaclass=ABCMeta):
|
||||
sendfds = _sendfds
|
||||
recvfds = _recvfds
|
||||
DupFd = _DupFd
|
||||
|
||||
def __init__(self, *args: Unused) -> None: ...
|
||||
|
||||
@@ -341,6 +341,7 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
|
||||
# More items may be added at the end by some implementations.
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("st_mode", "st_ino", "st_dev", "st_nlink", "st_uid", "st_gid", "st_size")
|
||||
|
||||
@property
|
||||
def st_mode(self) -> int: ... # protection bits,
|
||||
@property
|
||||
@@ -446,6 +447,7 @@ class statvfs_result(structseq[int], tuple[int, int, int, int, int, int, int, in
|
||||
"f_flag",
|
||||
"f_namemax",
|
||||
)
|
||||
|
||||
@property
|
||||
def f_bsize(self) -> int: ...
|
||||
@property
|
||||
@@ -488,6 +490,7 @@ def umask(__mask: int) -> int: ...
|
||||
class uname_result(structseq[str], tuple[str, str, str, str, str]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("sysname", "nodename", "release", "version", "machine")
|
||||
|
||||
@property
|
||||
def sysname(self) -> str: ...
|
||||
@property
|
||||
@@ -704,6 +707,7 @@ if sys.platform != "win32":
|
||||
class terminal_size(structseq[int], tuple[int, int]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("columns", "lines")
|
||||
|
||||
@property
|
||||
def columns(self) -> int: ...
|
||||
@property
|
||||
@@ -925,6 +929,7 @@ def system(command: StrOrBytesPath) -> int: ...
|
||||
class times_result(structseq[float], tuple[float, float, float, float, float]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("user", "system", "children_user", "children_system", "elapsed")
|
||||
|
||||
@property
|
||||
def user(self) -> float: ...
|
||||
@property
|
||||
@@ -962,6 +967,7 @@ else:
|
||||
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
|
||||
@@ -1022,6 +1028,7 @@ if sys.platform != "win32":
|
||||
class sched_param(structseq[int], tuple[int]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("sched_priority",)
|
||||
|
||||
def __new__(cls, sched_priority: int) -> Self: ...
|
||||
@property
|
||||
def sched_priority(self) -> int: ...
|
||||
|
||||
@@ -36,6 +36,7 @@ if sys.version_info >= (3, 9):
|
||||
percall_cumtime: float
|
||||
file_name: str
|
||||
line_number: int
|
||||
|
||||
@dataclass(unsafe_hash=True)
|
||||
class StatsProfile:
|
||||
total_tt: float
|
||||
|
||||
@@ -7,6 +7,7 @@ if sys.platform != "win32":
|
||||
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
|
||||
|
||||
@@ -52,9 +52,12 @@ class XMLParserType:
|
||||
EndDoctypeDeclHandler: Callable[[], Any] | None
|
||||
ElementDeclHandler: Callable[[str, _Model], Any] | None
|
||||
AttlistDeclHandler: Callable[[str, str, str, str | None, bool], Any] | None
|
||||
StartElementHandler: Callable[[str, dict[str, str]], Any] | Callable[[str, list[str]], Any] | Callable[
|
||||
[str, dict[str, str], list[str]], Any
|
||||
] | None
|
||||
StartElementHandler: (
|
||||
Callable[[str, dict[str, str]], Any]
|
||||
| Callable[[str, list[str]], Any]
|
||||
| Callable[[str, dict[str, str], list[str]], Any]
|
||||
| None
|
||||
)
|
||||
EndElementHandler: Callable[[str], Any] | None
|
||||
ProcessingInstructionHandler: Callable[[str, str], Any] | None
|
||||
CharacterDataHandler: Callable[[str], Any] | None
|
||||
|
||||
@@ -24,6 +24,7 @@ if sys.platform != "win32":
|
||||
RLIMIT_RTTIME: int
|
||||
RLIMIT_SIGPENDING: int
|
||||
RUSAGE_THREAD: int
|
||||
|
||||
@final
|
||||
class struct_rusage(
|
||||
structseq[float], tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
|
||||
@@ -47,6 +48,7 @@ if sys.platform != "win32":
|
||||
"ru_nvcsw",
|
||||
"ru_nivcsw",
|
||||
)
|
||||
|
||||
@property
|
||||
def ru_utime(self) -> float: ...
|
||||
@property
|
||||
|
||||
@@ -52,6 +52,7 @@ if sys.platform != "linux" and sys.platform != "win32":
|
||||
data: Any = ...,
|
||||
udata: Any = ...,
|
||||
) -> None: ...
|
||||
|
||||
# BSD only
|
||||
@final
|
||||
class kqueue:
|
||||
@@ -64,6 +65,7 @@ if sys.platform != "linux" and sys.platform != "win32":
|
||||
def fileno(self) -> int: ...
|
||||
@classmethod
|
||||
def fromfd(cls, __fd: FileDescriptorLike) -> kqueue: ...
|
||||
|
||||
KQ_EV_ADD: int
|
||||
KQ_EV_CLEAR: int
|
||||
KQ_EV_DELETE: int
|
||||
@@ -123,6 +125,7 @@ if sys.platform == "linux":
|
||||
def poll(self, timeout: float | None = None, maxevents: int = -1) -> list[tuple[int, int]]: ...
|
||||
@classmethod
|
||||
def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ...
|
||||
|
||||
EPOLLERR: int
|
||||
EPOLLEXCLUSIVE: int
|
||||
EPOLLET: int
|
||||
|
||||
@@ -126,6 +126,7 @@ else:
|
||||
SIG_BLOCK: int
|
||||
SIG_UNBLOCK: int
|
||||
SIG_SETMASK: int
|
||||
|
||||
SIG_BLOCK = Sigmasks.SIG_BLOCK
|
||||
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
|
||||
SIG_SETMASK = Sigmasks.SIG_SETMASK
|
||||
@@ -153,10 +154,12 @@ else:
|
||||
SIGRTMIN: Signals
|
||||
if sys.version_info >= (3, 11):
|
||||
SIGSTKFLT: 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
|
||||
|
||||
@@ -17,6 +17,7 @@ if sys.platform != "win32":
|
||||
"sp_expire",
|
||||
"sp_flag",
|
||||
)
|
||||
|
||||
@property
|
||||
def sp_namp(self) -> str: ...
|
||||
@property
|
||||
|
||||
@@ -2592,6 +2592,7 @@ if sys.platform == "win32":
|
||||
wShowWindow: int
|
||||
lpAttributeList: Mapping[str, Any]
|
||||
def copy(self) -> STARTUPINFO: ...
|
||||
|
||||
from _winapi import (
|
||||
ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS,
|
||||
BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS,
|
||||
|
||||
@@ -39,6 +39,7 @@ if sys.version_info >= (3, 9) and sys.platform == "linux":
|
||||
class struct_time(structseq[Any | int], _TimeTuple):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("tm_year", "tm_mon", "tm_mday", "tm_hour", "tm_min", "tm_sec", "tm_wday", "tm_yday", "tm_isdst")
|
||||
|
||||
@property
|
||||
def tm_year(self) -> int: ...
|
||||
@property
|
||||
|
||||
@@ -273,6 +273,7 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
def __or__(self, right: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, left: Any) -> _SpecialForm: ...
|
||||
|
||||
Concatenate: _SpecialForm
|
||||
TypeAlias: _SpecialForm
|
||||
TypeGuard: _SpecialForm
|
||||
@@ -864,6 +865,7 @@ class NamedTuple(tuple[Any, ...]):
|
||||
# So we only add it to the stub on 3.12+.
|
||||
if sys.version_info >= (3, 12):
|
||||
__orig_bases__: ClassVar[tuple[Any, ...]]
|
||||
|
||||
@overload
|
||||
def __init__(self, __typename: str, __fields: Iterable[tuple[str, Any]]) -> None: ...
|
||||
@overload
|
||||
@@ -885,6 +887,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
|
||||
# so we only add it to the stub on 3.12+
|
||||
if sys.version_info >= (3, 12):
|
||||
__orig_bases__: ClassVar[tuple[Any, ...]]
|
||||
|
||||
def copy(self) -> typing_extensions.Self: ...
|
||||
# Using Never so that only calls using mypy plugin hook that specialize the signature
|
||||
# can go through.
|
||||
|
||||
@@ -27,6 +27,7 @@ class TestResult:
|
||||
tb_locals: bool
|
||||
if sys.version_info >= (3, 12):
|
||||
collectedDurations: _DurationsType
|
||||
|
||||
def __init__(self, stream: TextIO | None = None, descriptions: bool | None = None, verbosity: int | None = None) -> None: ...
|
||||
def printErrors(self) -> None: ...
|
||||
def wasSuccessful(self) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user