stdlib: Add defaults for positional-only parameters (#9655)

This commit is contained in:
Alex Waygood
2023-02-01 21:44:08 +00:00
committed by GitHub
parent 35172c7aab
commit 1d7dda7fa1
30 changed files with 159 additions and 155 deletions

View File

@@ -70,69 +70,69 @@ def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "stric
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
def lookup(__encoding: str) -> codecs.CodecInfo: ...
def charmap_build(__map: str) -> _CharMap: ...
def ascii_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
def ascii_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def charmap_decode(__data: ReadableBuffer, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[str, int]: ...
def charmap_encode(__str: str, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[bytes, int]: ...
def escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
def escape_encode(__data: bytes, __errors: str | None = ...) -> tuple[bytes, int]: ...
def latin_1_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
def latin_1_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def ascii_decode(__data: ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def ascii_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def charmap_decode(__data: ReadableBuffer, __errors: str | None = None, __mapping: _CharMap | None = None) -> tuple[str, int]: ...
def charmap_encode(__str: str, __errors: str | None = None, __mapping: _CharMap | None = None) -> tuple[bytes, int]: ...
def escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def escape_encode(__data: bytes, __errors: str | None = None) -> tuple[bytes, int]: ...
def latin_1_decode(__data: ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def latin_1_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
if sys.version_info >= (3, 9):
def raw_unicode_escape_decode(
__data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ...
__data: str | ReadableBuffer, __errors: str | None = None, __final: bool = True
) -> tuple[str, int]: ...
else:
def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def raw_unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def readbuffer_encode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[bytes, int]: ...
def raw_unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def readbuffer_encode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...
if sys.version_info >= (3, 9):
def unicode_escape_decode(
__data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ...
__data: str | ReadableBuffer, __errors: str | None = None, __final: bool = True
) -> tuple[str, int]: ...
else:
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
if sys.version_info < (3, 8):
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = ...) -> tuple[bytes, int]: ...
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_16_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ...
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_16_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ...
def utf_16_ex_decode(
__data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
__data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: int = False
) -> tuple[str, int, int]: ...
def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_16_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_32_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def utf_32_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_32_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ...
def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_16_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_32_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_32_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_32_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ...
def utf_32_ex_decode(
__data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
__data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: int = False
) -> tuple[str, int, int]: ...
def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_32_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def utf_7_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_7_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def utf_8_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def utf_8_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_32_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_7_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_7_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_8_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def utf_8_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
if sys.platform == "win32":
def mbcs_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def mbcs_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def mbcs_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def mbcs_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def code_page_decode(
__codepage: int, __data: ReadableBuffer, __errors: str | None = ..., __final: int = ...
__codepage: int, __data: ReadableBuffer, __errors: str | None = None, __final: int = False
) -> tuple[str, int]: ...
def code_page_encode(__code_page: int, __str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def oem_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
def oem_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def code_page_encode(__code_page: int, __str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def oem_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ...
def oem_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...

View File

@@ -212,7 +212,7 @@ class Context:
__hash__: ClassVar[None] # type: ignore[assignment]
def Etiny(self) -> int: ...
def Etop(self) -> int: ...
def create_decimal(self, __num: _DecimalNew = ...) -> Decimal: ...
def create_decimal(self, __num: _DecimalNew = "0") -> Decimal: ...
def create_decimal_from_float(self, __f: float) -> Decimal: ...
def abs(self, __x: _Decimal) -> Decimal: ...
def add(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...

View File

@@ -8,7 +8,7 @@ check_hash_based_pycs: str
def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
def create_builtin(__spec: ModuleSpec) -> types.ModuleType: ...
def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> types.ModuleType: ...
def create_dynamic(__spec: ModuleSpec, __file: Any = None) -> types.ModuleType: ...
def acquire_lock() -> None: ...
def exec_builtin(__mod: types.ModuleType) -> int: ...
def exec_dynamic(__mod: types.ModuleType) -> int: ...
@@ -22,7 +22,7 @@ def release_lock() -> None: ...
if sys.version_info >= (3, 11):
def find_frozen(__name: str, *, withdata: bool = False) -> tuple[memoryview | None, bool, str | None] | None: ...
def get_frozen_object(__name: str, __data: ReadableBuffer | None = ...) -> types.CodeType: ...
def get_frozen_object(__name: str, __data: ReadableBuffer | None = None) -> types.CodeType: ...
else:
def get_frozen_object(__name: str) -> types.CodeType: ...

View File

@@ -88,7 +88,7 @@ def setitem(__a: MutableSequence[_T], __b: SupportsIndex, __c: _T) -> None: ...
def setitem(__a: MutableSequence[_T], __b: slice, __c: Sequence[_T]) -> None: ...
@overload
def setitem(__a: MutableMapping[_K, _V], __b: _K, __c: _V) -> None: ...
def length_hint(__obj: object, __default: int = ...) -> int: ...
def length_hint(__obj: object, __default: int = 0) -> int: ...
@final
class attrgetter(Generic[_T_co]):
@overload

View File

@@ -5,7 +5,7 @@ _State: TypeAlias = tuple[int, ...]
class Random:
def __init__(self, seed: object = ...) -> None: ...
def seed(self, __n: object = ...) -> None: ...
def seed(self, __n: object = None) -> None: ...
def getstate(self) -> _State: ...
def setstate(self, __state: _State) -> None: ...
def random(self) -> float: ...

View File

@@ -60,7 +60,7 @@ class TkappType:
def createtimerhandler(self, __milliseconds, __func): ...
def deletecommand(self, __name): ...
def dooneevent(self, __flags: int = ...): ...
def dooneevent(self, __flags: int = 0): ...
def eval(self, __script: str) -> str: ...
def evalfile(self, __fileName): ...
def exprboolean(self, __s): ...
@@ -76,7 +76,7 @@ class TkappType:
def globalunsetvar(self, *args, **kwargs): ...
def interpaddr(self): ...
def loadtk(self) -> None: ...
def mainloop(self, __threshold: int = ...): ...
def mainloop(self, __threshold: int = 0): ...
def quit(self): ...
def record(self, __script): ...
def setvar(self, *ags, **kwargs): ...

View File

@@ -13,5 +13,5 @@ def is_tracing() -> bool: ...
if sys.version_info >= (3, 9):
def reset_peak() -> None: ...
def start(__nframe: int = ...) -> None: ...
def start(__nframe: int = 1) -> None: ...
def stop() -> None: ...

View File

@@ -33,6 +33,6 @@ def getweakrefs(__object: Any) -> list[Any]: ...
# Return CallableProxyType if object is callable, ProxyType otherwise
@overload
def proxy(__object: _C, __callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ...
def proxy(__object: _C, __callback: Callable[[_C], Any] | None = None) -> CallableProxyType[_C]: ...
@overload
def proxy(__object: _T, __callback: Callable[[_T], Any] | None = ...) -> Any: ...
def proxy(__object: _T, __callback: Callable[[_T], Any] | None = None) -> Any: ...

View File

@@ -169,7 +169,7 @@ if sys.platform == "win32":
__target_process_handle: int,
__desired_access: int,
__inherit_handle: bool,
__options: int = ...,
__options: int = 0,
) -> int: ...
def ExitProcess(__ExitCode: int) -> NoReturn: ...
def GetACP() -> int: ...
@@ -181,7 +181,7 @@ if sys.platform == "win32":
def GetStdHandle(__std_handle: int) -> int: ...
def GetVersion() -> int: ...
def OpenProcess(__desired_access: int, __inherit_handle: bool, __process_id: int) -> int: ...
def PeekNamedPipe(__handle: int, __size: int = ...) -> tuple[int, int] | tuple[bytes, int, int]: ...
def PeekNamedPipe(__handle: int, __size: int = 0) -> tuple[int, int] | tuple[bytes, int, int]: ...
if sys.version_info >= (3, 10):
def LCMapStringEx(locale: str, flags: int, src: str) -> str: ...
def UnmapViewOfFile(__address: int) -> None: ...
@@ -196,7 +196,7 @@ if sys.platform == "win32":
__named_pipe: int, __mode: int | None, __max_collection_count: int | None, __collect_data_timeout: int | None
) -> None: ...
def TerminateProcess(__handle: int, __exit_code: int) -> None: ...
def WaitForMultipleObjects(__handle_seq: Sequence[int], __wait_flag: bool, __milliseconds: int = ...) -> int: ...
def WaitForMultipleObjects(__handle_seq: Sequence[int], __wait_flag: bool, __milliseconds: int = 4294967295) -> int: ...
def WaitForSingleObject(__handle: int, __milliseconds: int) -> int: ...
def WaitNamedPipe(__name: str, __timeout: int) -> None: ...
@overload

View File

@@ -44,12 +44,12 @@ class array(MutableSequence[_T], Generic[_T]):
def fromlist(self, __list: list[_T]) -> None: ...
def fromunicode(self, __ustr: str) -> None: ...
if sys.version_info >= (3, 10):
def index(self, __v: _T, __start: int = ..., __stop: int = ...) -> int: ...
def index(self, __v: _T, __start: int = 0, __stop: int = sys.maxsize) -> int: ...
else:
def index(self, __v: _T) -> int: ... # type: ignore[override]
def insert(self, __i: int, __v: _T) -> None: ...
def pop(self, __i: int = ...) -> _T: ...
def pop(self, __i: int = -1) -> _T: ...
def remove(self, __v: _T) -> None: ...
def tobytes(self) -> bytes: ...
def tofile(self, __f: SupportsWrite[bytes]) -> None: ...

View File

@@ -32,8 +32,8 @@ def ratecv(
__inrate: int,
__outrate: int,
__state: _RatecvState | None,
__weightA: int = ...,
__weightB: int = ...,
__weightA: int = 1,
__weightB: int = 0,
) -> tuple[bytes, _RatecvState]: ...
def reverse(__fragment: bytes, __width: int) -> bytes: ...
def rms(__fragment: bytes, __width: int) -> int: ...

View File

@@ -26,7 +26,7 @@ if sys.version_info < (3, 11):
def b2a_hqx(__data: ReadableBuffer) -> bytes: ...
def crc_hqx(__data: ReadableBuffer, __crc: int) -> int: ...
def crc32(__data: ReadableBuffer, __crc: int = ...) -> int: ...
def crc32(__data: ReadableBuffer, __crc: int = 0) -> int: ...
if sys.version_info >= (3, 8):
# sep must be str or bytes, not bytearray or any other buffer

View File

@@ -266,7 +266,7 @@ class int:
def __pow__(self, __x: int, __modulo: None = ...) -> Any: ...
@overload
def __pow__(self, __x: int, __modulo: int) -> int: ...
def __rpow__(self, __x: int, __mod: int | None = ...) -> Any: ...
def __rpow__(self, __x: int, __mod: int | None = None) -> Any: ...
def __and__(self, __n: int) -> int: ...
def __or__(self, __n: int) -> int: ...
def __xor__(self, __n: int) -> int: ...
@@ -317,11 +317,11 @@ class float:
def __mod__(self, __x: float) -> float: ...
def __divmod__(self, __x: float) -> tuple[float, float]: ...
@overload
def __pow__(self, __x: int, __mod: None = ...) -> float: ...
def __pow__(self, __x: int, __mod: None = None) -> float: ...
# positive x -> float; negative x -> complex
# return type must be Any as `float | complex` causes too many false-positive errors
@overload
def __pow__(self, __x: float, __mod: None = ...) -> Any: ...
def __pow__(self, __x: float, __mod: None = None) -> Any: ...
def __radd__(self, __x: float) -> float: ...
def __rsub__(self, __x: float) -> float: ...
def __rmul__(self, __x: float) -> float: ...
@@ -332,10 +332,10 @@ class float:
@overload
def __rpow__(self, __x: _PositiveInteger, __modulo: None = ...) -> float: ...
@overload
def __rpow__(self, __x: _NegativeInteger, __mod: None = ...) -> complex: ...
def __rpow__(self, __x: _NegativeInteger, __mod: None = None) -> complex: ...
# Returning `complex` for the general case gives too many false-positive errors.
@overload
def __rpow__(self, __x: float, __mod: None = ...) -> Any: ...
def __rpow__(self, __x: float, __mod: None = None) -> Any: ...
def __getnewargs__(self) -> tuple[float]: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3, 9):
@@ -343,7 +343,7 @@ class float:
def __floor__(self) -> int: ...
@overload
def __round__(self, __ndigits: None = ...) -> int: ...
def __round__(self, __ndigits: None = None) -> int: ...
@overload
def __round__(self, __ndigits: SupportsIndex) -> float: ...
def __eq__(self, __x: object) -> bool: ...
@@ -386,12 +386,12 @@ class complex:
def __add__(self, __x: complex) -> complex: ...
def __sub__(self, __x: complex) -> complex: ...
def __mul__(self, __x: complex) -> complex: ...
def __pow__(self, __x: complex, __mod: None = ...) -> complex: ...
def __pow__(self, __x: complex, __mod: None = None) -> complex: ...
def __truediv__(self, __x: complex) -> complex: ...
def __radd__(self, __x: complex) -> complex: ...
def __rsub__(self, __x: complex) -> complex: ...
def __rmul__(self, __x: complex) -> complex: ...
def __rpow__(self, __x: complex, __mod: None = ...) -> complex: ...
def __rpow__(self, __x: complex, __mod: None = None) -> complex: ...
def __rtruediv__(self, __x: complex) -> complex: ...
def __eq__(self, __x: object) -> bool: ...
def __ne__(self, __x: object) -> bool: ...
@@ -422,9 +422,9 @@ class str(Sequence[str]):
@overload
def casefold(self) -> str: ... # type: ignore[misc]
@overload
def center(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
def center(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
@overload
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
def center(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
def endswith(
@@ -465,27 +465,27 @@ class str(Sequence[str]):
@overload
def join(self, __iterable: Iterable[str]) -> str: ... # type: ignore[misc]
@overload
def ljust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
def ljust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
@overload
def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
def ljust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
@overload
def lower(self: LiteralString) -> LiteralString: ...
@overload
def lower(self) -> str: ... # type: ignore[misc]
@overload
def lstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
def lstrip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
@overload
def lstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
def lstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
@overload
def partition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
@overload
def partition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
@overload
def replace(
self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = ...
self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = -1
) -> LiteralString: ...
@overload
def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ... # type: ignore[misc]
def replace(self, __old: str, __new: str, __count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
if sys.version_info >= (3, 9):
@overload
def removeprefix(self: LiteralString, __prefix: LiteralString) -> LiteralString: ...
@@ -499,9 +499,9 @@ class str(Sequence[str]):
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@overload
def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
@overload
def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
def rjust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
@overload
def rpartition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
@overload
@@ -511,9 +511,9 @@ class str(Sequence[str]):
@overload
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
@overload
def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
def rstrip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
@overload
def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
def rstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
@overload
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
@overload
@@ -526,9 +526,9 @@ class str(Sequence[str]):
self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
@overload
def strip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
def strip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
@overload
def strip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
def strip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
@overload
def swapcase(self: LiteralString) -> LiteralString: ...
@overload
@@ -633,9 +633,9 @@ class bytes(ByteString):
def join(self, __iterable_of_bytes: Iterable[ReadableBuffer]) -> bytes: ...
def ljust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytes: ...
def lower(self) -> bytes: ...
def lstrip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ...
def lstrip(self, __bytes: ReadableBuffer | None = None) -> bytes: ...
def partition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ...
def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = ...) -> bytes: ...
def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = -1) -> bytes: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: ReadableBuffer) -> bytes: ...
def removesuffix(self, __suffix: ReadableBuffer) -> bytes: ...
@@ -649,7 +649,7 @@ class bytes(ByteString):
def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytes: ...
def rpartition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ...
def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ...
def rstrip(self, __bytes: ReadableBuffer | None = None) -> bytes: ...
def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ...
def splitlines(self, keepends: bool = False) -> list[bytes]: ...
def startswith(
@@ -658,7 +658,7 @@ class bytes(ByteString):
__start: SupportsIndex | None = ...,
__end: SupportsIndex | None = ...,
) -> bool: ...
def strip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ...
def strip(self, __bytes: ReadableBuffer | None = None) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, __table: ReadableBuffer | None, delete: bytes = ...) -> bytes: ...
@@ -740,15 +740,15 @@ class bytearray(MutableSequence[int], ByteString):
def join(self, __iterable_of_bytes: Iterable[ReadableBuffer]) -> bytearray: ...
def ljust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ...
def lstrip(self, __bytes: ReadableBuffer | None = None) -> bytearray: ...
def partition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ...
def pop(self, __index: int = ...) -> int: ...
def pop(self, __index: int = -1) -> int: ...
def remove(self, __value: int) -> None: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: ReadableBuffer) -> bytearray: ...
def removesuffix(self, __suffix: ReadableBuffer) -> bytearray: ...
def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = ...) -> bytearray: ...
def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = -1) -> bytearray: ...
def rfind(
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
@@ -758,7 +758,7 @@ class bytearray(MutableSequence[int], ByteString):
def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytearray: ...
def rpartition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ...
def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ...
def rstrip(self, __bytes: ReadableBuffer | None = None) -> bytearray: ...
def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ...
def splitlines(self, keepends: bool = False) -> list[bytearray]: ...
def startswith(
@@ -767,7 +767,7 @@ class bytearray(MutableSequence[int], ByteString):
__start: SupportsIndex | None = ...,
__end: SupportsIndex | None = ...,
) -> bool: ...
def strip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ...
def strip(self, __bytes: ReadableBuffer | None = None) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, __table: ReadableBuffer | None, delete: bytes = ...) -> bytearray: ...
@@ -932,7 +932,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
def __mul__(self, __n: SupportsIndex) -> tuple[_T_co, ...]: ...
def __rmul__(self, __n: SupportsIndex) -> tuple[_T_co, ...]: ...
def count(self, __value: Any) -> int: ...
def index(self, __value: Any, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ...
def index(self, __value: Any, __start: SupportsIndex = 0, __stop: SupportsIndex = sys.maxsize) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
@@ -968,10 +968,10 @@ class list(MutableSequence[_T], Generic[_T]):
def copy(self) -> list[_T]: ...
def append(self, __object: _T) -> None: ...
def extend(self, __iterable: Iterable[_T]) -> None: ...
def pop(self, __index: SupportsIndex = ...) -> _T: ...
def pop(self, __index: SupportsIndex = -1) -> _T: ...
# Signature of `list.index` should be kept in line with `collections.UserList.index()`
# and multiprocessing.managers.ListProxy.index()
def index(self, __value: _T, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ...
def index(self, __value: _T, __start: SupportsIndex = 0, __stop: SupportsIndex = sys.maxsize) -> int: ...
def count(self, __value: _T) -> int: ...
def insert(self, __index: SupportsIndex, __object: _T) -> None: ...
def remove(self, __value: _T) -> None: ...
@@ -1043,7 +1043,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
@classmethod
@overload
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Any | None]: ...
def fromkeys(cls, __iterable: Iterable[_T], __value: None = None) -> dict[_T, Any | None]: ...
@classmethod
@overload
def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ...
@@ -1323,15 +1323,17 @@ def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ...
# The `globals` argument to `eval` has to be `dict[str, Any]` rather than `dict[str, object]` due to invariance.
# (The `globals` argument has to be a "real dict", rather than any old mapping, unlike the `locals` argument.)
def eval(
__source: str | ReadableBuffer | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, object] | None = ...
__source: str | ReadableBuffer | CodeType,
__globals: dict[str, Any] | None = None,
__locals: Mapping[str, object] | None = None,
) -> Any: ...
# Comment above regarding `eval` applies to `exec` as well
if sys.version_info >= (3, 11):
def exec(
__source: str | ReadableBuffer | CodeType,
__globals: dict[str, Any] | None = ...,
__locals: Mapping[str, object] | None = ...,
__globals: dict[str, Any] | None = None,
__locals: Mapping[str, object] | None = None,
*,
closure: tuple[_Cell, ...] | None = None,
) -> None: ...
@@ -1339,8 +1341,8 @@ if sys.version_info >= (3, 11):
else:
def exec(
__source: str | ReadableBuffer | CodeType,
__globals: dict[str, Any] | None = ...,
__locals: Mapping[str, object] | None = ...,
__globals: dict[str, Any] | None = None,
__locals: Mapping[str, object] | None = None,
) -> None: ...
def exit(code: sys._ExitCode = None) -> NoReturn: ...
@@ -1355,7 +1357,7 @@ class filter(Iterator[_T], Generic[_T]):
def __iter__(self: Self) -> Self: ...
def __next__(self) -> _T: ...
def format(__value: object, __format_spec: str = ...) -> str: ...
def format(__value: object, __format_spec: str = "") -> str: ...
@overload
def getattr(__o: object, __name: str) -> Any: ...
@@ -1378,7 +1380,7 @@ def hash(__obj: object) -> int: ...
def help(request: object = ...) -> None: ...
def hex(__number: int | SupportsIndex) -> str: ...
def id(__obj: object) -> int: ...
def input(__prompt: object = ...) -> str: ...
def input(__prompt: object = None) -> str: ...
class _GetItemIterable(Protocol[_T_co]):
def __getitem__(self, __i: int) -> _T_co: ...
@@ -1728,7 +1730,7 @@ if sys.version_info >= (3, 8):
else:
@overload
def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = ...) -> int: ... # type: ignore[misc]
def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = 0) -> int: ... # type: ignore[misc]
@overload
def sum(__iterable: Iterable[_SupportsSumNoDefaultT]) -> _SupportsSumNoDefaultT | Literal[0]: ...

View File

@@ -49,9 +49,9 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
data: dict[_KT, _VT]
# __init__ should be kept roughly in line with `dict.__init__`, which has the same semantics
@overload
def __init__(self, __dict: None = ...) -> None: ...
def __init__(self, __dict: None = None) -> None: ...
@overload
def __init__(self: UserDict[str, _VT], __dict: None = ..., **kwargs: _VT) -> None: ...
def __init__(self: UserDict[str, _VT], __dict: None = None, **kwargs: _VT) -> None: ...
@overload
def __init__(self, __dict: SupportsKeysAndGetItem[_KT, _VT]) -> None: ...
@overload
@@ -254,9 +254,9 @@ class deque(MutableSequence[_T], Generic[_T]):
class Counter(dict[_T, int], Generic[_T]):
@overload
def __init__(self, __iterable: None = ...) -> None: ...
def __init__(self, __iterable: None = None) -> None: ...
@overload
def __init__(self: Counter[str], __iterable: None = ..., **kwargs: int) -> None: ...
def __init__(self: Counter[str], __iterable: None = None, **kwargs: int) -> None: ...
@overload
def __init__(self, __mapping: SupportsKeysAndGetItem[_T, int]) -> None: ...
@overload
@@ -267,7 +267,7 @@ class Counter(dict[_T, int], Generic[_T]):
@classmethod
def fromkeys(cls, iterable: Any, v: int | None = None) -> NoReturn: ... # type: ignore[override]
@overload
def subtract(self, __iterable: None = ...) -> None: ...
def subtract(self, __iterable: None = None) -> None: ...
@overload
def subtract(self, __mapping: Mapping[_T, int]) -> None: ...
@overload

View File

@@ -6,16 +6,16 @@ class IncrementalEncoder(codecs.IncrementalEncoder):
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
@staticmethod
def _buffer_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ...
def _buffer_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
class StreamWriter(codecs.StreamWriter):
@staticmethod
def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
class StreamReader(codecs.StreamReader):
@staticmethod
def decode(__data: ReadableBuffer, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ...
def decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
def getregentry() -> codecs.CodecInfo: ...
def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
def encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ...

View File

@@ -61,7 +61,7 @@ class IOBase(metaclass=abc.ABCMeta):
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
read: Callable[..., Any]
def readlines(self, __hint: int = ...) -> list[bytes]: ...
def readlines(self, __hint: int = -1) -> list[bytes]: ...
def seek(self, __offset: int, __whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
@@ -69,7 +69,7 @@ class IOBase(metaclass=abc.ABCMeta):
def writable(self) -> bool: ...
write: Callable[..., Any]
def writelines(self, __lines: Iterable[ReadableBuffer]) -> None: ...
def readline(self, __size: int | None = ...) -> bytes: ...
def readline(self, __size: int | None = -1) -> bytes: ...
def __del__(self) -> None: ...
@property
def closed(self) -> bool: ...
@@ -79,7 +79,7 @@ class RawIOBase(IOBase):
def readall(self) -> bytes: ...
def readinto(self, __buffer: WriteableBuffer) -> int | None: ...
def write(self, __b: ReadableBuffer) -> int | None: ...
def read(self, __size: int = ...) -> bytes | None: ...
def read(self, __size: int = -1) -> bytes | None: ...
class BufferedIOBase(IOBase):
raw: RawIOBase # This is not part of the BufferedIOBase API and may not exist on some implementations.
@@ -99,7 +99,7 @@ class FileIO(RawIOBase, BinaryIO):
@property
def closefd(self) -> bool: ...
def write(self, __b: ReadableBuffer) -> int: ...
def read(self, __size: int = ...) -> bytes: ...
def read(self, __size: int = -1) -> bytes: ...
def __enter__(self: Self) -> Self: ...
class BytesIO(BufferedIOBase, BinaryIO):
@@ -111,12 +111,12 @@ class BytesIO(BufferedIOBase, BinaryIO):
def __enter__(self: Self) -> Self: ...
def getvalue(self) -> bytes: ...
def getbuffer(self) -> memoryview: ...
def read1(self, __size: int | None = ...) -> bytes: ...
def read1(self, __size: int | None = -1) -> bytes: ...
class BufferedReader(BufferedIOBase, BinaryIO):
def __enter__(self: Self) -> Self: ...
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
def peek(self, __size: int = ...) -> bytes: ...
def peek(self, __size: int = 0) -> bytes: ...
class BufferedWriter(BufferedIOBase, BinaryIO):
def __enter__(self: Self) -> Self: ...
@@ -125,7 +125,7 @@ class BufferedWriter(BufferedIOBase, BinaryIO):
class BufferedRandom(BufferedReader, BufferedWriter):
def __enter__(self: Self) -> Self: ...
def seek(self, __target: int, __whence: int = ...) -> int: ... # stubtest needs this
def seek(self, __target: int, __whence: int = 0) -> int: ... # stubtest needs this
class BufferedRWPair(BufferedIOBase):
def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = ...) -> None: ...
@@ -141,7 +141,7 @@ class TextIOBase(IOBase):
def write(self, __s: str) -> int: ...
def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override]
def readline(self, __size: int = ...) -> str: ... # type: ignore[override]
def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore[override]
def readlines(self, __hint: int = -1) -> list[str]: ... # type: ignore[override]
def read(self, __size: int | None = ...) -> str: ...
class TextIOWrapper(TextIOBase, TextIO):
@@ -176,9 +176,9 @@ class TextIOWrapper(TextIOBase, TextIO):
def __iter__(self) -> Iterator[str]: ... # type: ignore[override]
def __next__(self) -> str: ... # type: ignore[override]
def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override]
def readline(self, __size: int = ...) -> str: ... # type: ignore[override]
def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore[override]
def seek(self, __cookie: int, __whence: int = ...) -> int: ... # stubtest needs this
def readline(self, __size: int = -1) -> str: ... # type: ignore[override]
def readlines(self, __hint: int = -1) -> list[str]: ... # type: ignore[override]
def seek(self, __cookie: int, __whence: int = 0) -> int: ... # stubtest needs this
class StringIO(TextIOWrapper):
def __init__(self, initial_value: str | None = ..., newline: str | None = ...) -> None: ...

