lowercase list and dict in the rest of stdlib (#5892)

This commit is contained in:
Akuli
2021-08-09 01:13:08 +03:00
committed by GitHub
parent 191aac3b0e
commit 9af9cca7f3
5 changed files with 53 additions and 49 deletions

View File

@@ -21,7 +21,6 @@ from typing import (
BinaryIO,
Callable,
ContextManager,
Dict,
Generic,
Iterable,
Iterator,
@@ -213,7 +212,7 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
unsetenv: Callable[[AnyStr, AnyStr], None],
) -> None: ...
def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... # type: ignore
def copy(self) -> Dict[AnyStr, AnyStr]: ...
def copy(self) -> dict[AnyStr, AnyStr]: ...
def __delitem__(self, key: AnyStr) -> None: ...
def __getitem__(self, key: AnyStr) -> AnyStr: ...
def __setitem__(self, key: AnyStr, value: AnyStr) -> None: ...
@@ -225,9 +224,9 @@ if sys.platform != "win32":
environb: _Environ[bytes]
if sys.platform != "win32":
confstr_names: Dict[str, int]
pathconf_names: Dict[str, int]
sysconf_names: Dict[str, int]
confstr_names: dict[str, int]
pathconf_names: dict[str, int]
sysconf_names: dict[str, int]
EX_OK: int
EX_USAGE: int
@@ -336,7 +335,7 @@ if sys.platform != "win32":
if sys.version_info >= (3, 7):
# f_fsid was added in https://github.com/python/cpython/pull/4571
class statvfs_result(_Tuple10Int): # Unix only
def __new__(cls, seq: _Tuple10Int | _Tuple11Int, dict: Dict[str, int] = ...) -> statvfs_result: ...
def __new__(cls, seq: _Tuple10Int | _Tuple11Int, dict: dict[str, int] = ...) -> statvfs_result: ...
n_fields: int
n_sequence_fields: int
n_unnamed_fields: int
@@ -378,9 +377,7 @@ def fspath(path: str) -> str: ...
def fspath(path: bytes) -> bytes: ...
@overload
def fspath(path: PathLike[AnyStr]) -> AnyStr: ...
def get_exec_path(env: Mapping[str, str] | None = ...) -> List[str]: ...
# NOTE: get_exec_path(): returns List[bytes] when env not None
def get_exec_path(env: Mapping[str, str] | None = ...) -> list[str]: ...
def getlogin() -> str: ...
def getpid() -> int: ...
def getppid() -> int: ...
@@ -393,8 +390,8 @@ if sys.platform != "win32":
def getegid() -> int: ...
def geteuid() -> int: ...
def getgid() -> int: ...
def getgrouplist(__user: str, __group: int) -> List[int]: ...
def getgroups() -> List[int]: ... # Unix only, behaves differently on Mac
def getgrouplist(__user: str, __group: int) -> list[int]: ...
def getgroups() -> list[int]: ... # Unix only, behaves differently on Mac
def initgroups(__username: str, __gid: int) -> None: ...
def getpgid(pid: int) -> int: ...
def getpgrp() -> int: ...
@@ -689,7 +686,7 @@ _OnError = Callable[[OSError], Any]
def walk(
top: AnyStr | PathLike[AnyStr], topdown: bool = ..., onerror: _OnError | None = ..., followlinks: bool = ...
) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ...
) -> Iterator[Tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ...
if sys.platform != "win32":
if sys.version_info >= (3, 7):
@@ -701,7 +698,7 @@ if sys.platform != "win32":
*,
follow_symlinks: bool = ...,
dir_fd: int | None = ...,
) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
) -> Iterator[Tuple[str, list[str], list[str], int]]: ...
@overload
def fwalk(
top: bytes,
@@ -710,7 +707,7 @@ if sys.platform != "win32":
*,
follow_symlinks: bool = ...,
dir_fd: int | None = ...,
) -> Iterator[Tuple[bytes, List[bytes], List[bytes], int]]: ...
) -> Iterator[Tuple[bytes, list[bytes], list[bytes], int]]: ...
else:
def fwalk(
top: StrPath = ...,
@@ -719,10 +716,10 @@ if sys.platform != "win32":
*,
follow_symlinks: bool = ...,
dir_fd: int | None = ...,
) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
) -> Iterator[Tuple[str, list[str], list[str], int]]: ...
if sys.platform == "linux":
def getxattr(path: _FdOrAnyPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> bytes: ...
def listxattr(path: _FdOrAnyPath | None = ..., *, follow_symlinks: bool = ...) -> List[str]: ...
def listxattr(path: _FdOrAnyPath | None = ..., *, follow_symlinks: bool = ...) -> list[str]: ...
def removexattr(path: _FdOrAnyPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ...
def setxattr(
path: _FdOrAnyPath, attribute: StrOrBytesPath, value: bytes, flags: int = ..., *, follow_symlinks: bool = ...
@@ -742,7 +739,7 @@ def execlpe(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoRetur
# The implementation enforces tuple or list so we can't use Sequence.
# Not separating out PathLike[str] and PathLike[bytes] here because it doesn't make much difference
# in practice, and doing so would explode the number of combinations in this already long union.
# All these combinations are necessary due to List being invariant.
# All these combinations are necessary due to list being invariant.
_ExecVArgs = Union[
Tuple[StrOrBytesPath, ...],
List[bytes],