mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-26 03:27:14 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
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 email
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Dict,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Mapping,
|
||||
Optional,
|
||||
Protocol,
|
||||
Sequence,
|
||||
Text,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_MessageType = TypeVar("_MessageType", bound=Message)
|
||||
_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]]
|
||||
@@ -20,7 +42,6 @@ class Mailbox(Generic[_MessageType]):
|
||||
|
||||
_path: Union[bytes, str] # undocumented
|
||||
_factory: Optional[Callable[[IO[Any]], _MessageType]] # undocumented
|
||||
|
||||
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: ...
|
||||
@@ -61,10 +82,10 @@ class Mailbox(Generic[_MessageType]):
|
||||
class Maildir(Mailbox[MaildirMessage]):
|
||||
|
||||
colon: str
|
||||
|
||||
def __init__(self, dirname: AnyPath, 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]: ...
|
||||
def get_folder(self, folder: Text) -> Maildir: ...
|
||||
def add_folder(self, folder: Text) -> Maildir: ...
|
||||
@@ -75,22 +96,21 @@ class Maildir(Mailbox[MaildirMessage]):
|
||||
class _singlefileMailbox(Mailbox[_MessageType]): ...
|
||||
|
||||
class _mboxMMDF(_singlefileMailbox[_MessageType]):
|
||||
|
||||
def get_file(self, key: str) -> _PartialFile[bytes]: ...
|
||||
|
||||
class mbox(_mboxMMDF[mboxMessage]):
|
||||
|
||||
def __init__(self, dirname: AnyPath, 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: AnyPath, 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: 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: AnyPath) -> MH: ...
|
||||
def add_folder(self, folder: AnyPath) -> MH: ...
|
||||
@@ -100,18 +120,16 @@ class MH(Mailbox[MHMessage]):
|
||||
def pack(self) -> None: ...
|
||||
|
||||
class Babyl(_singlefileMailbox[BabylMessage]):
|
||||
|
||||
def __init__(self, dirname: AnyPath, 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]: ...
|
||||
|
||||
class Message(email.message.Message):
|
||||
|
||||
def __init__(self, message: Optional[_MessageData] = ...) -> None: ...
|
||||
|
||||
class MaildirMessage(Message):
|
||||
|
||||
def get_subdir(self) -> str: ...
|
||||
def set_subdir(self, subdir: Literal["new", "cur"]) -> None: ...
|
||||
def get_flags(self) -> str: ...
|
||||
@@ -124,9 +142,10 @@ class MaildirMessage(Message):
|
||||
def set_info(self, info: str) -> None: ...
|
||||
|
||||
class _mboxMMDFMessage(Message):
|
||||
|
||||
def get_from(self) -> str: ...
|
||||
def set_from(self, from_: str, time_: Optional[Union[bool, Tuple[int, int, int, int, int, int, int, int, int]]] = ...) -> None: ...
|
||||
def set_from(
|
||||
self, from_: str, time_: Optional[Union[bool, Tuple[int, int, int, int, int, int, int, int, int]]] = ...
|
||||
) -> None: ...
|
||||
def get_flags(self) -> str: ...
|
||||
def set_flags(self, flags: Iterable[str]) -> None: ...
|
||||
def add_flag(self, flag: str) -> None: ...
|
||||
@@ -135,14 +154,12 @@ class _mboxMMDFMessage(Message):
|
||||
class mboxMessage(_mboxMMDFMessage): ...
|
||||
|
||||
class MHMessage(Message):
|
||||
|
||||
def get_sequences(self) -> List[str]: ...
|
||||
def set_sequences(self, sequences: Iterable[str]) -> None: ...
|
||||
def add_sequence(self, sequence: str) -> None: ...
|
||||
def remove_sequence(self, sequence: str) -> None: ...
|
||||
|
||||
class BabylMessage(Message):
|
||||
|
||||
def get_labels(self) -> List[str]: ...
|
||||
def set_labels(self, labels: Iterable[str]) -> None: ...
|
||||
def add_label(self, label: str) -> None: ...
|
||||
@@ -154,7 +171,6 @@ class BabylMessage(Message):
|
||||
class MMDFMessage(_mboxMMDFMessage): ...
|
||||
|
||||
class _ProxyFile(Generic[AnyStr]):
|
||||
|
||||
def __init__(self, f: IO[AnyStr], pos: Optional[int] = ...) -> None: ...
|
||||
def read(self, size: Optional[int] = ...) -> AnyStr: ...
|
||||
def read1(self, size: Optional[int] = ...) -> AnyStr: ...
|
||||
@@ -165,7 +181,9 @@ class _ProxyFile(Generic[AnyStr]):
|
||||
def seek(self, offset: int, whence: int = ...) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __enter__(self) -> _ProxyFile[AnyStr]: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def seekable(self) -> bool: ...
|
||||
@@ -174,15 +192,10 @@ class _ProxyFile(Generic[AnyStr]):
|
||||
def closed(self) -> bool: ...
|
||||
|
||||
class _PartialFile(_ProxyFile[AnyStr]):
|
||||
|
||||
def __init__(self, f: IO[AnyStr], start: Optional[int] = ..., stop: Optional[int] = ...) -> None: ...
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
class NoSuchMailboxError(Error): ...
|
||||
|
||||
class NotEmptyError(Error): ...
|
||||
|
||||
class ExternalClashError(Error): ...
|
||||
|
||||
class FormatError(Error): ...
|
||||
|
||||
Reference in New Issue
Block a user