View File

@@ -111,7 +111,7 @@ class takewhile(Iterator[_T], Generic[_T]):
def __iter__(self: Self) -> Self: ...
def __next__(self) -> _T: ...
def tee(__iterable: Iterable[_T], __n: int = ...) -> tuple[Iterator[_T], ...]: ...
def tee(__iterable: Iterable[_T], __n: int = 2) -> tuple[Iterator[_T], ...]: ...
class zip_longest(Iterator[_T_co], Generic[_T_co]):
# one iterable (fillvalue doesn't matter)

View File

@@ -27,7 +27,7 @@ _Marshallable: TypeAlias = Union[
ReadableBuffer,
]
def dump(__value: _Marshallable, __file: SupportsWrite[bytes], __version: int = ...) -> None: ...
def dump(__value: _Marshallable, __file: SupportsWrite[bytes], __version: int = 4) -> None: ...
def load(__file: SupportsRead[bytes]) -> Any: ...
def dumps(__value: _Marshallable, __version: int = ...) -> bytes: ...
def dumps(__value: _Marshallable, __version: int = 4) -> bytes: ...
def loads(__bytes: ReadableBuffer) -> Any: ...

View File

@@ -116,7 +116,7 @@ if sys.version_info >= (3, 9):
def nextafter(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
def perm(__n: SupportsIndex, __k: SupportsIndex | None = ...) -> int: ...
def perm(__n: SupportsIndex, __k: SupportsIndex | None = None) -> int: ...
def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...

View File

@@ -49,9 +49,9 @@ HAVE_ARGUMENT: Literal[90]
EXTENDED_ARG: Literal[144]
if sys.version_info >= (3, 8):
def stack_effect(__opcode: int, __oparg: int | None = ..., *, jump: bool | None = None) -> int: ...
def stack_effect(__opcode: int, __oparg: int | None = None, *, jump: bool | None = None) -> int: ...
else:
def stack_effect(__opcode: int, __oparg: int | None = ...) -> int: ...
def stack_effect(__opcode: int, __oparg: int | None = None) -> int: ...
hasnargs: list[int]

View File

@@ -10,7 +10,9 @@ if sys.version_info >= (3, 8):
def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ...
else:
def libc_ver(executable: str = ..., lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ...
def libc_ver(
executable: str = sys.executable, lib: str = "", version: str = "", chunksize: int = 16384
) -> tuple[str, str]: ...
if sys.version_info < (3, 8):
def linux_distribution(

View File

@@ -24,14 +24,14 @@ _Model: TypeAlias = tuple[int, int, str | None, tuple[Any, ...]]
@final
class XMLParserType:
def Parse(self, __data: str | ReadableBuffer, __isfinal: bool = ...) -> int: ...
def Parse(self, __data: str | ReadableBuffer, __isfinal: bool = False) -> int: ...
def ParseFile(self, __file: SupportsRead[bytes]) -> int: ...
def SetBase(self, __base: str) -> None: ...
def GetBase(self) -> str | None: ...
def GetInputContext(self) -> bytes | None: ...
def ExternalEntityParserCreate(self, __context: str | None, __encoding: str = ...) -> XMLParserType: ...
def SetParamEntityParsing(self, __flag: int) -> int: ...
def UseForeignDTD(self, __flag: bool = ...) -> None: ...
def UseForeignDTD(self, __flag: bool = True) -> None: ...
@property
def intern(self) -> dict[str, str]: ...
buffer_size: int

View File

@@ -89,9 +89,9 @@ class Match(Generic[AnyStr]):
def groupdict(self) -> dict[str, AnyStr | Any]: ...
@overload
def groupdict(self, default: _T) -> dict[str, AnyStr | _T]: ...
def start(self, __group: int | str = ...) -> int: ...
def end(self, __group: int | str = ...) -> int: ...
def span(self, __group: int | str = ...) -> tuple[int, int]: ...
def start(self, __group: int | str = 0) -> int: ...
def end(self, __group: int | str = 0) -> int: ...
def span(self, __group: int | str = 0) -> tuple[int, int]: ...
@property
def regs(self) -> tuple[tuple[int, int], ...]: ... # undocumented
# __getitem__() returns "AnyStr" or "AnyStr | None", depending on the pattern.

View File

@@ -27,7 +27,7 @@ class poll:
def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ...
def select(
__rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: float | None = ...
__rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: float | None = None
) -> tuple[list[Any], list[Any], list[Any]]: ...
error = OSError

View File

@@ -386,7 +386,7 @@ class Cursor(Iterator[Any]):
# putting None in the return annotation causes annoying false positives.
def fetchone(self) -> Any: ...
def setinputsizes(self, __sizes: Unused) -> None: ... # does nothing
def setoutputsize(self, __size: Unused, __column: Unused = ...) -> None: ... # does nothing
def setoutputsize(self, __size: Unused, __column: Unused = None) -> None: ... # does nothing
def __iter__(self: Self) -> Self: ...
def __next__(self) -> Any: ...
@@ -446,11 +446,11 @@ if sys.version_info >= (3, 11):
@final
class Blob:
def close(self) -> None: ...
def read(self, __length: int = ...) -> bytes: ...
def read(self, __length: int = -1) -> bytes: ...
def write(self, __data: ReadableBuffer) -> None: ...
def tell(self) -> int: ...
# whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END
def seek(self, __offset: int, __origin: int = ...) -> None: ...
def seek(self, __offset: int, __origin: int = 0) -> None: ...
def __len__(self) -> int: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, __typ: object, __val: object, __tb: object) -> Literal[False]: ...

View File

@@ -466,7 +466,7 @@ class SSLObject:
class MemoryBIO:
pending: int
eof: bool
def read(self, __size: int = ...) -> bytes: ...
def read(self, __size: int = -1) -> bytes: ...
def write(self, __buf: ReadableBuffer) -> int: ...
def write_eof(self) -> None: ...

View File

@@ -218,7 +218,7 @@ version_info: _version_info
def call_tracing(__func: Callable[..., _T], __args: Any) -> _T: ...
def _clear_type_cache() -> None: ...
def _current_frames() -> dict[int, FrameType]: ...
def _getframe(__depth: int = ...) -> FrameType: ...
def _getframe(__depth: int = 0) -> FrameType: ...
def _debugmallocstats() -> None: ...
def __displayhook__(__value: object) -> None: ...
def __excepthook__(__exctype: type[BaseException], __value: BaseException, __traceback: TracebackType | None) -> None: ...
@@ -227,7 +227,7 @@ def exc_info() -> OptExcInfo: ...
if sys.version_info >= (3, 11):
def exception() -> BaseException | None: ...
def exit(__status: _ExitCode = ...) -> NoReturn: ...
def exit(__status: _ExitCode = None) -> NoReturn: ...
def getallocatedblocks() -> int: ...
def getdefaultencoding() -> str: ...

View File

@@ -362,11 +362,11 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
@overload
@abstractmethod
def throw(
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
self, __typ: Type[BaseException], __val: BaseException | object = None, __tb: TracebackType | None = None
) -> _T_co: ...
@overload
@abstractmethod
def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
def throw(self, __typ: BaseException, __val: None = None, __tb: TracebackType | None = None) -> _T_co: ...
def close(self) -> None: ...
def __iter__(self) -> Generator[_T_co, _T_contra, _V_co]: ...
@property
@@ -399,11 +399,11 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
@overload
@abstractmethod
def throw(
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
self, __typ: Type[BaseException], __val: BaseException | object = None, __tb: TracebackType | None = None
) -> _T_co: ...
@overload
@abstractmethod
def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
def throw(self, __typ: BaseException, __val: None = None, __tb: TracebackType | None = None) -> _T_co: ...
@abstractmethod
def close(self) -> None: ...
@@ -432,11 +432,11 @@ class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]):
@overload
@abstractmethod
def athrow(
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
self, __typ: Type[BaseException], __val: BaseException | object = None, __tb: TracebackType | None = None
) -> Awaitable[_T_co]: ...
@overload
@abstractmethod
def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ...
def athrow(self, __typ: BaseException, __val: None = None, __tb: TracebackType | None = None) -> Awaitable[_T_co]: ...
def aclose(self) -> Awaitable[None]: ...
@property
def ag_await(self) -> Any: ...
@@ -664,21 +664,21 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
@abstractmethod
def isatty(self) -> bool: ...
@abstractmethod
def read(self, __n: int = ...) -> AnyStr: ...
def read(self, __n: int = -1) -> AnyStr: ...
@abstractmethod
def readable(self) -> bool: ...
@abstractmethod
def readline(self, __limit: int = ...) -> AnyStr: ...
def readline(self, __limit: int = -1) -> AnyStr: ...
@abstractmethod
def readlines(self, __hint: int = ...) -> list[AnyStr]: ...
def readlines(self, __hint: int = -1) -> list[AnyStr]: ...
@abstractmethod
def seek(self, __offset: int, __whence: int = ...) -> int: ...
def seek(self, __offset: int, __whence: int = 0) -> int: ...
@abstractmethod
def seekable(self) -> bool: ...
@abstractmethod
def tell(self) -> int: ...
@abstractmethod
def truncate(self, __size: int | None = ...) -> int: ...
def truncate(self, __size: int | None = None) -> int: ...
@abstractmethod
def writable(self) -> bool: ...
@abstractmethod

