stdlib: fix many attributes which are read-only at runtime but read-write in the stub (#7395)

This commit is contained in:
Alex Waygood
2022-02-28 00:23:09 +00:00
committed by GitHub
parent 46da0b87ea
commit a0b41959ec
17 changed files with 104 additions and 50 deletions

View File

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

View File

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