Clean up files with former forced consistency (#4717)

Replace Text with str in Python 3 code
This commit is contained in:
Sebastian Rittau authored and GitHub committed 2020-10-27 07:52:35 +01:00
1 parent 25b3004ad8
commit 4603728a15
24 files changed
+364 -636

No files matched your search

+4 -24
View File
@@ -2,7 +2,7 @@ import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath
from genericpath import exists as exists
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Tuple, TypeVar, overload
_T = TypeVar("_T")
@@ -88,7 +88,6 @@ elif sys.version_info >= (3, 5):
def commonpath(paths: Sequence[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: ...
def lexists(path: AnyPath) -> bool: ...
@@ -105,25 +104,9 @@ def isdir(s: AnyPath) -> bool: ...
def islink(path: AnyPath) -> bool: ...
def ismount(path: 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)
# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in
# a type error.
if sys.version_info >= (3, 6):
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
elif sys.version_info >= (3, 6):
@overload
def join(a: StrPath, *paths: StrPath) -> Text: ...
def join(a: StrPath, *paths: StrPath) -> str: ...
@overload
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
@@ -133,7 +116,7 @@ else:
@overload
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ...
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: ...
@@ -159,6 +142,3 @@ else:
if sys.version_info < (3, 7) and sys.platform == "win32":
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...