apply black and isort (#4287)

* apply black and isort

* move some type ignores
This commit is contained in:
Jelle Zijlstra
2020-06-28 13:31:00 -07:00
committed by GitHub
parent fe58699ca5
commit 5d553c9584
800 changed files with 13875 additions and 10332 deletions

View File

@@ -1,10 +1,23 @@
import os
import sys
from typing import (
List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple,
AnyStr, Optional, Union, Set, TypeVar, overload, Type, Text
Any,
AnyStr,
Callable,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Set,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from _typeshed import StrPath, SupportsRead, SupportsWrite
if sys.version_info >= (3, 6):
@@ -29,25 +42,21 @@ if sys.version_info >= (3,):
class ExecError(OSError): ...
class ReadError(OSError): ...
class RegistryError(Exception): ...
else:
class Error(EnvironmentError): ...
class SpecialFileError(EnvironmentError): ...
class ExecError(EnvironmentError): ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr],
length: int = ...) -> None: ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
if sys.version_info >= (3,):
def copyfile(src: StrPath, dst: _AnyPath, *,
follow_symlinks: bool = ...) -> _AnyPath: ...
def copymode(src: StrPath, dst: StrPath, *,
follow_symlinks: bool = ...) -> None: ...
def copystat(src: StrPath, dst: StrPath, *,
follow_symlinks: bool = ...) -> None: ...
def copy(src: StrPath, dst: StrPath, *,
follow_symlinks: bool = ...) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath, *,
follow_symlinks: bool = ...) -> _PathReturn: ...
def copyfile(src: StrPath, dst: _AnyPath, *, follow_symlinks: bool = ...) -> _AnyPath: ...
def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
else:
def copyfile(src: StrPath, dst: StrPath) -> None: ...
def copymode(src: StrPath, dst: StrPath) -> None: ...
@@ -67,35 +76,44 @@ if sys.version_info >= (3, 8):
ignore_dangling_symlinks: bool = ...,
dirs_exist_ok: bool = ...,
) -> _PathReturn: ...
elif sys.version_info >= (3,):
def copytree(src: StrPath, dst: StrPath, symlinks: bool = ...,
ignore: Union[None,
Callable[[str, List[str]], Iterable[str]],
Callable[[StrPath, List[str]], Iterable[str]]] = ...,
copy_function: Callable[[str, str], None] = ...,
ignore_dangling_symlinks: bool = ...) -> _PathReturn: ...
def copytree(
src: StrPath,
dst: StrPath,
symlinks: bool = ...,
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[StrPath, List[str]], Iterable[str]]] = ...,
copy_function: Callable[[str, str], None] = ...,
ignore_dangling_symlinks: bool = ...,
) -> _PathReturn: ...
else:
def copytree(src: AnyStr, dst: AnyStr, symlinks: bool = ...,
ignore: Union[None,
Callable[[AnyStr, List[AnyStr]],
Iterable[AnyStr]]] = ...) -> _PathReturn: ...
def copytree(
src: AnyStr,
dst: AnyStr,
symlinks: bool = ...,
ignore: Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] = ...,
) -> _PathReturn: ...
if sys.version_info >= (3,):
def rmtree(path: Union[bytes, StrPath], ignore_errors: bool = ...,
onerror: Optional[Callable[[Any, Any, Any], Any]] = ...) -> None: ...
def rmtree(
path: Union[bytes, StrPath], ignore_errors: bool = ..., onerror: Optional[Callable[[Any, Any, Any], Any]] = ...
) -> None: ...
else:
def rmtree(path: _AnyPath, ignore_errors: bool = ...,
onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...
def rmtree(
path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...
) -> None: ...
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
if sys.version_info >= (3, 9):
def move(src: StrPath, dst: StrPath,
copy_function: _CopyFn = ...) -> _PathReturn: ...
def move(src: StrPath, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
elif sys.version_info >= (3, 5):
# See https://bugs.python.org/issue32689
def move(src: str, dst: StrPath,
copy_function: _CopyFn = ...) -> _PathReturn: ...
def move(src: str, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
else:
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
@@ -105,39 +123,46 @@ if sys.version_info >= (3,):
used: int
free: int
def disk_usage(path: StrPath) -> _ntuple_diskusage: ...
def chown(path: StrPath, user: Optional[str] = ...,
group: Optional[str] = ...) -> None: ...
def chown(path: StrPath, user: Optional[str] = ..., group: Optional[str] = ...) -> None: ...
if sys.version_info >= (3, 8):
@overload
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
@overload
def which(cmd: bytes, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[bytes]: ...
elif sys.version_info >= (3,):
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
def make_archive(base_name: _AnyStr, format: str, root_dir: Optional[StrPath] = ...,
base_dir: Optional[StrPath] = ..., verbose: bool = ...,
dry_run: bool = ..., owner: Optional[str] = ..., group: Optional[str] = ...,
logger: Optional[Any] = ...) -> _AnyStr: ...
def make_archive(
base_name: _AnyStr,
format: str,
root_dir: Optional[StrPath] = ...,
base_dir: Optional[StrPath] = ...,
verbose: bool = ...,
dry_run: bool = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
logger: Optional[Any] = ...,
) -> _AnyStr: ...
def get_archive_formats() -> List[Tuple[str, str]]: ...
def register_archive_format(name: str, function: Callable[..., Any],
extra_args: Optional[Sequence[Union[Tuple[str, Any], List[Any]]]] = ...,
description: str = ...) -> None: ...
def register_archive_format(
name: str,
function: Callable[..., Any],
extra_args: Optional[Sequence[Union[Tuple[str, Any], List[Any]]]] = ...,
description: str = ...,
) -> None: ...
def unregister_archive_format(name: str) -> None: ...
if sys.version_info >= (3,):
if sys.version_info >= (3, 7):
def unpack_archive(filename: StrPath, extract_dir: Optional[StrPath] = ...,
format: Optional[str] = ...) -> None: ...
def unpack_archive(filename: StrPath, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
else:
# See http://bugs.python.org/issue30218
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ...,
format: Optional[str] = ...) -> None: ...
def register_unpack_format(name: str, extensions: List[str], function: Any,
extra_args: Sequence[Tuple[str, Any]] = ...,
description: str = ...) -> None: ...
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
def register_unpack_format(
name: str, extensions: List[str], function: Any, extra_args: Sequence[Tuple[str, Any]] = ..., description: str = ...
) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...
def get_terminal_size(fallback: Tuple[int, int] = ...) -> os.terminal_size: ...