mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
|
||||
from _typeshed import StrPath, BytesPath, AnyPath
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
@@ -59,7 +60,6 @@ if sys.version_info < (3, 8):
|
||||
def realpath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(s: AnyStr) -> AnyStr: ...
|
||||
@@ -69,31 +69,26 @@ if sys.version_info < (3, 8):
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
def normpath(s: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
|
||||
# So, fall back to Any
|
||||
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def exists(path: Union[AnyPath, int]) -> bool: ...
|
||||
else:
|
||||
def exists(path: AnyPath) -> bool: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def islink(s: AnyPath) -> bool: ...
|
||||
def ismount(s: AnyPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
@@ -117,11 +112,9 @@ if sys.version_info < (3, 8):
|
||||
def join(s: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
else:
|
||||
def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def split(s: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@@ -139,6 +132,5 @@ if sys.version_info < (3, 8):
|
||||
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.version_info < (3,):
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user