mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
from _typeshed import OpenBinaryMode, OpenTextMode
|
||||
from typing import (Any, BinaryIO, Generator, IO, List, Optional, Sequence,
|
||||
TextIO, Tuple, Type, TypeVar, Union, overload)
|
||||
from types import TracebackType
|
||||
import os
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
_P = TypeVar('_P', bound=PurePath)
|
||||
from _typeshed import OpenBinaryMode, OpenTextMode
|
||||
|
||||
_P = TypeVar("_P", bound=PurePath)
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_PurePathBase = os.PathLike[str]
|
||||
@@ -60,7 +60,6 @@ class PurePath(_PurePathBase):
|
||||
def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ...
|
||||
else:
|
||||
def joinpath(self: _P, *other: Union[str, os.PathLike[str]]) -> _P: ...
|
||||
|
||||
@property
|
||||
def parents(self: _P) -> Sequence[_P]: ...
|
||||
@property
|
||||
@@ -71,9 +70,9 @@ class PureWindowsPath(PurePath): ...
|
||||
|
||||
class Path(PurePath):
|
||||
def __enter__(self) -> Path: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType]) -> Optional[bool]: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]
|
||||
) -> Optional[bool]: ...
|
||||
@classmethod
|
||||
def cwd(cls: Type[_P]) -> _P: ...
|
||||
def stat(self) -> os.stat_result: ...
|
||||
@@ -94,20 +93,31 @@ class Path(PurePath):
|
||||
def lchmod(self, mode: int) -> None: ...
|
||||
def lstat(self) -> os.stat_result: ...
|
||||
if sys.version_info < (3, 5):
|
||||
def mkdir(self, mode: int = ...,
|
||||
parents: bool = ...) -> None: ...
|
||||
def mkdir(self, mode: int = ..., parents: bool = ...) -> None: ...
|
||||
else:
|
||||
def mkdir(self, mode: int = ..., parents: bool = ...,
|
||||
exist_ok: bool = ...) -> None: ...
|
||||
def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ...
|
||||
@overload
|
||||
def open(self, mode: OpenTextMode = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...) -> TextIO: ...
|
||||
def open(
|
||||
self,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> TextIO: ...
|
||||
@overload
|
||||
def open(self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ...,
|
||||
newline: None = ...) -> BinaryIO: ...
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(self, mode: str, buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...) -> IO[Any]: ...
|
||||
def open(
|
||||
self,
|
||||
mode: str,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> IO[Any]: ...
|
||||
def owner(self) -> str: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def readlink(self: _P) -> _P: ...
|
||||
@@ -123,36 +133,28 @@ class Path(PurePath):
|
||||
def resolve(self: _P, strict: bool = ...) -> _P: ...
|
||||
def rglob(self, pattern: str) -> Generator[Path, None, None]: ...
|
||||
def rmdir(self) -> None: ...
|
||||
def symlink_to(self, target: Union[str, Path],
|
||||
target_is_directory: bool = ...) -> None: ...
|
||||
def symlink_to(self, target: Union[str, Path], target_is_directory: bool = ...) -> None: ...
|
||||
def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def unlink(self, missing_ok: bool = ...) -> None: ...
|
||||
else:
|
||||
def unlink(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
@classmethod
|
||||
def home(cls: Type[_P]) -> _P: ...
|
||||
if sys.version_info < (3, 6):
|
||||
def __new__(cls: Type[_P], *args: Union[str, PurePath],
|
||||
**kwargs: Any) -> _P: ...
|
||||
def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ...
|
||||
else:
|
||||
def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]],
|
||||
**kwargs: Any) -> _P: ...
|
||||
|
||||
def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]], **kwargs: Any) -> _P: ...
|
||||
def absolute(self: _P) -> _P: ...
|
||||
def expanduser(self: _P) -> _P: ...
|
||||
def read_bytes(self) -> bytes: ...
|
||||
def read_text(self, encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...) -> str: ...
|
||||
def read_text(self, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ...
|
||||
def samefile(self, other_path: Union[str, bytes, int, Path]) -> bool: ...
|
||||
def write_bytes(self, data: bytes) -> int: ...
|
||||
def write_text(self, data: str, encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...) -> int: ...
|
||||
def write_text(self, data: str, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> int: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def link_to(self, target: Union[str, bytes, os.PathLike[str]]) -> None: ...
|
||||
|
||||
|
||||
class PosixPath(Path, PurePosixPath): ...
|
||||
class WindowsPath(Path, PureWindowsPath): ...
|
||||
|
||||
Reference in New Issue
Block a user