stdlib: add argument default values (#9501)

This commit is contained in:
Jelle Zijlstra
2023-01-18 00:37:34 -08:00
committed by GitHub
parent 6cb934291f
commit ddfaca3200
272 changed files with 2529 additions and 2467 deletions

View File

@@ -217,15 +217,15 @@ class int:
if sys.version_info >= (3, 11):
def to_bytes(
self, length: SupportsIndex = ..., byteorder: Literal["little", "big"] = ..., *, signed: bool = ...
self, length: SupportsIndex = 1, byteorder: Literal["little", "big"] = "big", *, signed: bool = False
) -> bytes: ...
@classmethod
def from_bytes(
cls: type[Self],
bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
byteorder: Literal["little", "big"] = ...,
byteorder: Literal["little", "big"] = "big",
*,
signed: bool = ...,
signed: bool = False,
) -> Self: ...
else:
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
@@ -426,7 +426,7 @@ class str(Sequence[str]):
@overload
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 = ..., errors: str = ...) -> bytes: ...
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
def endswith(
self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
@@ -596,7 +596,7 @@ class bytes(ByteString):
def count(
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ...
def endswith(
self,
__suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
@@ -604,7 +604,7 @@ class bytes(ByteString):
__end: SupportsIndex | None = ...,
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> bytes: ...
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytes: ...
else:
def expandtabs(self, tabsize: int = ...) -> bytes: ...
@@ -645,10 +645,10 @@ class bytes(ByteString):
) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytes: ...
def rpartition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ...
def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ...
def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ...
def split(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ...
def splitlines(self, keepends: bool = ...) -> list[bytes]: ...
def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ...
def splitlines(self, keepends: bool = False) -> list[bytes]: ...
def startswith(
self,
__prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
@@ -701,7 +701,7 @@ class bytearray(MutableSequence[int], ByteString):
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
def copy(self) -> bytearray: ...
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ...
def endswith(
self,
__suffix: ReadableBuffer | tuple[ReadableBuffer, ...],
@@ -709,7 +709,7 @@ class bytearray(MutableSequence[int], ByteString):
__end: SupportsIndex | None = ...,
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> bytearray: ...
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytearray: ...
else:
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
@@ -754,10 +754,10 @@ class bytearray(MutableSequence[int], ByteString):
) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytearray: ...
def rpartition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ...
def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ...
def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ...
def split(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> list[bytearray]: ...
def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ...
def splitlines(self, keepends: bool = False) -> list[bytearray]: ...
def startswith(
self,
__prefix: ReadableBuffer | tuple[ReadableBuffer, ...],
@@ -847,7 +847,7 @@ class memoryview(Sequence[int]):
@overload
def __setitem__(self, __i: SupportsIndex, __o: SupportsIndex) -> None: ...
if sys.version_info >= (3, 8):
def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ...
def tobytes(self, order: Literal["C", "F", "A"] | None = "C") -> bytes: ...
else:
def tobytes(self) -> bytes: ...
@@ -1226,11 +1226,11 @@ if sys.version_info >= (3, 8):
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: int = ...,
dont_inherit: int = ...,
optimize: int = ...,
flags: int = 0,
dont_inherit: int = False,
optimize: int = -1,
*,
_feature_version: int = ...,
_feature_version: int = -1,
) -> Any: ...
else:
@@ -1265,7 +1265,7 @@ if sys.version_info >= (3, 11):
__globals: dict[str, Any] | None = ...,
__locals: Mapping[str, object] | None = ...,
*,
closure: tuple[_Cell, ...] | None = ...,
closure: tuple[_Cell, ...] | None = None,
) -> None: ...
else:
@@ -1275,7 +1275,7 @@ else:
__locals: Mapping[str, object] | None = ...,
) -> None: ...
def exit(code: sys._ExitCode = ...) -> NoReturn: ...
def exit(code: sys._ExitCode = None) -> NoReturn: ...
class filter(Iterator[_T], Generic[_T]):
@overload
@@ -1605,7 +1605,7 @@ else:
@overload
def pow(__base: _SupportsSomeKindOfPow, __exp: complex, __mod: None = ...) -> complex: ...
def quit(code: sys._ExitCode = ...) -> NoReturn: ...
def quit(code: sys._ExitCode = None) -> NoReturn: ...
class reversed(Iterator[_T], Generic[_T]):
@overload
@@ -1763,10 +1763,10 @@ class zip(Iterator[_T_co], Generic[_T_co]):
# Return type of `__import__` should be kept the same as return type of `importlib.import_module`
def __import__(
name: str,
globals: Mapping[str, object] | None = ...,
locals: Mapping[str, object] | None = ...,
globals: Mapping[str, object] | None = None,
locals: Mapping[str, object] | None = None,
fromlist: Sequence[str] = ...,
level: int = ...,
level: int = 0,
) -> types.ModuleType: ...
def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ...