mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
mailbox, mimetypes, unittest, zipfile: stubtest fixes (#5239)
This commit is contained in:
@@ -100,20 +100,18 @@ class Maildir(Mailbox[MaildirMessage]):
|
||||
class _singlefileMailbox(Mailbox[_MessageT]): ...
|
||||
|
||||
class _mboxMMDF(_singlefileMailbox[_MessageT]):
|
||||
def get_file(self, key: str) -> _PartialFile[bytes]: ...
|
||||
def get_file(self, key: str, from_: bool = ...) -> _PartialFile[bytes]: ...
|
||||
def get_bytes(self, key: str, from_: bool = ...) -> bytes: ...
|
||||
def get_string(self, key: str, from_: bool = ...) -> str: ...
|
||||
|
||||
class mbox(_mboxMMDF[mboxMessage]):
|
||||
def __init__(
|
||||
self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
def __init__(self, path: 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, path: 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 __init__(self, path: 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: ...
|
||||
@@ -124,9 +122,7 @@ 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, path: AnyPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def get_file(self, key: str) -> IO[bytes]: ...
|
||||
def get_labels(self) -> List[str]: ...
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ else:
|
||||
def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ...
|
||||
def guess_extension(type: str, strict: bool = ...) -> Optional[str]: ...
|
||||
def init(files: Optional[Sequence[str]] = ...) -> None: ...
|
||||
def read_mime_types(filename: str) -> Optional[Dict[str, str]]: ...
|
||||
def read_mime_types(file: str) -> Optional[Dict[str, str]]: ...
|
||||
def add_type(type: str, ext: str, strict: bool = ...) -> None: ...
|
||||
|
||||
inited: bool
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
import sys
|
||||
from typing import Optional
|
||||
from unittest.async_case import *
|
||||
from unittest.case import *
|
||||
|
||||
from .case import (
|
||||
FunctionTestCase as FunctionTestCase,
|
||||
SkipTest as SkipTest,
|
||||
TestCase as TestCase,
|
||||
expectedFailure as expectedFailure,
|
||||
skip as skip,
|
||||
skipIf as skipIf,
|
||||
skipUnless as skipUnless,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from .case import addModuleCleanup as addModuleCleanup
|
||||
|
||||
from unittest.loader import *
|
||||
from unittest.main import *
|
||||
from unittest.result import TestResult as TestResult
|
||||
|
||||
@@ -186,6 +186,9 @@ class ZipInfo:
|
||||
def is_dir(self) -> bool: ...
|
||||
def FileHeader(self, zip64: Optional[bool] = ...) -> bytes: ...
|
||||
|
||||
class _PathOpenProtocol(Protocol):
|
||||
def __call__(self, mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class Path:
|
||||
@property
|
||||
@@ -193,7 +196,11 @@ if sys.version_info >= (3, 8):
|
||||
@property
|
||||
def parent(self) -> Path: ... # undocumented
|
||||
def __init__(self, root: Union[ZipFile, StrPath, IO[bytes]], at: str = ...) -> None: ...
|
||||
def open(self, mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def open(self, mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
else:
|
||||
@property
|
||||
def open(self) -> _PathOpenProtocol: ...
|
||||
def iterdir(self) -> Iterator[Path]: ...
|
||||
def is_dir(self) -> bool: ...
|
||||
def is_file(self) -> bool: ...
|
||||
|
||||
@@ -95,7 +95,6 @@ typing.SupportsInt.__init__
|
||||
typing.SupportsRound.__init__
|
||||
typing._SpecialForm.__init__
|
||||
typing._SpecialForm.__new__
|
||||
unittest.doModuleCleanups
|
||||
uuid.getnode # undocumented, unused parameter getters that was later removed
|
||||
weakref.WeakValueDictionary.update
|
||||
webbrowser.Opera.raise_opts
|
||||
@@ -103,7 +102,6 @@ xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modu
|
||||
xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature
|
||||
xml.etree.cElementTree.TreeBuilder.start # bpo-39495
|
||||
xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature
|
||||
zipfile.Path.open
|
||||
# These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt
|
||||
enum.IntFlag.__new__
|
||||
pstats.SortKey.__new__
|
||||
|
||||
@@ -168,15 +168,7 @@ lib2to3.pytree.BasePattern.__new__
|
||||
lib2to3.pytree.BasePattern.type
|
||||
lib2to3.pytree.NegatedPattern.match
|
||||
lib2to3.pytree.NegatedPattern.match_seq
|
||||
mailbox.Babyl.__init__
|
||||
mailbox.MH.__init__
|
||||
mailbox.MMDF.__init__
|
||||
mailbox._mboxMMDF.get_bytes
|
||||
mailbox._mboxMMDF.get_file
|
||||
mailbox._mboxMMDF.get_string
|
||||
mailbox.mbox.__init__
|
||||
mimetypes.read_mime_types
|
||||
mmap.mmap.__iter__
|
||||
mmap.mmap.__iter__ # has __getitem__ but mypy doesn't derive __iter__ from it: https://github.com/python/mypy/issues/2220
|
||||
multiprocessing.JoinableQueue
|
||||
multiprocessing.Queue
|
||||
multiprocessing.SimpleQueue
|
||||
|
||||
Reference in New Issue
Block a user