mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-20 16:48:27 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
from typing import (
|
||||
Callable, IO, Iterable, Iterator, List, Mapping, Optional, Type,
|
||||
Union, Tuple, Dict, Set
|
||||
)
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
# tar constants
|
||||
NUL: bytes
|
||||
@@ -51,23 +49,29 @@ PAX_NUMBER_FIELDS: Dict[str, type]
|
||||
if sys.version_info >= (3,):
|
||||
PAX_NAME_FIELDS: Set[str]
|
||||
|
||||
|
||||
ENCODING: str
|
||||
|
||||
if sys.version_info < (3,):
|
||||
TAR_PLAIN: int
|
||||
TAR_GZIPPED: int
|
||||
|
||||
def open(name: Optional[AnyPath] = ..., mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ..., bufsize: int = ...,
|
||||
*, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
ignore_zeros: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ..., errors: str = ...,
|
||||
pax_headers: Optional[Mapping[str, str]] = ...,
|
||||
debug: Optional[int] = ...,
|
||||
errorlevel: Optional[int] = ...,
|
||||
compresslevel: Optional[int] = ...) -> TarFile: ...
|
||||
def open(
|
||||
name: Optional[AnyPath] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
bufsize: int = ...,
|
||||
*,
|
||||
format: Optional[int] = ...,
|
||||
tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
ignore_zeros: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: str = ...,
|
||||
pax_headers: Optional[Mapping[str, str]] = ...,
|
||||
debug: Optional[int] = ...,
|
||||
errorlevel: Optional[int] = ...,
|
||||
compresslevel: Optional[int] = ...,
|
||||
) -> TarFile: ...
|
||||
|
||||
class TarFile(Iterable[TarInfo]):
|
||||
name: Optional[AnyPath]
|
||||
@@ -84,57 +88,66 @@ class TarFile(Iterable[TarInfo]):
|
||||
errorlevel: Optional[int]
|
||||
if sys.version_info < (3,):
|
||||
posix: bool
|
||||
def __init__(self, name: Optional[AnyPath] = ..., mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
ignore_zeros: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ..., errors: str = ...,
|
||||
pax_headers: Optional[Mapping[str, str]] = ...,
|
||||
debug: Optional[int] = ...,
|
||||
errorlevel: Optional[int] = ...,
|
||||
compresslevel: Optional[int] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
name: Optional[AnyPath] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
format: Optional[int] = ...,
|
||||
tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
ignore_zeros: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: str = ...,
|
||||
pax_headers: Optional[Mapping[str, str]] = ...,
|
||||
debug: Optional[int] = ...,
|
||||
errorlevel: Optional[int] = ...,
|
||||
compresslevel: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
def __enter__(self) -> TarFile: ...
|
||||
def __exit__(self,
|
||||
exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[TarInfo]: ...
|
||||
@classmethod
|
||||
def open(cls, name: Optional[AnyPath] = ..., mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ..., bufsize: int = ...,
|
||||
*, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
ignore_zeros: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ..., errors: str = ...,
|
||||
pax_headers: Optional[Mapping[str, str]] = ...,
|
||||
debug: Optional[int] = ...,
|
||||
errorlevel: Optional[int] = ...) -> TarFile: ...
|
||||
def open(
|
||||
cls,
|
||||
name: Optional[AnyPath] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
bufsize: int = ...,
|
||||
*,
|
||||
format: Optional[int] = ...,
|
||||
tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
ignore_zeros: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: str = ...,
|
||||
pax_headers: Optional[Mapping[str, str]] = ...,
|
||||
debug: Optional[int] = ...,
|
||||
errorlevel: Optional[int] = ...,
|
||||
) -> TarFile: ...
|
||||
def getmember(self, name: str) -> TarInfo: ...
|
||||
def getmembers(self) -> List[TarInfo]: ...
|
||||
def getnames(self) -> List[str]: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def list(self, verbose: bool = ...,
|
||||
*, members: Optional[List[TarInfo]] = ...) -> None: ...
|
||||
def list(self, verbose: bool = ..., *, members: Optional[List[TarInfo]] = ...) -> None: ...
|
||||
else:
|
||||
def list(self, verbose: bool = ...) -> None: ...
|
||||
def next(self) -> Optional[TarInfo]: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def extractall(self, path: AnyPath = ...,
|
||||
members: Optional[List[TarInfo]] = ...,
|
||||
*, numeric_owner: bool = ...) -> None: ...
|
||||
def extractall(
|
||||
self, path: AnyPath = ..., members: Optional[List[TarInfo]] = ..., *, numeric_owner: bool = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def extractall(self, path: AnyPath = ...,
|
||||
members: Optional[List[TarInfo]] = ...) -> None: ...
|
||||
def extractall(self, path: AnyPath = ..., members: Optional[List[TarInfo]] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...,
|
||||
set_attrs: bool = ...,
|
||||
*, numeric_owner: bool = ...) -> None: ...
|
||||
def extract(
|
||||
self, member: Union[str, TarInfo], path: AnyPath = ..., set_attrs: bool = ..., *, numeric_owner: bool = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def extract(self, member: Union[str, TarInfo],
|
||||
path: AnyPath = ...) -> None: ...
|
||||
def extractfile(self,
|
||||
member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
|
||||
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...) -> None: ...
|
||||
def extractfile(self, member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
|
||||
def makedir(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makefile(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makeunknown(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
@@ -148,28 +161,42 @@ class TarFile(Iterable[TarInfo]):
|
||||
def chmod(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def utime(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
if sys.version_info >= (3, 7):
|
||||
def add(self, name: str, arcname: Optional[str] = ...,
|
||||
recursive: bool = ..., *,
|
||||
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
name: str,
|
||||
arcname: Optional[str] = ...,
|
||||
recursive: bool = ...,
|
||||
*,
|
||||
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def add(self, name: str, arcname: Optional[str] = ...,
|
||||
recursive: bool = ...,
|
||||
exclude: Optional[Callable[[str], bool]] = ..., *,
|
||||
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
name: str,
|
||||
arcname: Optional[str] = ...,
|
||||
recursive: bool = ...,
|
||||
exclude: Optional[Callable[[str], bool]] = ...,
|
||||
*,
|
||||
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def add(self, name: str, arcname: Optional[str] = ...,
|
||||
recursive: bool = ...,
|
||||
exclude: Optional[Callable[[str], bool]] = ...,
|
||||
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...) -> None: ...
|
||||
def addfile(self, tarinfo: TarInfo,
|
||||
fileobj: Optional[IO[bytes]] = ...) -> None: ...
|
||||
def gettarinfo(self, name: Optional[str] = ...,
|
||||
arcname: Optional[str] = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...) -> TarInfo: ...
|
||||
def add(
|
||||
self,
|
||||
name: str,
|
||||
arcname: Optional[str] = ...,
|
||||
recursive: bool = ...,
|
||||
exclude: Optional[Callable[[str], bool]] = ...,
|
||||
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
|
||||
) -> None: ...
|
||||
def addfile(self, tarinfo: TarInfo, fileobj: Optional[IO[bytes]] = ...) -> None: ...
|
||||
def gettarinfo(
|
||||
self, name: Optional[str] = ..., arcname: Optional[str] = ..., fileobj: Optional[IO[bytes]] = ...
|
||||
) -> TarInfo: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def is_tarfile(name: Union[AnyPath, IO[bytes]]) -> bool: ...
|
||||
|
||||
else:
|
||||
def is_tarfile(name: AnyPath) -> bool: ...
|
||||
|
||||
@@ -178,8 +205,7 @@ if sys.version_info < (3, 8):
|
||||
|
||||
if sys.version_info < (3,):
|
||||
class TarFileCompat:
|
||||
def __init__(self, filename: str, mode: str = ...,
|
||||
compression: int = ...) -> None: ...
|
||||
def __init__(self, filename: str, mode: str = ..., compression: int = ...) -> None: ...
|
||||
|
||||
class TarError(Exception): ...
|
||||
class ReadError(TarError): ...
|
||||
@@ -209,8 +235,7 @@ class TarInfo:
|
||||
def frombuf(cls, buf: bytes) -> TarInfo: ...
|
||||
@classmethod
|
||||
def fromtarfile(cls, tarfile: TarFile) -> TarInfo: ...
|
||||
def tobuf(self, format: Optional[int] = ...,
|
||||
encoding: Optional[str] = ..., errors: str = ...) -> bytes: ...
|
||||
def tobuf(self, format: Optional[int] = ..., encoding: Optional[str] = ..., errors: str = ...) -> bytes: ...
|
||||
def isfile(self) -> bool: ...
|
||||
def isreg(self) -> bool: ...
|
||||
def isdir(self) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user