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

@@ -57,11 +57,12 @@ class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra,
def __setitem__(self, __k: _KT_contra, __v: _VT) -> None: ...
def __delitem__(self, __v: _KT_contra) -> None: ...
# StrPath and AnyPath can be used in places where a
# path can be used instead of a string, starting with Python 3.6.
# These aliases can be used in places where a PathLike object can be used
# instead of a string in Python 3.
StrPath = Text
BytesPath = bytes
AnyPath = Union[Text, bytes]
BytesPath = str
StrOrBytesPath = Text
AnyPath = StrOrBytesPath # obsolete, will be removed soon
OpenTextModeUpdating = Literal[
"r+",

View File

@@ -1,9 +1,9 @@
import io
from _typeshed import AnyPath, ReadableBuffer, WriteableBuffer
from typing import IO, Any, Iterable, List, Optional, TypeVar, Union
from _typeshed import ReadableBuffer, WriteableBuffer
from typing import IO, Any, Iterable, List, Optional, Text, TypeVar, Union
from typing_extensions import SupportsIndex
_PathOrFile = Union[AnyPath, IO[bytes]]
_PathOrFile = Union[Text, IO[bytes]]
_T = TypeVar("_T")
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...

View File

@@ -1,6 +1,5 @@
from _typeshed import AnyPath
from types import CodeType
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
from typing import Any, Callable, Dict, Optional, Text, Tuple, TypeVar, Union
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
def runctx(
@@ -19,7 +18,7 @@ class Profile:
def enable(self) -> None: ...
def disable(self) -> None: ...
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
def dump_stats(self, file: AnyPath) -> None: ...
def dump_stats(self, file: Text) -> None: ...
def create_stats(self) -> None: ...
def snapshot_stats(self) -> None: ...
def run(self: _SelfT, cmd: str) -> _SelfT: ...

View File

@@ -1,6 +1,5 @@
from _typeshed import AnyPath
from types import FrameType, TracebackType
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type
from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type
_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
@@ -19,7 +18,7 @@ class Hook: # undocumented
def __init__(
self,
display: int = ...,
logdir: Optional[AnyPath] = ...,
logdir: Optional[Text] = ...,
context: int = ...,
file: Optional[IO[str]] = ...,
format: str = ...,
@@ -30,4 +29,4 @@ class Hook: # undocumented
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
def enable(display: int = ..., logdir: Optional[AnyPath] = ..., context: int = ..., format: str = ...) -> None: ...
def enable(display: int = ..., logdir: Optional[Text] = ..., context: int = ..., format: str = ...) -> None: ...

View File

@@ -1,16 +1,15 @@
from _typeshed import AnyPath
from typing import Any, Optional, Pattern
from typing import Any, Optional, Pattern, Text
# rx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(
dir: AnyPath,
dir: Text,
maxlevels: int = ...,
ddir: Optional[AnyPath] = ...,
ddir: Optional[Text] = ...,
force: bool = ...,
rx: Optional[Pattern[Any]] = ...,
quiet: int = ...,
) -> int: ...
def compile_file(
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
fullname: Text, ddir: Optional[Text] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
) -> int: ...
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...

View File

@@ -1,13 +1,12 @@
from _typeshed import AnyPath
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Union
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Text, Union
def input(
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
files: Union[Text, Iterable[Text], None] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
openhook: Callable[[Text, str], IO[AnyStr]] = ...,
) -> FileInput[AnyStr]: ...
def close() -> None: ...
def nextfile() -> None: ...
@@ -21,12 +20,12 @@ def isstdin() -> bool: ...
class FileInput(Iterable[AnyStr], Generic[AnyStr]):
def __init__(
self,
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
files: Union[None, Text, Iterable[Text]] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
openhook: Callable[[Text, str], IO[AnyStr]] = ...,
) -> None: ...
def __del__(self) -> None: ...
def close(self) -> None: ...
@@ -42,5 +41,5 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
def isfirstline(self) -> bool: ...
def isstdin(self) -> bool: ...
def hook_compressed(filename: AnyPath, mode: str) -> IO[Any]: ...
def hook_encoded(encoding: str) -> Callable[[AnyPath, str], IO[Any]]: ...
def hook_compressed(filename: Text, mode: str) -> IO[Any]: ...
def hook_encoded(encoding: str) -> Callable[[Text, str], IO[Any]]: ...

View File

@@ -1,25 +1,25 @@
from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT
from typing import List, Sequence, Tuple, Union, overload
from _typeshed import SupportsLessThanT
from typing import List, Sequence, Text, Tuple, Union, overload
from typing_extensions import Literal
# All overloads can return empty string. Ideally, Literal[""] would be a valid
# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return
# type. But because this only works when T is str, we need Sequence[T] instead.
@overload
def commonprefix(m: Sequence[StrPath]) -> str: ... # type: ignore
def commonprefix(m: Sequence[Text]) -> str: ... # type: ignore
@overload
def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ... # type: ignore
def commonprefix(m: Sequence[str]) -> Union[str, Literal[""]]: ... # type: ignore
@overload
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: Text) -> bool: ...
def getsize(filename: Text) -> int: ...
def isfile(path: Text) -> bool: ...
def isdir(s: Text) -> 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 getatime(filename: Text) -> float: ...
def getmtime(filename: Text) -> float: ...
def getctime(filename: Text) -> float: ...

View File

@@ -1,4 +1,3 @@
from _typeshed import AnyPath
from genericpath import (
commonprefix as commonprefix,
exists as exists,
@@ -37,7 +36,7 @@ def dirname(s: AnyStr) -> AnyStr: ...
def normcase(path: AnyStr) -> AnyStr: ...
def normpath(s: AnyStr) -> AnyStr: ...
def realpath(path: AnyStr) -> AnyStr: ...
def islink(s: AnyPath) -> bool: ...
def islink(s: Text) -> bool: ...
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
# (Since Python 2 allows that, too)
@@ -46,11 +45,11 @@ def islink(s: AnyPath) -> bool: ...
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
def join(__p1: Text, *p: Text) -> Text: ...
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...

View File

@@ -1,5 +1,4 @@
import email.message
from _typeshed import AnyPath
from types import TracebackType
from typing import (
IO,
@@ -40,7 +39,7 @@ class Mailbox(Generic[_MessageT]):
_path: Union[bytes, str] # undocumented
_factory: Optional[Callable[[IO[Any]], _MessageT]] # undocumented
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], _MessageT]] = ..., create: bool = ...) -> None: ...
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], _MessageT]] = ..., create: bool = ...) -> None: ...
def add(self, message: _MessageData) -> str: ...
def remove(self, key: str) -> None: ...
def __delitem__(self, key: str) -> None: ...
@@ -81,7 +80,7 @@ class Maildir(Mailbox[MaildirMessage]):
colon: str
def __init__(
self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...
self, dirname: Text, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...
) -> None: ...
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
def list_folders(self) -> List[str]: ...
@@ -99,24 +98,24 @@ class _mboxMMDF(_singlefileMailbox[_MessageT]):
def get_string(self, key: str, from_: bool = ...) -> str: ...
class mbox(_mboxMMDF[mboxMessage]):
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
class MMDF(_mboxMMDF[MMDFMessage]):
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
class MH(Mailbox[MHMessage]):
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
def list_folders(self) -> List[str]: ...
def get_folder(self, folder: AnyPath) -> MH: ...
def add_folder(self, folder: AnyPath) -> MH: ...
def remove_folder(self, folder: AnyPath) -> None: ...
def get_folder(self, folder: Text) -> MH: ...
def add_folder(self, folder: Text) -> MH: ...
def remove_folder(self, folder: Text) -> None: ...
def get_sequences(self) -> Dict[str, List[int]]: ...
def set_sequences(self, sequences: Mapping[str, Sequence[int]]) -> None: ...
def pack(self) -> None: ...
class Babyl(_singlefileMailbox[BabylMessage]):
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
def get_file(self, key: str) -> IO[bytes]: ...
def get_labels(self) -> List[str]: ...

