use _typeshed's Path aliases (#4214)

This commit is contained in:
Jelle Zijlstra
2020-06-10 20:57:09 -07:00
committed by GitHub
parent 86f03f2d7b
commit 43e93f803f
42 changed files with 483 additions and 757 deletions

View File

@@ -1,19 +1,8 @@
from typing import Optional, Union, Text, AnyStr, Callable, IO, Any, Iterator, List, Tuple, TypeVar, Protocol, Dict, Sequence, Iterable, Generic, Type, Mapping, overload
from types import TracebackType
import sys
import email
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
if sys.version_info >= (3, 6):
from builtins import _PathLike
_PathType = Union[bytes, Text, _PathLike]
else:
_PathType = Union[bytes, Text]
from _typeshed import AnyPath
from typing_extensions import Literal
_T = TypeVar("_T")
_MessageType = TypeVar("_MessageType", bound=Message)
@@ -32,7 +21,7 @@ class Mailbox(Generic[_MessageType]):
_path: Union[bytes, str] # undocumented
_factory: Optional[Callable[[IO[Any]], _MessageType]] # undocumented
def __init__(self, path: _PathType, factory: Optional[Callable[[IO[Any]], _MessageType]] = ..., create: bool = ...) -> None: ...
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], _MessageType]] = ..., create: bool = ...) -> None: ...
def add(self, message: _MessageData) -> str: ...
def remove(self, key: str) -> None: ...
def __delitem__(self, key: str) -> None: ...
@@ -73,7 +62,7 @@ class Maildir(Mailbox[MaildirMessage]):
colon: str
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...) -> None: ...
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
def list_folders(self) -> List[str]: ...
@@ -91,28 +80,28 @@ class _mboxMMDF(_singlefileMailbox[_MessageType]):
class mbox(_mboxMMDF[mboxMessage]):
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
class MMDF(_mboxMMDF[MMDFMessage]):
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
class MH(Mailbox[MHMessage]):
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, dirname: AnyPath, 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: _PathType) -> MH: ...
def add_folder(self, folder: _PathType) -> MH: ...
def remove_folder(self, folder: _PathType) -> None: ...
def get_folder(self, folder: AnyPath) -> MH: ...
def add_folder(self, folder: AnyPath) -> MH: ...
def remove_folder(self, folder: AnyPath) -> 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, dirname: _PathType, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
def get_file(self, key: str) -> IO[bytes]: ...
def get_labels(self) -> List[str]: ...