View File

@@ -321,7 +321,7 @@ class TreeBuilder:
if sys.version_info >= (3, 8):
# These two methods have pos-only parameters in the C implementation
def comment(self, __text: str | None) -> Element: ...
def pi(self, __target: str, __text: str | None = ...) -> Element: ...
def pi(self, __target: str, __text: str | None = None) -> Element: ...
if sys.version_info >= (3, 8):
class C14NWriterTarget:

View File

@@ -40,7 +40,7 @@ class _Decompress:
def flush(self, length: int = ...) -> bytes: ...
def copy(self) -> _Decompress: ...
def adler32(__data: ReadableBuffer, __value: int = ...) -> int: ...
def adler32(__data: ReadableBuffer, __value: int = 1) -> int: ...
if sys.version_info >= (3, 11):
def compress(__data: ReadableBuffer, level: int = -1, wbits: int = 15) -> bytes: ...
@@ -51,6 +51,6 @@ else:
def compressobj(
level: int = -1, method: int = 8, wbits: int = 15, memLevel: int = 8, strategy: int = 0, zdict: ReadableBuffer | None = None
) -> _Compress: ...
def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ...
def crc32(__data: ReadableBuffer, __value: int = 0) -> int: ...
def decompress(__data: ReadableBuffer, wbits: int = 15, bufsize: int = 16384) -> bytes: ...
def decompressobj(wbits: int = 15, zdict: ReadableBuffer = ...) -> _Decompress: ...