AnyStr cleanup (#5487)

* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
This commit is contained in:
Sebastian Rittau
2021-05-17 20:45:48 +02:00
committed by GitHub
parent 51b7248154
commit f0bf6eebbd
67 changed files with 546 additions and 529 deletions

View File

@@ -1,5 +1,5 @@
import os
from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsLessThanT
from typing import List, Sequence, Tuple, Union, overload
from typing_extensions import Literal
@@ -14,16 +14,16 @@ def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ...
def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ...
@overload
def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ...
def exists(path: AnyPath) -> bool: ...
def getsize(filename: AnyPath) -> int: ...
def isfile(path: AnyPath) -> bool: ...
def isdir(s: AnyPath) -> bool: ...
def exists(path: StrOrBytesPath) -> bool: ...
def getsize(filename: StrOrBytesPath) -> int: ...
def isfile(path: StrOrBytesPath) -> bool: ...
def isdir(s: StrOrBytesPath) -> 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 samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def getatime(filename: StrOrBytesPath) -> float: ...
def getmtime(filename: StrOrBytesPath) -> float: ...
def getctime(filename: StrOrBytesPath) -> float: ...
def samefile(f1: StrOrBytesPath, f2: StrOrBytesPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...