mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-15 08:17:07 +08:00
stdlib: fix many attributes which are read-only at runtime but read-write in the stub (#7395)
This commit is contained in:
@@ -181,10 +181,14 @@ class InvalidMailbox(TokenList):
|
||||
token_type: str
|
||||
@property
|
||||
def display_name(self) -> None: ...
|
||||
local_part: None
|
||||
domain: None
|
||||
route: None
|
||||
addr_spec: None
|
||||
@property
|
||||
def local_part(self) -> None: ...
|
||||
@property
|
||||
def domain(self) -> None: ...
|
||||
@property
|
||||
def route(self) -> None: ...
|
||||
@property
|
||||
def addr_spec(self) -> None: ...
|
||||
|
||||
class Domain(TokenList):
|
||||
token_type: str
|
||||
|
||||
@@ -26,7 +26,8 @@ else:
|
||||
class HMAC:
|
||||
digest_size: int
|
||||
block_size: int
|
||||
name: str
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def __init__(self, key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod = ...) -> None: ...
|
||||
def update(self, msg: ReadableBuffer) -> None: ...
|
||||
def digest(self) -> bytes: ...
|
||||
|
||||
@@ -21,9 +21,12 @@ def _unquote(str: str) -> str: ...
|
||||
class CookieError(Exception): ...
|
||||
|
||||
class Morsel(dict[str, Any], Generic[_T]):
|
||||
value: str
|
||||
coded_value: _T
|
||||
key: str
|
||||
@property
|
||||
def value(self) -> str: ...
|
||||
@property
|
||||
def coded_value(self) -> _T: ...
|
||||
@property
|
||||
def key(self) -> str: ...
|
||||
def __init__(self) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def set(self, key: str, val: str, coded_val: _T) -> None: ...
|
||||
|
||||
@@ -22,7 +22,8 @@ class ModuleSpec:
|
||||
submodule_search_locations: list[str] | None
|
||||
loader_state: Any
|
||||
cached: str | None
|
||||
parent: str | None
|
||||
@property
|
||||
def parent(self) -> str | None: ...
|
||||
has_location: bool
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
|
||||
@@ -42,7 +42,9 @@ if sys.version_info >= (3, 10):
|
||||
from importlib.metadata._meta import PackageMetadata as PackageMetadata
|
||||
def packages_distributions() -> Mapping[str, list[str]]: ...
|
||||
|
||||
class PackageNotFoundError(ModuleNotFoundError): ...
|
||||
class PackageNotFoundError(ModuleNotFoundError):
|
||||
@property
|
||||
def name(self) -> str: ... # type: ignore[override]
|
||||
|
||||
class _EntryPointBase(NamedTuple):
|
||||
name: str
|
||||
|
||||
@@ -357,9 +357,12 @@ class Parameter:
|
||||
|
||||
class BoundArguments:
|
||||
arguments: OrderedDict[str, Any]
|
||||
args: tuple[Any, ...]
|
||||
kwargs: dict[str, Any]
|
||||
signature: Signature
|
||||
@property
|
||||
def args(self) -> tuple[Any, ...]: ...
|
||||
@property
|
||||
def kwargs(self) -> dict[str, Any]: ...
|
||||
@property
|
||||
def signature(self) -> Signature: ...
|
||||
def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ...
|
||||
def apply_defaults(self) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
@@ -3,6 +3,7 @@ import threading
|
||||
import weakref
|
||||
from queue import Queue as Queue
|
||||
from typing import Any, Callable, Iterable, Mapping, Sequence
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .connection import Pipe as Pipe
|
||||
|
||||
@@ -39,7 +40,8 @@ class DummyProcess(threading.Thread):
|
||||
_parent: threading.Thread
|
||||
_pid: None
|
||||
_start_called: int
|
||||
exitcode: int | None
|
||||
@property
|
||||
def exitcode(self) -> Literal[0] | None: ...
|
||||
def __init__(
|
||||
self,
|
||||
group: Any = ...,
|
||||
|
||||
@@ -20,14 +20,22 @@ if sys.version_info >= (3, 9):
|
||||
__all__ = ["PurePath", "PurePosixPath", "PureWindowsPath", "Path", "PosixPath", "WindowsPath"]
|
||||
|
||||
class PurePath(PathLike[str]):
|
||||
parts: tuple[str, ...]
|
||||
drive: str
|
||||
root: str
|
||||
anchor: str
|
||||
name: str
|
||||
suffix: str
|
||||
suffixes: list[str]
|
||||
stem: str
|
||||
@property
|
||||
def parts(self) -> tuple[str, ...]: ...
|
||||
@property
|
||||
def drive(self) -> str: ...
|
||||
@property
|
||||
def root(self) -> str: ...
|
||||
@property
|
||||
def anchor(self) -> str: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def suffix(self) -> str: ...
|
||||
@property
|
||||
def suffixes(self) -> list[str]: ...
|
||||
@property
|
||||
def stem(self) -> str: ...
|
||||
def __new__(cls: type[Self], *args: StrPath) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
@@ -200,8 +200,10 @@ class Helper:
|
||||
symbols: dict[str, str]
|
||||
topics: dict[str, str | tuple[str, ...]]
|
||||
def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ...
|
||||
input: IO[str]
|
||||
output: IO[str]
|
||||
@property
|
||||
def input(self) -> IO[str]: ...
|
||||
@property
|
||||
def output(self) -> IO[str]: ...
|
||||
def __call__(self, request: str | Helper | object = ...) -> None: ...
|
||||
def interact(self) -> None: ...
|
||||
def getline(self, prompt: str) -> str: ...
|
||||
|
||||
@@ -29,7 +29,11 @@ class shlex(Iterable[str]):
|
||||
lineno: int
|
||||
token: str
|
||||
eof: str
|
||||
punctuation_chars: str
|
||||
if sys.version_info >= (3, 7):
|
||||
@property
|
||||
def punctuation_chars(self) -> str: ...
|
||||
else:
|
||||
punctuation_chars: str
|
||||
def __init__(
|
||||
self,
|
||||
instream: str | TextIO | None = ...,
|
||||
|
||||
@@ -307,7 +307,8 @@ class SSLSocket(socket.socket):
|
||||
server_side: bool
|
||||
server_hostname: str | None
|
||||
session: SSLSession | None
|
||||
session_reused: bool | None
|
||||
@property
|
||||
def session_reused(self) -> bool | None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
else:
|
||||
@@ -441,10 +442,13 @@ class SSLContext:
|
||||
|
||||
class SSLObject:
|
||||
context: SSLContext
|
||||
server_side: bool
|
||||
server_hostname: str | None
|
||||
@property
|
||||
def server_side(self) -> bool: ...
|
||||
@property
|
||||
def server_hostname(self) -> str | None: ...
|
||||
session: SSLSession | None
|
||||
session_reused: bool
|
||||
@property
|
||||
def session_reused(self) -> bool: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
else:
|
||||
|
||||
@@ -120,7 +120,8 @@ class local:
|
||||
|
||||
class Thread:
|
||||
name: str
|
||||
ident: int | None
|
||||
@property
|
||||
def ident(self) -> int | None: ...
|
||||
daemon: bool
|
||||
def __init__(
|
||||
self,
|
||||
@@ -225,9 +226,12 @@ class Timer(Thread):
|
||||
def cancel(self) -> None: ...
|
||||
|
||||
class Barrier:
|
||||
parties: int
|
||||
n_waiting: int
|
||||
broken: bool
|
||||
@property
|
||||
def parties(self) -> int: ...
|
||||
@property
|
||||
def n_waiting(self) -> int: ...
|
||||
@property
|
||||
def broken(self) -> bool: ...
|
||||
def __init__(self, parties: int, action: Callable[[], None] | None = ..., timeout: float | None = ...) -> None: ...
|
||||
def wait(self, timeout: float | None = ...) -> int: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@@ -6,16 +6,20 @@ from typing_extensions import SupportsIndex
|
||||
def get_object_traceback(obj: object) -> Traceback | None: ...
|
||||
def take_snapshot() -> Snapshot: ...
|
||||
|
||||
class DomainFilter:
|
||||
class BaseFilter:
|
||||
inclusive: bool
|
||||
domain: int
|
||||
def __init__(self, inclusive: bool) -> None: ...
|
||||
|
||||
class DomainFilter(BaseFilter):
|
||||
@property
|
||||
def domain(self) -> int: ...
|
||||
def __init__(self, inclusive: bool, domain: int) -> None: ...
|
||||
|
||||
class Filter:
|
||||
class Filter(BaseFilter):
|
||||
domain: int | None
|
||||
inclusive: bool
|
||||
lineno: int | None
|
||||
filename_pattern: str
|
||||
@property
|
||||
def filename_pattern(self) -> str: ...
|
||||
all_frames: bool
|
||||
def __init__(
|
||||
self, inclusive: bool, filename_pattern: str, lineno: int | None = ..., all_frames: bool = ..., domain: int | None = ...
|
||||
@@ -40,8 +44,10 @@ class StatisticDiff:
|
||||
_FrameTupleT = tuple[str, int]
|
||||
|
||||
class Frame:
|
||||
filename: str
|
||||
lineno: int
|
||||
@property
|
||||
def filename(self) -> str: ...
|
||||
@property
|
||||
def lineno(self) -> int: ...
|
||||
def __init__(self, frame: _FrameTupleT) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self, other: Frame) -> bool: ...
|
||||
@@ -60,15 +66,19 @@ else:
|
||||
_TraceTupleT = tuple[int, int, Sequence[_FrameTupleT]]
|
||||
|
||||
class Trace:
|
||||
domain: int
|
||||
size: int
|
||||
traceback: Traceback
|
||||
@property
|
||||
def domain(self) -> int: ...
|
||||
@property
|
||||
def size(self) -> int: ...
|
||||
@property
|
||||
def traceback(self) -> Traceback: ...
|
||||
def __init__(self, trace: _TraceTupleT) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class Traceback(Sequence[Frame]):
|
||||
if sys.version_info >= (3, 9):
|
||||
total_nframe: int | None
|
||||
@property
|
||||
def total_nframe(self) -> int | None: ...
|
||||
def __init__(self, frames: Sequence[_FrameTupleT], total_nframe: int | None = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, frames: Sequence[_FrameTupleT]) -> None: ...
|
||||
|
||||
@@ -9,6 +9,8 @@ class URLError(IOError):
|
||||
def __init__(self, reason: str | BaseException, filename: str | None = ...) -> None: ...
|
||||
|
||||
class HTTPError(URLError, addinfourl):
|
||||
@property
|
||||
def reason(self) -> str: ... # type: ignore[override]
|
||||
code: int
|
||||
def __init__(self, url: str, code: int, msg: str, hdrs: Message, fp: IO[bytes] | None) -> None: ...
|
||||
|
||||
|
||||
@@ -49,10 +49,14 @@ class _ResultMixinBytes(_ResultMixinBase[bytes]):
|
||||
def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ...
|
||||
|
||||
class _NetlocResultMixinBase(Generic[AnyStr]):
|
||||
username: AnyStr | None
|
||||
password: AnyStr | None
|
||||
hostname: AnyStr | None
|
||||
port: int | None
|
||||
@property
|
||||
def username(self) -> AnyStr | None: ...
|
||||
@property
|
||||
def password(self) -> AnyStr | None: ...
|
||||
@property
|
||||
def hostname(self) -> AnyStr | None: ...
|
||||
@property
|
||||
def port(self) -> int | None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
|
||||
@@ -128,5 +128,6 @@ class finalize: # TODO: This is a good candidate for to be a `Generic[_P, _T]`
|
||||
def __call__(self, _: Any = ...) -> Any | None: ...
|
||||
def detach(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ...
|
||||
def peek(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ...
|
||||
alive: bool
|
||||
@property
|
||||
def alive(self) -> bool: ...
|
||||
atexit: bool
|
||||
|
||||
Reference in New Issue
Block a user