mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-01 00:53:23 +08:00
stdlib: add argument default values (#9501)
This commit is contained in:
@@ -40,9 +40,9 @@ def namedtuple(
|
||||
typename: str,
|
||||
field_names: str | Iterable[str],
|
||||
*,
|
||||
rename: bool = ...,
|
||||
module: str | None = ...,
|
||||
defaults: Iterable[Any] | None = ...,
|
||||
rename: bool = False,
|
||||
module: str | None = None,
|
||||
defaults: Iterable[Any] | None = None,
|
||||
) -> type[tuple[Any, ...]]: ...
|
||||
|
||||
class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@@ -119,7 +119,7 @@ class UserList(MutableSequence[_T]):
|
||||
def __imul__(self: Self, n: int) -> Self: ...
|
||||
def append(self, item: _T) -> None: ...
|
||||
def insert(self, i: int, item: _T) -> None: ...
|
||||
def pop(self, i: int = ...) -> _T: ...
|
||||
def pop(self, i: int = -1) -> _T: ...
|
||||
def remove(self, item: _T) -> None: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def __copy__(self: Self) -> Self: ...
|
||||
@@ -163,18 +163,18 @@ class UserString(Sequence[UserString]):
|
||||
def capitalize(self: Self) -> Self: ...
|
||||
def casefold(self: Self) -> Self: ...
|
||||
def center(self: Self, width: int, *args: Any) -> Self: ...
|
||||
def count(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
|
||||
def count(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def encode(self: UserString, encoding: str | None = ..., errors: str | None = ...) -> bytes: ...
|
||||
def encode(self: UserString, encoding: str | None = "utf-8", errors: str | None = "strict") -> bytes: ...
|
||||
else:
|
||||
def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ...
|
||||
|
||||
def endswith(self, suffix: str | tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
|
||||
def expandtabs(self: Self, tabsize: int = ...) -> Self: ...
|
||||
def find(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
|
||||
def endswith(self, suffix: str | tuple[str, ...], start: int | None = 0, end: int | None = 9223372036854775807) -> bool: ...
|
||||
def expandtabs(self: Self, tabsize: int = 8) -> Self: ...
|
||||
def find(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
|
||||
def format(self, *args: Any, **kwds: Any) -> str: ...
|
||||
def format_map(self, mapping: Mapping[str, Any]) -> str: ...
|
||||
def index(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def index(self, sub: str, start: int = 0, end: int = 9223372036854775807) -> int: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isdecimal(self) -> bool: ...
|
||||
@@ -190,7 +190,7 @@ class UserString(Sequence[UserString]):
|
||||
def join(self, seq: Iterable[str]) -> str: ...
|
||||
def ljust(self: Self, width: int, *args: Any) -> Self: ...
|
||||
def lower(self: Self) -> Self: ...
|
||||
def lstrip(self: Self, chars: str | None = ...) -> Self: ...
|
||||
def lstrip(self: Self, chars: str | None = None) -> Self: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def maketrans(x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
|
||||
@@ -202,17 +202,17 @@ class UserString(Sequence[UserString]):
|
||||
def removeprefix(self: Self, __prefix: str | UserString) -> Self: ...
|
||||
def removesuffix(self: Self, __suffix: str | UserString) -> Self: ...
|
||||
|
||||
def replace(self: Self, old: str | UserString, new: str | UserString, maxsplit: int = ...) -> Self: ...
|
||||
def rfind(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
|
||||
def rindex(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
|
||||
def replace(self: Self, old: str | UserString, new: str | UserString, maxsplit: int = -1) -> Self: ...
|
||||
def rfind(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
|
||||
def rindex(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
|
||||
def rjust(self: Self, width: int, *args: Any) -> Self: ...
|
||||
def rpartition(self, sep: str) -> tuple[str, str, str]: ...
|
||||
def rstrip(self: Self, chars: str | None = ...) -> Self: ...
|
||||
def split(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ...
|
||||
def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> list[str]: ...
|
||||
def startswith(self, prefix: str | tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
|
||||
def strip(self: Self, chars: str | None = ...) -> Self: ...
|
||||
def rstrip(self: Self, chars: str | None = None) -> Self: ...
|
||||
def split(self, sep: str | None = None, maxsplit: int = -1) -> list[str]: ...
|
||||
def rsplit(self, sep: str | None = None, maxsplit: int = -1) -> list[str]: ...
|
||||
def splitlines(self, keepends: bool = False) -> list[str]: ...
|
||||
def startswith(self, prefix: str | tuple[str, ...], start: int | None = 0, end: int | None = 9223372036854775807) -> bool: ...
|
||||
def strip(self: Self, chars: str | None = None) -> Self: ...
|
||||
def swapcase(self: Self) -> Self: ...
|
||||
def title(self: Self) -> Self: ...
|
||||
def translate(self: Self, *args: Any) -> Self: ...
|
||||
@@ -268,9 +268,9 @@ class Counter(dict[_T, int], Generic[_T]):
|
||||
def __init__(self, __iterable: Iterable[_T]) -> None: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
def most_common(self, n: int | None = ...) -> list[tuple[_T, int]]: ...
|
||||
def most_common(self, n: int | None = None) -> list[tuple[_T, int]]: ...
|
||||
@classmethod
|
||||
def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore[override]
|
||||
def fromkeys(cls, iterable: Any, v: int | None = None) -> NoReturn: ... # type: ignore[override]
|
||||
@overload
|
||||
def subtract(self, __iterable: None = ...) -> None: ...
|
||||
@overload
|
||||
@@ -341,8 +341,8 @@ class _odict_values(dict_values[_KT_co, _VT_co], Reversible[_VT_co], Generic[_KT
|
||||
def __reversed__(self) -> Iterator[_VT_co]: ...
|
||||
|
||||
class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = ...) -> None: ...
|
||||
def popitem(self, last: bool = True) -> tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = True) -> None: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
def keys(self) -> _odict_keys[_KT, _VT]: ...
|
||||
@@ -398,7 +398,7 @@ class defaultdict(dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
maps: list[MutableMapping[_KT, _VT]]
|
||||
def __init__(self, *maps: MutableMapping[_KT, _VT]) -> None: ...
|
||||
def new_child(self: Self, m: MutableMapping[_KT, _VT] | None = ...) -> Self: ...
|
||||
def new_child(self: Self, m: MutableMapping[_KT, _VT] | None = None) -> Self: ...
|
||||
@property
|
||||
def parents(self: Self) -> Self: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user