View File

@@ -1,11 +1,10 @@
from _typeshed import AnyPath
from typing import Dict, List, Optional, Tuple
from typing import Dict, List, Optional, Text, Tuple
class NetrcParseError(Exception):
filename: Optional[str]
lineno: Optional[int]
msg: str
def __init__(self, msg: str, filename: Optional[AnyPath] = ..., lineno: Optional[int] = ...) -> None: ...
def __init__(self, msg: str, filename: Optional[Text] = ..., lineno: Optional[int] = ...) -> None: ...
# (login, account, password) tuple
_NetrcTuple = Tuple[str, Optional[str], Optional[str]]
@@ -13,5 +12,5 @@ _NetrcTuple = Tuple[str, Optional[str], Optional[str]]
class netrc:
hosts: Dict[str, _NetrcTuple]
macros: Dict[str, List[str]]
def __init__(self, file: Optional[AnyPath] = ...) -> None: ...
def __init__(self, file: Optional[Text] = ...) -> None: ...
def authenticators(self, host: str) -> Optional[_NetrcTuple]: ...

View File

@@ -1,6 +1,5 @@
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
@@ -39,20 +38,20 @@ else:
# 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: ...
def commonprefix(m: Sequence[Text]) -> Any: ...
def lexists(path: Text) -> 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: ...
def getatime(filename: Text) -> float: ...
def getmtime(filename: Text) -> float: ...
def getctime(filename: Text) -> float: ...
def getsize(filename: Text) -> int: ...
def isabs(s: Text) -> bool: ...
def isfile(path: Text) -> bool: ...
def isdir(s: Text) -> bool: ...
def islink(path: Text) -> bool: ...
def ismount(path: Text) -> bool: ...
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
# (Since Python 2 allows that, too)
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
def join(__p1: Text, *p: Text) -> Text: ...
@overload
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
def relpath(path: str, start: Optional[str] = ...) -> str: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
def samefile(f1: Text, f2: Text) -> 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]: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import AnyPath, FileDescriptorLike
from _typeshed import FileDescriptorLike
from builtins import OSError
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
from typing import (
@@ -198,40 +198,40 @@ def dup2(fd: int, fd2: int) -> None: ...
def fstat(fd: int) -> Any: ...
def fsync(fd: FileDescriptorLike) -> None: ...
def lseek(fd: int, pos: int, how: int) -> int: ...
def open(file: AnyPath, flags: int, mode: int = ...) -> int: ...
def open(file: Text, flags: int, mode: int = ...) -> int: ...
def pipe() -> Tuple[int, int]: ...
def read(fd: int, n: int) -> bytes: ...
def write(fd: int, string: Union[bytes, buffer]) -> int: ...
def access(path: AnyPath, mode: int) -> bool: ...
def chdir(path: AnyPath) -> None: ...
def access(path: Text, mode: int) -> bool: ...
def chdir(path: Text) -> None: ...
def fchdir(fd: FileDescriptorLike) -> None: ...
def getcwd() -> str: ...
def getcwdu() -> unicode: ...
def chmod(path: AnyPath, mode: int) -> None: ...
def link(src: AnyPath, link_name: AnyPath) -> None: ...
def lstat(path: AnyPath) -> Any: ...
def mknod(filename: AnyPath, mode: int = ..., device: int = ...) -> None: ...
def chmod(path: Text, mode: int) -> None: ...
def link(src: Text, link_name: Text) -> None: ...
def lstat(path: Text) -> Any: ...
def mknod(filename: Text, mode: int = ..., device: int = ...) -> None: ...
def major(device: int) -> int: ...
def minor(device: int) -> int: ...
def makedev(major: int, minor: int) -> int: ...
def mkdir(path: AnyPath, mode: int = ...) -> None: ...
def makedirs(path: AnyPath, mode: int = ...) -> None: ...
def mkdir(path: Text, mode: int = ...) -> None: ...
def makedirs(path: Text, mode: int = ...) -> None: ...
def readlink(path: AnyStr) -> AnyStr: ...
def remove(path: AnyPath) -> None: ...
def removedirs(path: AnyPath) -> None: ...
def rename(src: AnyPath, dst: AnyPath) -> None: ...
def renames(old: AnyPath, new: AnyPath) -> None: ...
def rmdir(path: AnyPath) -> None: ...
def stat(path: AnyPath) -> Any: ...
def remove(path: Text) -> None: ...
def removedirs(path: Text) -> None: ...
def rename(src: Text, dst: Text) -> None: ...
def renames(old: Text, new: Text) -> None: ...
def rmdir(path: Text) -> None: ...
def stat(path: Text) -> Any: ...
@overload
def stat_float_times() -> bool: ...
@overload
def stat_float_times(newvalue: bool) -> None: ...
def symlink(source: AnyPath, link_name: AnyPath) -> None: ...
def unlink(path: AnyPath) -> None: ...
def symlink(source: Text, link_name: Text) -> None: ...
def unlink(path: Text) -> None: ...
# TODO: add ns, dir_fd, follow_symlinks argument
def utime(path: AnyPath, times: Optional[Tuple[float, float]]) -> None: ...
def utime(path: Text, times: Optional[Tuple[float, float]]) -> None: ...
if sys.platform != "win32":
# Unix only
@@ -247,15 +247,15 @@ if sys.platform != "win32":
def tcgetpgrp(fd: int) -> int: ...
def tcsetpgrp(fd: int, pg: int) -> None: ...
def ttyname(fd: int) -> str: ...
def chflags(path: AnyPath, flags: int) -> None: ...
def chroot(path: AnyPath) -> None: ...
def chown(path: AnyPath, uid: int, gid: int) -> None: ...
def lchflags(path: AnyPath, flags: int) -> None: ...
def lchmod(path: AnyPath, mode: int) -> None: ...
def lchown(path: AnyPath, uid: int, gid: int) -> None: ...
def mkfifo(path: AnyPath, mode: int = ...) -> None: ...
def pathconf(path: AnyPath, name: Union[str, int]) -> int: ...
def statvfs(path: AnyPath) -> _StatVFS: ...
def chflags(path: Text, flags: int) -> None: ...
def chroot(path: Text) -> None: ...
def chown(path: Text, uid: int, gid: int) -> None: ...
def lchflags(path: Text, flags: int) -> None: ...
def lchmod(path: Text, mode: int) -> None: ...
def lchown(path: Text, uid: int, gid: int) -> None: ...
def mkfifo(path: Text, mode: int = ...) -> None: ...
def pathconf(path: Text, name: Union[str, int]) -> int: ...
def statvfs(path: Text) -> _StatVFS: ...
def walk(
top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ...
@@ -263,21 +263,21 @@ def walk(
def abort() -> NoReturn: ...
# These are defined as execl(file, *args) but the first *arg is mandatory.
def execl(file: AnyPath, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
def execlp(file: AnyPath, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
def execl(file: Text, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
def execlp(file: Text, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
# These are: execle(file, *args, env) but env is pulled from the last element of the args.
def execle(file: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
def execlpe(file: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
def execle(file: Text, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
def execlpe(file: Text, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
# The docs say `args: tuple or list of strings`
# The implementation enforces tuple or list so we can't use Sequence.
_ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]]
def execv(path: AnyPath, args: _ExecVArgs) -> NoReturn: ...
def execve(path: AnyPath, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
def execvp(file: AnyPath, args: _ExecVArgs) -> NoReturn: ...
def execvpe(file: AnyPath, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
def execv(path: Text, args: _ExecVArgs) -> NoReturn: ...
def execve(path: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
def execvp(file: Text, args: _ExecVArgs) -> NoReturn: ...
def execvpe(file: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
def _exit(n: int) -> NoReturn: ...
def kill(pid: int, sig: int) -> None: ...
@@ -293,24 +293,24 @@ def popen(command: str, *args, **kwargs) -> IO[Any]: ...
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def spawnl(mode: int, path: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
def spawnle(mode: int, path: AnyPath, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise sig
def spawnv(mode: int, path: AnyPath, args: List[Union[bytes, Text]]) -> int: ...
def spawnve(mode: int, path: AnyPath, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
def system(command: AnyPath) -> int: ...
def spawnl(mode: int, path: Text, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
def spawnle(mode: int, path: Text, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise sig
def spawnv(mode: int, path: Text, args: List[Union[bytes, Text]]) -> int: ...
def spawnve(mode: int, path: Text, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
def system(command: Text) -> int: ...
def times() -> Tuple[float, float, float, float, float]: ...
def waitpid(pid: int, options: int) -> Tuple[int, int]: ...
def urandom(n: int) -> bytes: ...
if sys.platform == "win32":
def startfile(path: AnyPath, operation: Optional[str] = ...) -> None: ...
def startfile(path: Text, operation: Optional[str] = ...) -> None: ...
else:
# Unix only
def spawnlp(mode: int, file: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
def spawnlpe(mode: int, file: AnyPath, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise signature
def spawnvp(mode: int, file: AnyPath, args: List[Union[bytes, Text]]) -> int: ...
def spawnvpe(mode: int, file: AnyPath, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
def spawnlp(mode: int, file: Text, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
def spawnlpe(mode: int, file: Text, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise signature
def spawnvp(mode: int, file: Text, args: List[Union[bytes, Text]]) -> int: ...
def spawnvpe(mode: int, file: Text, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
def wait() -> Tuple[int, int]: ...
def wait3(options: int) -> Tuple[int, int, Any]: ...
def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ...

View File

@@ -1,6 +1,5 @@
import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
_T = TypeVar("_T")
@@ -38,21 +37,21 @@ else:
# 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 exists(path: AnyPath) -> bool: ...
def lexists(path: AnyPath) -> bool: ...
def commonprefix(m: Sequence[Text]) -> Any: ...
def exists(path: Text) -> bool: ...
def lexists(path: Text) -> 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: ...
def getatime(filename: Text) -> float: ...
def getmtime(filename: Text) -> float: ...
def getctime(filename: Text) -> float: ...
def getsize(filename: Text) -> int: ...
def isabs(s: Text) -> bool: ...
def isfile(path: Text) -> bool: ...
def isdir(s: Text) -> bool: ...
def islink(path: Text) -> bool: ...
def ismount(path: Text) -> bool: ...
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
# (Since Python 2 allows that, too)
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
def join(__p1: Text, *p: Text) -> Text: ...
@overload
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
def relpath(path: str, start: Optional[str] = ...) -> str: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
def samefile(f1: Text, f2: Text) -> 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]: ...

View File

@@ -1,6 +1,5 @@
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
@@ -39,20 +38,20 @@ else:
# 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: ...
def commonprefix(m: Sequence[Text]) -> Any: ...
def lexists(path: Text) -> 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: ...
def getatime(filename: Text) -> float: ...
def getmtime(filename: Text) -> float: ...
def getctime(filename: Text) -> float: ...
def getsize(filename: Text) -> int: ...
def isabs(s: Text) -> bool: ...
def isfile(path: Text) -> bool: ...
def isdir(s: Text) -> bool: ...
def islink(path: Text) -> bool: ...
def ismount(path: Text) -> bool: ...
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
# (Since Python 2 allows that, too)
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
def join(__p1: Text, *p: Text) -> Text: ...
@overload
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
def relpath(path: str, start: Optional[str] = ...) -> str: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
def samefile(f1: Text, f2: Text) -> 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]: ...

View File

@@ -1,4 +1,3 @@
from _typeshed import AnyPath
from types import CodeType
from typing import Any, List, Sequence, Text, Tuple
@@ -8,14 +7,14 @@ def sequence2st(sequence: Sequence[Any]) -> STType: ...
def tuple2st(sequence: Sequence[Any]) -> STType: ...
def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
def compilest(st: STType, filename: AnyPath = ...) -> CodeType: ...
def compilest(st: STType, filename: Text = ...) -> CodeType: ...
def isexpr(st: STType) -> bool: ...
def issuite(st: STType) -> bool: ...
class ParserError(Exception): ...
class STType:
def compile(self, filename: AnyPath = ...) -> CodeType: ...
def compile(self, filename: Text = ...) -> CodeType: ...
def isexpr(self) -> bool: ...
def issuite(self) -> bool: ...
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...

View File

@@ -1,6 +1,5 @@
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
@@ -39,20 +38,20 @@ else:
# 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: ...
def commonprefix(m: Sequence[Text]) -> Any: ...
def lexists(path: Text) -> 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: ...
def getatime(filename: Text) -> float: ...
def getmtime(filename: Text) -> float: ...
def getctime(filename: Text) -> float: ...
def getsize(filename: Text) -> int: ...
def isabs(s: Text) -> bool: ...
def isfile(path: Text) -> bool: ...
def isdir(s: Text) -> bool: ...
def islink(path: Text) -> bool: ...
def ismount(path: Text) -> bool: ...
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
# (Since Python 2 allows that, too)
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
def join(__p1: Text, *p: Text) -> Text: ...
@overload
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
def relpath(path: str, start: Optional[str] = ...) -> str: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
def samefile(f1: Text, f2: Text) -> 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]: ...

View File

@@ -1,5 +1,4 @@
from _typeshed import AnyPath
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
from typing import Any, Callable, Dict, Optional, Text, Tuple, TypeVar, Union
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
def runctx(
@@ -18,7 +17,7 @@ class Profile:
def simulate_call(self, name: str) -> None: ...
def simulate_cmd_complete(self) -> None: ...
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
def dump_stats(self, file: AnyPath) -> None: ...
def dump_stats(self, file: Text) -> None: ...
def create_stats(self) -> None: ...
def snapshot_stats(self) -> None: ...
def run(self: _SelfT, cmd: str) -> _SelfT: ...

View File

@@ -1,4 +1,3 @@
from _typeshed import AnyPath
from cProfile import Profile as _cProfile
from profile import Profile
from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload
@@ -18,7 +17,7 @@ class Stats:
def load_stats(self, arg: Union[None, str, Text, Profile, _cProfile]) -> None: ...
def get_top_level_stats(self) -> None: ...
def add(self: _T, *arg_list: Union[None, str, Text, Profile, _cProfile, _T]) -> _T: ...
def dump_stats(self, filename: AnyPath) -> None: ...
def dump_stats(self, filename: Text) -> None: ...
def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ...
@overload
def sort_stats(self: _T, field: int) -> _T: ...

View File

@@ -1,16 +1,15 @@
from _typeshed import AnyPath
from typing import Callable, Optional, Sequence
from typing import Callable, Optional, Sequence, Text
_CompleterT = Optional[Callable[[str, int], Optional[str]]]
_CompDispT = Optional[Callable[[str, Sequence[str], int], None]]
def parse_and_bind(__string: str) -> None: ...
def read_init_file(__filename: Optional[AnyPath] = ...) -> None: ...
def read_init_file(__filename: Optional[Text] = ...) -> None: ...
def get_line_buffer() -> str: ...
def insert_text(__string: str) -> None: ...
def redisplay() -> None: ...
def read_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
def write_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
def read_history_file(__filename: Optional[Text] = ...) -> None: ...
def write_history_file(__filename: Optional[Text] = ...) -> None: ...
def get_history_length() -> int: ...
def set_history_length(__length: int) -> None: ...
def clear_history() -> None: ...

View File

@@ -1,5 +1,5 @@
from _typeshed import StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
from _typeshed import SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, List, Optional, Sequence, Set, Text, Tuple, Type, TypeVar, Union
_AnyStr = TypeVar("_AnyStr", str, unicode)
_AnyPath = TypeVar("_AnyPath", str, unicode)
@@ -10,25 +10,25 @@ class SpecialFileError(EnvironmentError): ...
class ExecError(EnvironmentError): ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
def copyfile(src: StrPath, dst: StrPath) -> None: ...
def copymode(src: StrPath, dst: StrPath) -> None: ...
def copystat(src: StrPath, dst: StrPath) -> None: ...
def copy(src: StrPath, dst: StrPath) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath) -> _PathReturn: ...
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
def copyfile(src: Text, dst: Text) -> None: ...
def copymode(src: Text, dst: Text) -> None: ...
def copystat(src: Text, dst: Text) -> None: ...
def copy(src: Text, dst: Text) -> _PathReturn: ...
def copy2(src: Text, dst: Text) -> _PathReturn: ...
def ignore_patterns(*patterns: Text) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
def copytree(
src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] = ...
) -> _PathReturn: ...
def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
_CopyFn = Union[Callable[[str, str], None], Callable[[Text, Text], None]]
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
def move(src: Text, dst: Text) -> _PathReturn: ...
def make_archive(
base_name: _AnyStr,
format: str,
root_dir: Optional[StrPath] = ...,
base_dir: Optional[StrPath] = ...,
root_dir: Optional[Text] = ...,
base_dir: Optional[Text] = ...,
verbose: bool = ...,
dry_run: bool = ...,
owner: Optional[str] = ...,

View File

@@ -1,7 +1,6 @@
from _typeshed import AnyPath
from typing import Optional, Tuple, Union
from typing import Optional, Text, Tuple, Union
_SndHeaders = Tuple[str, int, int, int, Union[int, str]]
def what(filename: AnyPath) -> Optional[_SndHeaders]: ...
def whathdr(filename: AnyPath) -> Optional[_SndHeaders]: ...
def what(filename: Text) -> Optional[_SndHeaders]: ...
def whathdr(filename: Text) -> Optional[_SndHeaders]: ...

View File

@@ -1,5 +1,4 @@
from _typeshed import AnyPath
from typing import Iterable, Tuple
from typing import Iterable, Text, Tuple
verbose: int
filename_only: int
@@ -10,5 +9,5 @@ class NannyNag(Exception):
def get_msg(self) -> str: ...
def get_line(self) -> str: ...
def check(file: AnyPath) -> None: ...
def check(file: Text) -> None: ...
def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ...

View File

@@ -1,7 +1,6 @@
import io
from _typeshed import AnyPath
from types import TracebackType
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Type, Union
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Text, Tuple, Type, Union
# tar constants
NUL: bytes
@@ -51,7 +50,7 @@ TAR_PLAIN: int
TAR_GZIPPED: int
def open(
name: Optional[AnyPath] = ...,
name: Optional[Text] = ...,
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
bufsize: int = ...,
@@ -73,7 +72,7 @@ class ExFileObject(io.BufferedReader):
class TarFile(Iterable[TarInfo]):
OPEN_METH: Mapping[str, str]
name: Optional[AnyPath]
name: Optional[Text]
mode: str
fileobj: Optional[IO[bytes]]
format: Optional[int]
@@ -90,7 +89,7 @@ class TarFile(Iterable[TarInfo]):
posix: bool
def __init__(
self,
name: Optional[AnyPath] = ...,
name: Optional[Text] = ...,
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
format: Optional[int] = ...,
@@ -112,7 +111,7 @@ class TarFile(Iterable[TarInfo]):
@classmethod
def open(
cls,
name: Optional[AnyPath] = ...,
name: Optional[Text] = ...,
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
bufsize: int = ...,
@@ -130,7 +129,7 @@ class TarFile(Iterable[TarInfo]):
@classmethod
def taropen(
cls,
name: Optional[AnyPath],
name: Optional[Text],
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
*,
@@ -147,7 +146,7 @@ class TarFile(Iterable[TarInfo]):
@classmethod
def gzopen(
cls,
name: Optional[AnyPath],
name: Optional[Text],
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
compresslevel: int = ...,
@@ -164,7 +163,7 @@ class TarFile(Iterable[TarInfo]):
@classmethod
def bz2open(
cls,
name: Optional[AnyPath],
name: Optional[Text],
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
compresslevel: int = ...,
@@ -181,7 +180,7 @@ class TarFile(Iterable[TarInfo]):
@classmethod
def xzopen(
cls,
name: Optional[AnyPath],
name: Optional[Text],
mode: str = ...,
fileobj: Optional[IO[bytes]] = ...,
preset: Optional[int] = ...,
@@ -200,18 +199,18 @@ class TarFile(Iterable[TarInfo]):
def getnames(self) -> List[str]: ...
def list(self, verbose: bool = ...) -> None: ...
def next(self) -> Optional[TarInfo]: ...
def extractall(self, path: AnyPath = ..., members: Optional[Iterable[TarInfo]] = ...) -> None: ...
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...) -> None: ...
def extractall(self, path: Text = ..., members: Optional[Iterable[TarInfo]] = ...) -> None: ...
def extract(self, member: Union[str, TarInfo], path: Text = ...) -> None: ...
def extractfile(self, member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
def makedir(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makefile(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makeunknown(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makefifo(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makedev(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makelink(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def chown(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def chmod(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def utime(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makedir(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def makefile(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def makeunknown(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def makefifo(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def makedev(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def makelink(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def chown(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def chmod(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def utime(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
def add(
self,
name: str,
@@ -226,7 +225,7 @@ class TarFile(Iterable[TarInfo]):
) -> TarInfo: ...
def close(self) -> None: ...
def is_tarfile(name: AnyPath) -> bool: ...
def is_tarfile(name: Text) -> bool: ...
def filemode(mode: int) -> str: ... # undocumented
class TarFileCompat:

View File

@@ -1,4 +1,4 @@
from _typeshed import AnyPath, FileDescriptor
from _typeshed import FileDescriptor
from typing import (
IO,
Any,
@@ -50,7 +50,7 @@ _str_argument_type = Union[str, Text]
# _fixtext function in the source). Client code knows best:
_str_result_type = Any
_file_or_filename = Union[AnyPath, FileDescriptor, IO[Any]]
_file_or_filename = Union[Text, FileDescriptor, IO[Any]]
class Element(MutableSequence[Element]):
tag: _str_result_type