mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
Clean up files with former forced consistency (#4717)
Replace Text with str in Python 3 code
This commit is contained in:
@@ -26,13 +26,6 @@ class BaseServer:
|
||||
def server_activate(self) -> None: ...
|
||||
def server_bind(self) -> None: ...
|
||||
def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def __enter__(self) -> BaseServer: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType]
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def service_actions(self) -> None: ...
|
||||
|
||||
class TCPServer(BaseServer):
|
||||
def __init__(
|
||||
@@ -71,27 +64,14 @@ if sys.platform != "win32":
|
||||
timeout: Optional[float] # undocumented
|
||||
active_children: Optional[List[int]] # undocumented
|
||||
max_children: int # undocumented
|
||||
if sys.version_info >= (3, 7):
|
||||
block_on_close: bool
|
||||
if sys.version_info >= (3, 6):
|
||||
def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented
|
||||
else:
|
||||
def collect_children(self) -> None: ... # undocumented
|
||||
def collect_children(self) -> None: ... # undocumented
|
||||
def handle_timeout(self) -> None: ... # undocumented
|
||||
if sys.version_info >= (3, 3):
|
||||
def service_actions(self) -> None: ... # undocumented
|
||||
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def server_close(self) -> None: ...
|
||||
|
||||
class ThreadingMixIn:
|
||||
daemon_threads: bool
|
||||
if sys.version_info >= (3, 7):
|
||||
block_on_close: bool
|
||||
def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented
|
||||
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def server_close(self) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
|
||||
|
||||
@@ -60,9 +60,6 @@ REG_EXPAND_SZ: int
|
||||
REG_LINK: int
|
||||
REG_MULTI_SZ: int
|
||||
REG_NONE: int
|
||||
if sys.version_info >= (3, 6):
|
||||
REG_QWORD: int
|
||||
REG_QWORD_LITTLE_ENDIAN: int
|
||||
REG_RESOURCE_LIST: int
|
||||
REG_FULL_RESOURCE_DESCRIPTOR: int
|
||||
REG_RESOURCE_REQUIREMENTS_LIST: int
|
||||
|
||||
85
stdlib/2/ntpath.pyi
Normal file
85
stdlib/2/ntpath.pyi
Normal file
@@ -0,0 +1,85 @@
|
||||
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
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
curdir: str
|
||||
pardir: str
|
||||
sep: str
|
||||
if sys.platform == "win32":
|
||||
altsep: str
|
||||
else:
|
||||
altsep: Optional[str]
|
||||
extsep: str
|
||||
pathsep: str
|
||||
defpath: str
|
||||
devnull: str
|
||||
|
||||
# ----- os.path function stubs -----
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
def realpath(filename: 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: ...
|
||||
|
||||
# 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(path: AnyPath) -> bool: ...
|
||||
def ismount(path: AnyPath) -> bool: ...
|
||||
|
||||
# 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.
|
||||
@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: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
@overload
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
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: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
|
||||
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
@@ -6,9 +6,6 @@ from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple,
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
@@ -25,67 +22,19 @@ defpath: str
|
||||
devnull: str
|
||||
|
||||
# ----- os.path function stubs -----
|
||||
if sys.version_info >= (3, 6):
|
||||
# Overloads are necessary to work around python/mypy#3644.
|
||||
@overload
|
||||
def abspath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(p: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(p: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(s: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
if sys.platform == "win32":
|
||||
@overload
|
||||
def realpath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
else:
|
||||
@overload
|
||||
def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
if sys.platform == "win32":
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
else:
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
# In reality it returns str for sequences of StrPath and bytes for sequences
|
||||
# of BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
elif sys.version_info >= (3, 5):
|
||||
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
|
||||
def realpath(filename: 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
|
||||
@@ -105,31 +54,20 @@ 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.
|
||||
@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: ...
|
||||
@overload
|
||||
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
|
||||
else:
|
||||
def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
# 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.
|
||||
@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: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
@overload
|
||||
@@ -137,28 +75,11 @@ def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
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: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
else:
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.version_info < (3, 7) and sys.platform == "win32":
|
||||
if 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: ...
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
|
||||
@@ -6,9 +6,6 @@ from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple,
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
@@ -25,67 +22,19 @@ defpath: str
|
||||
devnull: str
|
||||
|
||||
# ----- os.path function stubs -----
|
||||
if sys.version_info >= (3, 6):
|
||||
# Overloads are necessary to work around python/mypy#3644.
|
||||
@overload
|
||||
def abspath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(p: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(p: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(s: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
if sys.platform == "win32":
|
||||
@overload
|
||||
def realpath(path: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
else:
|
||||
@overload
|
||||
def realpath(filename: _PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
if sys.platform == "win32":
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
else:
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
# In reality it returns str for sequences of StrPath and bytes for sequences
|
||||
# of BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
elif sys.version_info >= (3, 5):
|
||||
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
|
||||
def realpath(filename: 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
|
||||
@@ -105,31 +54,20 @@ 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.
|
||||
@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: ...
|
||||
@overload
|
||||
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
|
||||
else:
|
||||
def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
# 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.
|
||||
@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: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
@overload
|
||||
@@ -137,28 +75,11 @@ def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
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: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def split(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
else:
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.version_info < (3, 7) and sys.platform == "win32":
|
||||
if 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: ...
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
|
||||
85
stdlib/2/posixpath.pyi
Normal file
85
stdlib/2/posixpath.pyi
Normal file
@@ -0,0 +1,85 @@
|
||||
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
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
curdir: str
|
||||
pardir: str
|
||||
sep: str
|
||||
if sys.platform == "win32":
|
||||
altsep: str
|
||||
else:
|
||||
altsep: Optional[str]
|
||||
extsep: str
|
||||
pathsep: str
|
||||
defpath: str
|
||||
devnull: str
|
||||
|
||||
# ----- os.path function stubs -----
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(p: AnyStr) -> AnyStr: ...
|
||||
def dirname(p: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(s: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
def realpath(filename: 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: ...
|
||||
|
||||
# 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(path: AnyPath) -> bool: ...
|
||||
def ismount(path: AnyPath) -> bool: ...
|
||||
|
||||
# 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.
|
||||
@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: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
@overload
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
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: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
|
||||
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
@@ -49,14 +49,8 @@ class Future(Generic[_T]):
|
||||
def result(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def set_running_or_notify_cancel(self) -> bool: ...
|
||||
def set_result(self, result: _T) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ...
|
||||
def set_exception(self, exception: Optional[BaseException]) -> None: ...
|
||||
else:
|
||||
def exception(self, timeout: Optional[float] = ...) -> Any: ...
|
||||
def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ...
|
||||
def set_exception(self, exception: Any) -> None: ...
|
||||
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
|
||||
def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ...
|
||||
def set_exception(self, exception: Optional[BaseException]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
@@ -65,12 +59,9 @@ class Executor:
|
||||
def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
|
||||
else:
|
||||
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def map(
|
||||
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
|
||||
) -> Iterator[_T]: ...
|
||||
else:
|
||||
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
|
||||
def map(
|
||||
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
|
||||
) -> Iterator[_T]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ...
|
||||
else:
|
||||
|
||||
@@ -9,7 +9,7 @@ if sys.version_info >= (3, 7):
|
||||
from ._base import BrokenExecutor
|
||||
class BrokenProcessPool(BrokenExecutor): ...
|
||||
|
||||
elif sys.version_info >= (3,):
|
||||
else:
|
||||
class BrokenProcessPool(RuntimeError): ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
@@ -21,7 +21,7 @@ class ThreadPoolExecutor(Executor):
|
||||
initializer: Optional[Callable[..., None]] = ...,
|
||||
initargs: Tuple[Any, ...] = ...,
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3, 6) or sys.version_info < (3,):
|
||||
elif sys.version_info >= (3, 6):
|
||||
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Text, Tuple, TypeVar, overload
|
||||
from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Tuple, TypeVar, overload
|
||||
|
||||
# Undocumented length constants
|
||||
IPV4LENGTH: int
|
||||
@@ -21,11 +21,11 @@ class _IPAddressBase:
|
||||
def __lt__(self: _T, other: _T) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
@property
|
||||
def compressed(self) -> Text: ...
|
||||
def compressed(self) -> str: ...
|
||||
@property
|
||||
def exploded(self) -> Text: ...
|
||||
def exploded(self) -> str: ...
|
||||
@property
|
||||
def reverse_pointer(self) -> Text: ...
|
||||
def reverse_pointer(self) -> str: ...
|
||||
@property
|
||||
def version(self) -> int: ...
|
||||
|
||||
@@ -93,11 +93,11 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
|
||||
def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ...
|
||||
def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ...
|
||||
@property
|
||||
def with_hostmask(self) -> Text: ...
|
||||
def with_hostmask(self) -> str: ...
|
||||
@property
|
||||
def with_netmask(self) -> Text: ...
|
||||
def with_netmask(self) -> str: ...
|
||||
@property
|
||||
def with_prefixlen(self) -> Text: ...
|
||||
def with_prefixlen(self) -> str: ...
|
||||
@property
|
||||
def hostmask(self) -> _A: ...
|
||||
|
||||
@@ -108,11 +108,11 @@ class _BaseInterface(_BaseAddress, Generic[_A, _N]):
|
||||
@property
|
||||
def ip(self) -> _A: ...
|
||||
@property
|
||||
def with_hostmask(self) -> Text: ...
|
||||
def with_hostmask(self) -> str: ...
|
||||
@property
|
||||
def with_netmask(self) -> Text: ...
|
||||
def with_netmask(self) -> str: ...
|
||||
@property
|
||||
def with_prefixlen(self) -> Text: ...
|
||||
def with_prefixlen(self) -> str: ...
|
||||
|
||||
class IPv4Address(_BaseAddress): ...
|
||||
class IPv4Network(_BaseNetwork[IPv4Address]): ...
|
||||
|
||||
@@ -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: ...
|
||||
@@ -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: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
from _typeshed import OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode
|
||||
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, Text, TextIO, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -35,8 +35,6 @@ class PurePath(_PurePathBase):
|
||||
def __ge__(self, other: PurePath) -> bool: ...
|
||||
def __truediv__(self: _P, key: Union[str, _PathLike]) -> _P: ...
|
||||
def __rtruediv__(self: _P, key: Union[str, _PathLike]) -> _P: ...
|
||||
if sys.version_info < (3,):
|
||||
def __div__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def as_posix(self) -> str: ...
|
||||
def as_uri(self) -> str: ...
|
||||
@@ -86,80 +84,66 @@ class Path(PurePath):
|
||||
def iterdir(self) -> Generator[Path, None, None]: ...
|
||||
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: ...
|
||||
else:
|
||||
def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
# Adapted from builtins.open
|
||||
# Text mode: always returns a TextIOWrapper
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> TextIOWrapper: ...
|
||||
# Unbuffered binary mode: returns a FileIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> FileIO: ...
|
||||
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeUpdating,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedRandom: ...
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeWriting,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedWriter: ...
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeReading,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedReader: ...
|
||||
# Buffering cannot be determined: fall back to BinaryIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> BinaryIO: ...
|
||||
# Fallback if mode is not specified
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: str,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> IO[Any]: ...
|
||||
else:
|
||||
# Adapted from _io.open
|
||||
def open(
|
||||
self,
|
||||
mode: Text = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
) -> IO[Any]: ...
|
||||
def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ...
|
||||
# Adapted from builtins.open
|
||||
# Text mode: always returns a TextIOWrapper
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> TextIOWrapper: ...
|
||||
# Unbuffered binary mode: returns a FileIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> FileIO: ...
|
||||
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeUpdating,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedRandom: ...
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeWriting,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedWriter: ...
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeReading,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedReader: ...
|
||||
# Buffering cannot be determined: fall back to BinaryIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> BinaryIO: ...
|
||||
# Fallback if mode is not specified
|
||||
@overload
|
||||
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: ...
|
||||
|
||||
@@ -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: ...
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
import types
|
||||
from socket import SocketType
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Text, Tuple, Type, Union
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Tuple, Type, Union
|
||||
|
||||
class BaseServer:
|
||||
address_family: int
|
||||
@@ -31,8 +31,7 @@ class BaseServer:
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType]
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def service_actions(self) -> None: ...
|
||||
def service_actions(self) -> None: ...
|
||||
|
||||
class TCPServer(BaseServer):
|
||||
def __init__(
|
||||
@@ -54,14 +53,14 @@ if sys.platform != "win32":
|
||||
class UnixStreamServer(BaseServer):
|
||||
def __init__(
|
||||
self,
|
||||
server_address: Union[Text, bytes],
|
||||
server_address: Union[str, bytes],
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler],
|
||||
bind_and_activate: bool = ...,
|
||||
) -> None: ...
|
||||
class UnixDatagramServer(BaseServer):
|
||||
def __init__(
|
||||
self,
|
||||
server_address: Union[Text, bytes],
|
||||
server_address: Union[str, bytes],
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler],
|
||||
bind_and_activate: bool = ...,
|
||||
) -> None: ...
|
||||
@@ -78,8 +77,7 @@ if sys.platform != "win32":
|
||||
else:
|
||||
def collect_children(self) -> None: ... # undocumented
|
||||
def handle_timeout(self) -> None: ... # undocumented
|
||||
if sys.version_info >= (3, 3):
|
||||
def service_actions(self) -> None: ... # undocumented
|
||||
def service_actions(self) -> None: ... # undocumented
|
||||
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def server_close(self) -> None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Generic, List, Mapping, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import Any, Callable, Generic, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_T = TypeVar("_T")
|
||||
@@ -252,7 +252,7 @@ class _patcher:
|
||||
def object( # type: ignore
|
||||
self,
|
||||
target: Any,
|
||||
attribute: Text,
|
||||
attribute: str,
|
||||
*,
|
||||
spec: Optional[Any] = ...,
|
||||
create: bool = ...,
|
||||
@@ -265,7 +265,7 @@ class _patcher:
|
||||
def object(
|
||||
self,
|
||||
target: Any,
|
||||
attribute: Text,
|
||||
attribute: str,
|
||||
new: _T = ...,
|
||||
spec: Optional[Any] = ...,
|
||||
create: bool = ...,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import sys
|
||||
|
||||
from ._base import (
|
||||
ALL_COMPLETED as ALL_COMPLETED,
|
||||
FIRST_COMPLETED as FIRST_COMPLETED,
|
||||
@@ -13,8 +11,3 @@ from ._base import (
|
||||
)
|
||||
from .process import ProcessPoolExecutor as ProcessPoolExecutor
|
||||
from .thread import ThreadPoolExecutor as ThreadPoolExecutor
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from ._base import InvalidStateError as InvalidStateError
|
||||
if sys.version_info >= (3, 7):
|
||||
from ._base import BrokenExecutor as BrokenExecutor
|
||||
|
||||
41
third_party/2/concurrent/futures/_base.pyi
vendored
41
third_party/2/concurrent/futures/_base.pyi
vendored
@@ -1,13 +1,9 @@
|
||||
import sys
|
||||
import threading
|
||||
from abc import abstractmethod
|
||||
from logging import Logger
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Optional, Protocol, Set, Tuple, TypeVar
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
FIRST_COMPLETED: str
|
||||
FIRST_EXCEPTION: str
|
||||
ALL_COMPLETED: str
|
||||
@@ -22,12 +18,6 @@ class Error(Exception): ...
|
||||
class CancelledError(Error): ...
|
||||
class TimeoutError(Error): ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class InvalidStateError(Error): ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
class BrokenExecutor(RuntimeError): ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
@@ -49,32 +39,15 @@ class Future(Generic[_T]):
|
||||
def result(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def set_running_or_notify_cancel(self) -> bool: ...
|
||||
def set_result(self, result: _T) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ...
|
||||
def set_exception(self, exception: Optional[BaseException]) -> None: ...
|
||||
else:
|
||||
def exception(self, timeout: Optional[float] = ...) -> Any: ...
|
||||
def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ...
|
||||
def set_exception(self, exception: Any) -> None: ...
|
||||
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
def exception(self, timeout: Optional[float] = ...) -> Any: ...
|
||||
def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ...
|
||||
def set_exception(self, exception: Any) -> None: ...
|
||||
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
|
||||
|
||||
class Executor:
|
||||
if sys.version_info >= (3, 9):
|
||||
def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
|
||||
else:
|
||||
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def map(
|
||||
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
|
||||
) -> Iterator[_T]: ...
|
||||
else:
|
||||
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ...
|
||||
else:
|
||||
def shutdown(self, wait: bool = ...) -> None: ...
|
||||
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
|
||||
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
|
||||
def shutdown(self, wait: bool = ...) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...
|
||||
|
||||
|
||||
26
third_party/2/concurrent/futures/process.pyi
vendored
26
third_party/2/concurrent/futures/process.pyi
vendored
@@ -1,28 +1,8 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Optional, Tuple
|
||||
from typing import Any, Optional
|
||||
|
||||
from ._base import Executor
|
||||
|
||||
EXTRA_QUEUED_CALLS: Any
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from ._base import BrokenExecutor
|
||||
class BrokenProcessPool(BrokenExecutor): ...
|
||||
|
||||
elif sys.version_info >= (3,):
|
||||
class BrokenProcessPool(RuntimeError): ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from multiprocessing.context import BaseContext
|
||||
class ProcessPoolExecutor(Executor):
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: Optional[int] = ...,
|
||||
mp_context: Optional[BaseContext] = ...,
|
||||
initializer: Optional[Callable[..., None]] = ...,
|
||||
initargs: Tuple[Any, ...] = ...,
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
class ProcessPoolExecutor(Executor):
|
||||
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
|
||||
class ProcessPoolExecutor(Executor):
|
||||
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
|
||||
|
||||
23
third_party/2/concurrent/futures/thread.pyi
vendored
23
third_party/2/concurrent/futures/thread.pyi
vendored
@@ -1,30 +1,11 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Generic, Iterable, Mapping, Optional, Tuple, TypeVar
|
||||
|
||||
from ._base import Executor, Future
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from ._base import BrokenExecutor
|
||||
class BrokenThreadPool(BrokenExecutor): ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_S = TypeVar("_S")
|
||||
|
||||
class ThreadPoolExecutor(Executor):
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: Optional[int] = ...,
|
||||
thread_name_prefix: str = ...,
|
||||
initializer: Optional[Callable[..., None]] = ...,
|
||||
initargs: Tuple[Any, ...] = ...,
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3, 6) or sys.version_info < (3,):
|
||||
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
|
||||
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
|
||||
|
||||
class _WorkItem(Generic[_S]):
|
||||
future: Future[_S]
|
||||
@@ -33,5 +14,3 @@ class _WorkItem(Generic[_S]):
|
||||
kwargs: Mapping[str, Any]
|
||||
def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
4
third_party/2/ipaddress.pyi
vendored
4
third_party/2/ipaddress.pyi
vendored
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Text, Tuple, TypeVar, overload
|
||||
|
||||
# Undocumented length constants
|
||||
@@ -87,9 +86,6 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
|
||||
def overlaps(self, other: _BaseNetwork[_A]) -> bool: ...
|
||||
@property
|
||||
def prefixlen(self) -> int: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def subnet_of(self: _T, other: _T) -> bool: ...
|
||||
def supernet_of(self: _T, other: _T) -> bool: ...
|
||||
def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ...
|
||||
def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ...
|
||||
@property
|
||||
|
||||
128
third_party/2/pathlib2.pyi
vendored
128
third_party/2/pathlib2.pyi
vendored
@@ -6,17 +6,10 @@ from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, Text, TextIO, Tuple, Type, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_P = TypeVar("_P", bound=PurePath)
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_PurePathBase = os.PathLike[str]
|
||||
_PathLike = os.PathLike[str]
|
||||
else:
|
||||
_PurePathBase = object
|
||||
_PathLike = PurePath
|
||||
_PurePathBase = object
|
||||
_PathLike = PurePath
|
||||
|
||||
class PurePath(_PurePathBase):
|
||||
parts: Tuple[str, ...]
|
||||
@@ -35,28 +28,21 @@ class PurePath(_PurePathBase):
|
||||
def __ge__(self, other: PurePath) -> bool: ...
|
||||
def __truediv__(self: _P, key: Union[str, _PathLike]) -> _P: ...
|
||||
def __rtruediv__(self: _P, key: Union[str, _PathLike]) -> _P: ...
|
||||
if sys.version_info < (3,):
|
||||
def __div__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __div__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def as_posix(self) -> str: ...
|
||||
def as_uri(self) -> str: ...
|
||||
def is_absolute(self) -> bool: ...
|
||||
def is_reserved(self) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def is_relative_to(self, *other: Union[str, os.PathLike[str]]) -> bool: ...
|
||||
def match(self, path_pattern: str) -> bool: ...
|
||||
def relative_to(self: _P, *other: Union[str, _PathLike]) -> _P: ...
|
||||
def with_name(self: _P, name: str) -> _P: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def with_stem(self: _P, stem: str) -> _P: ...
|
||||
def with_suffix(self: _P, suffix: str) -> _P: ...
|
||||
def joinpath(self: _P, *other: Union[str, _PathLike]) -> _P: ...
|
||||
@property
|
||||
def parents(self: _P) -> Sequence[_P]: ...
|
||||
@property
|
||||
def parent(self: _P) -> _P: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, type: Any) -> GenericAlias: ...
|
||||
|
||||
class PurePosixPath(PurePath): ...
|
||||
class PureWindowsPath(PurePath): ...
|
||||
@@ -76,8 +62,6 @@ class Path(PurePath):
|
||||
def group(self) -> str: ...
|
||||
def is_dir(self) -> bool: ...
|
||||
def is_file(self) -> bool: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def is_mount(self) -> bool: ...
|
||||
def is_symlink(self) -> bool: ...
|
||||
def is_socket(self) -> bool: ...
|
||||
def is_fifo(self) -> bool: ...
|
||||
@@ -86,101 +70,25 @@ class Path(PurePath):
|
||||
def iterdir(self) -> Generator[Path, None, None]: ...
|
||||
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: ...
|
||||
else:
|
||||
def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
# Adapted from builtins.open
|
||||
# Text mode: always returns a TextIOWrapper
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> TextIOWrapper: ...
|
||||
# Unbuffered binary mode: returns a FileIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> FileIO: ...
|
||||
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeUpdating,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedRandom: ...
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeWriting,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedWriter: ...
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: OpenBinaryModeReading,
|
||||
buffering: Literal[-1, 1] = ...,
|
||||
encoding: None = ...,
|
||||
errors: None = ...,
|
||||
newline: None = ...,
|
||||
) -> BufferedReader: ...
|
||||
# Buffering cannot be determined: fall back to BinaryIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> BinaryIO: ...
|
||||
# Fallback if mode is not specified
|
||||
@overload
|
||||
def open(
|
||||
self,
|
||||
mode: str,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
) -> IO[Any]: ...
|
||||
else:
|
||||
# Adapted from _io.open
|
||||
def open(
|
||||
self,
|
||||
mode: Text = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
) -> IO[Any]: ...
|
||||
def mkdir(self, mode: int = ..., parents: bool = ...) -> None: ...
|
||||
# Adapted from _io.open
|
||||
def open(
|
||||
self,
|
||||
mode: Text = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
) -> IO[Any]: ...
|
||||
def owner(self) -> str: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def readlink(self: _P) -> _P: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def rename(self: _P, target: Union[str, PurePath]) -> _P: ...
|
||||
def replace(self: _P, target: Union[str, PurePath]) -> _P: ...
|
||||
else:
|
||||
def rename(self, target: Union[str, PurePath]) -> None: ...
|
||||
def replace(self, target: Union[str, PurePath]) -> None: ...
|
||||
if sys.version_info < (3, 6):
|
||||
def resolve(self: _P) -> _P: ...
|
||||
else:
|
||||
def resolve(self: _P, strict: bool = ...) -> _P: ...
|
||||
def rename(self, target: Union[str, PurePath]) -> None: ...
|
||||
def replace(self, target: Union[str, PurePath]) -> None: ...
|
||||
def resolve(self: _P) -> _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 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: ...
|
||||
def unlink(self) -> None: ...
|
||||
@classmethod
|
||||
def home(cls: Type[_P]) -> _P: ...
|
||||
def absolute(self: _P) -> _P: ...
|
||||
@@ -190,8 +98,6 @@ class Path(PurePath):
|
||||
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: ...
|
||||
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): ...
|
||||
|
||||
7
third_party/3/six/__init__.pyi
vendored
7
third_party/3/six/__init__.pyi
vendored
@@ -18,7 +18,6 @@ from typing import (
|
||||
NoReturn,
|
||||
Optional,
|
||||
Pattern,
|
||||
Text,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
@@ -100,9 +99,9 @@ print_ = print
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ...
|
||||
def ensure_binary(s: Union[bytes, str], encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def ensure_str(s: Union[bytes, str], encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def ensure_text(s: Union[bytes, str], encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
|
||||
class _LazyDescriptor:
|
||||
|
||||
8
third_party/3/waitress/compat.pyi
vendored
8
third_party/3/waitress/compat.pyi
vendored
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from io import TextIOWrapper
|
||||
from typing import Any, Optional, Text, Tuple
|
||||
from typing import Any, Optional, Tuple
|
||||
|
||||
PY2: bool
|
||||
PY3: bool
|
||||
@@ -19,9 +19,9 @@ binary_type = bytes
|
||||
long = int
|
||||
|
||||
def unquote_bytes_to_wsgi(bytestring: bytes) -> str: ...
|
||||
def text_(s: Text, encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def tostr(s: Text) -> str: ...
|
||||
def tobytes(s: Text) -> bytes: ...
|
||||
def text_(s: str, encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def tostr(s: str) -> str: ...
|
||||
def tobytes(s: str) -> bytes: ...
|
||||
|
||||
exec_: Any
|
||||
|
||||
|
||||
Reference in New Issue
Block a user