mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Mypy now supports sys.platform and sys.version_info checks (#410)
This commit is contained in:
@@ -404,8 +404,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __setitem__(self, s: slice, x: Sequence[int]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __add__(self, s: bytes) -> bytearray: ...
|
||||
# TODO: Mypy complains about __add__ and __iadd__ having different signatures.
|
||||
def __iadd__(self, s: Iterable[int]) -> bytearray: ... # type: ignore
|
||||
def __iadd__(self, s: Iterable[int]) -> bytearray: ...
|
||||
def __mul__(self, n: int) -> bytearray: ...
|
||||
def __rmul__(self, n: int) -> bytearray: ...
|
||||
def __imul__(self, n: int) -> bytearray: ...
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
from typing import Callable, Optional, IO
|
||||
import sys
|
||||
from email.message import Message, Policy
|
||||
from email.message import Message
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def message_from_string(s: str, _class: Callable[[], Message] = ..., *,
|
||||
@@ -15,16 +17,16 @@ if sys.version_info >= (3, 3):
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> Message: ...
|
||||
elif sys.version_info >= (3, 2):
|
||||
def message_from_string(s: str, # type: ignore
|
||||
def message_from_string(s: str,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
def message_from_bytes(s: bytes, # type: ignore
|
||||
def message_from_bytes(s: bytes,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
def message_from_file(fp: IO[str], # type: ignore
|
||||
def message_from_file(fp: IO[str],
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
def message_from_binary_file(fp: IO[bytes], # type: ignore
|
||||
def message_from_binary_file(fp: IO[bytes],
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool] = ...) -> Message: ...
|
||||
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
from typing import Callable
|
||||
import sys
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
|
||||
class FeedParser:
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, _factory: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
_factory: Callable[[], Message] = ...) -> None: ...
|
||||
def feed(self, data: str) -> None: ...
|
||||
def close(self) -> Message: ...
|
||||
@@ -21,7 +22,7 @@ if sys.version_info >= (3, 2):
|
||||
def __init__(self, _factory: Callable[[], Message] = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
_factory: Callable[[], Message] = ...) -> None: ...
|
||||
def feed(self, data: str) -> None: ...
|
||||
def close(self) -> Message: ...
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
from typing import TextIO, Optional
|
||||
import sys
|
||||
from email.policy import Policy
|
||||
from email.message import Message
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
|
||||
class Generator:
|
||||
def clone(self, fp: TextIO) -> 'Generator': ...
|
||||
@@ -13,14 +14,14 @@ class Generator:
|
||||
maxheaderlen: int = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, outfp: TextIO, # type: ignore
|
||||
def __init__(self, outfp: TextIO,
|
||||
mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ...) -> None: ...
|
||||
if sys.version_info >= (3, 2):
|
||||
def flatten(self, msg: Message, unixfrom: bool = ...,
|
||||
linesep: Optional[str] =...) -> None: ...
|
||||
else:
|
||||
def flatten(self, msg: Message, # type: ignore
|
||||
def flatten(self, msg: Message,
|
||||
unixfrom: bool = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
@@ -32,7 +33,7 @@ if sys.version_info >= (3, 2):
|
||||
maxheaderlen: int = ..., *,
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, outfp: TextIO, # type: ignore
|
||||
def __init__(self, outfp: TextIO,
|
||||
mangle_from_: bool = ...,
|
||||
maxheaderlen: int = ...) -> None: ...
|
||||
def flatten(self, msg: Message, unixfrom: bool = ...,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# Stubs for email.headerregistry (Python 3.4)
|
||||
|
||||
from typing import Tuple, Optional, Any, Union, Mapping
|
||||
import sys
|
||||
from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
import datetime as dt
|
||||
import sys
|
||||
from typing import Tuple, Optional, Any, Union, Mapping
|
||||
from email.errors import MessageDefect
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
|
||||
|
||||
@@ -6,8 +6,12 @@ from typing import (
|
||||
import sys
|
||||
from email.charset import Charset
|
||||
from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
from email.contentmanager import ContentManager
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
if sys.version_info >= (3, 4):
|
||||
from email.contentmanager import ContentManager
|
||||
else:
|
||||
ContentManager = object # Hack so we can reference it in argument types.
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -75,50 +79,21 @@ class Message:
|
||||
requote: bool = ..., charset: str = ...,
|
||||
language: str = ..., replace: bool = ...) -> None: ...
|
||||
else:
|
||||
def as_string(self, unixfrom: bool = ..., # type: ignore
|
||||
def as_string(self, unixfrom: bool = ...,
|
||||
maxheaderlen: int = ...) -> str: ...
|
||||
def set_param(self, param: str, value: str, # type: ignore
|
||||
def set_param(self, param: str, value: str,
|
||||
header: str = ..., requote: bool = ...,
|
||||
charset: str = ..., language: str = ...) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self) -> None: ... # type: ignore
|
||||
|
||||
class EmailMessage:
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
def get_body(self,
|
||||
preferencelist: Sequence[str] = ...) -> Optional[Message]: ...
|
||||
def iter_attachments(self) -> Iterator[Message]: ...
|
||||
def iter_parts(self) -> Iterator[Message]: ...
|
||||
def get_content(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> Any: ...
|
||||
def set_content(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
def make_related(self, boundary: Optional[str] = ...) -> None: ...
|
||||
def make_alternative(self, boundary: Optional[str] = ...) -> None: ...
|
||||
def make_mixed(self, boundary: Optional[str] = ...) -> None: ...
|
||||
def add_related(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
def add_alternative(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
def add_attachement(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def clear_content(self) -> None: ...
|
||||
if sys.version_info >= (3, 4, 2):
|
||||
def is_attachment(self) -> bool: ...
|
||||
else:
|
||||
@property
|
||||
def is_attachment(self) -> bool: ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class MIMEPart:
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self) -> None: ...
|
||||
def get_body(self,
|
||||
preferencelist: Sequence[str] = ...) -> Optional[Message]: ...
|
||||
def iter_attachments(self) -> Iterator[Message]: ...
|
||||
@@ -148,3 +123,8 @@ class MIMEPart:
|
||||
else:
|
||||
@property
|
||||
def is_attachment(self) -> bool: ...
|
||||
|
||||
class EmailMessage(MIMEPart):
|
||||
def set_content(self, *args: Any,
|
||||
content_manager: Optional[ContentManager] = ...,
|
||||
**kw: Any) -> None: ...
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
from typing import Callable, Optional, TextIO, BinaryIO
|
||||
import email.feedparser
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
import sys
|
||||
|
||||
FeedParser = email.feedparser.FeedParser
|
||||
@@ -15,7 +16,7 @@ class Parser:
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ...
|
||||
@@ -27,7 +28,7 @@ class HeaderParser(Parser):
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ...
|
||||
@@ -40,7 +41,7 @@ if sys.version_info >= (3, 3):
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ...
|
||||
@@ -53,7 +54,7 @@ if sys.version_info >= (3, 2):
|
||||
policy: Policy = ...) -> None: ...
|
||||
else:
|
||||
# TODO `strict` is positional
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
_class: Callable[[], Message] = ..., *,
|
||||
strict: Optional[bool]) -> None: ...
|
||||
def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ...
|
||||
|
||||
@@ -5,7 +5,8 @@ import sys
|
||||
from email.message import Message
|
||||
from email.errors import MessageDefect
|
||||
from email.header import Header
|
||||
from email.contentmanager import ContentManager
|
||||
if sys.version_info >= (3, 4):
|
||||
from email.contentmanager import ContentManager
|
||||
from abc import abstractmethod
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
|
||||
@@ -16,7 +16,7 @@ if sys.version_info >= (3, 5):
|
||||
def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] = ...,
|
||||
reverse: bool = ...) -> Iterable[_T]: ...
|
||||
else:
|
||||
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ... # type: ignore
|
||||
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
|
||||
def nlargest(n: int, iterable: Iterable[_T],
|
||||
key: Callable[[_T], Any] = ...) -> List[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T],
|
||||
|
||||
@@ -6,10 +6,10 @@ class HTMLParser(ParserBase):
|
||||
if sys.version_info >= (3, 5):
|
||||
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
|
||||
elif sys.version_info >= (3, 4):
|
||||
def __init__(self, strict: bool = ..., *, # type: ignore
|
||||
def __init__(self, strict: bool = ..., *,
|
||||
convert_charrefs: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, strict: bool = ...) -> None: ... # type: ignore
|
||||
def __init__(self, strict: bool = ...) -> None: ...
|
||||
def feed(self, feed: str) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@@ -146,13 +146,13 @@ class HTTPResponse(io.BufferedIOBase):
|
||||
|
||||
class HTTPConnection:
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...) \
|
||||
-> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
strict: bool = ..., timeout: int = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...) \
|
||||
@@ -174,7 +174,7 @@ class HTTPConnection:
|
||||
|
||||
class HTTPSConnection(HTTPConnection):
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
@@ -183,7 +183,7 @@ class HTTPSConnection(HTTPConnection):
|
||||
*, context: Optional[ssl.SSLContext] = ...,
|
||||
check_hostname: Optional[bool] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import abc
|
||||
from _importlib_modulespec import ModuleSpec
|
||||
if sys.version_info >= (3, 4):
|
||||
from _importlib_modulespec import ModuleSpec
|
||||
import sys
|
||||
import types
|
||||
from typing import Any, Mapping, Optional, Sequence, Tuple, Union
|
||||
|
||||
@@ -5,93 +5,147 @@ from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
# ModuleSpec is exported from this module, but for circular import
|
||||
# reasons exists in its own stub file (with Loader and ModuleType).
|
||||
from _importlib_modulespec import ModuleSpec # Exported
|
||||
if sys.version_info >= (3, 4):
|
||||
from _importlib_modulespec import ModuleSpec as ModuleSpec # Exported
|
||||
|
||||
class BuiltinImporter(importlib.abc.MetaPathFinder,
|
||||
importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
if sys.version_info >= (3, 3):
|
||||
class BuiltinImporter(importlib.abc.MetaPathFinder,
|
||||
importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]],
|
||||
target: types.ModuleType = None) -> Optional[ModuleSpec]:
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
def is_package(cls, fullname: str) -> bool: ...
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
@classmethod
|
||||
def get_code(cls, fullname: str) -> None: ... # type: ignore
|
||||
@classmethod
|
||||
def get_source(cls, fullname: str) -> None: ... # type: ignore
|
||||
# Loader
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@staticmethod
|
||||
def module_repr(module: types.ModuleType) -> str: ... # type: ignore
|
||||
if sys.version_info >= (3, 4):
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]],
|
||||
target: types.ModuleType = None) -> Optional[ModuleSpec]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]:
|
||||
def is_package(cls, fullname: str) -> bool: ...
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
@classmethod
|
||||
def get_code(cls, fullname: str) -> None: ... # type: ignore
|
||||
@classmethod
|
||||
def get_source(cls, fullname: str) -> None: ... # type: ignore
|
||||
# Loader
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@staticmethod
|
||||
def module_repr(module: types.ModuleType) -> str: ... # type: ignore
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]:
|
||||
...
|
||||
@classmethod
|
||||
def exec_module(cls, module: types.ModuleType) -> None: ...
|
||||
else:
|
||||
class BuiltinImporter(importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
def exec_module(cls, module: types.ModuleType) -> None: ...
|
||||
def is_package(cls, fullname: str) -> bool: ...
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
@classmethod
|
||||
def get_code(cls, fullname: str) -> None: ... # type: ignore
|
||||
@classmethod
|
||||
def get_source(cls, fullname: str) -> None: ... # type: ignore
|
||||
# Loader
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
|
||||
class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
if sys.version_info >= (3, 3):
|
||||
class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]],
|
||||
target: types.ModuleType = None) -> Optional[ModuleSpec]:
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
def is_package(cls, fullname: str) -> bool: ...
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
@classmethod
|
||||
def get_code(cls, fullname: str) -> None: ... # type: ignore
|
||||
@classmethod
|
||||
def get_source(cls, fullname: str) -> None: ... # type: ignore
|
||||
# Loader
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@staticmethod
|
||||
def module_repr(module: types.ModuleType) -> str: ... # type: ignore
|
||||
if sys.version_info >= (3, 4):
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]],
|
||||
target: types.ModuleType = None) -> Optional[ModuleSpec]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]:
|
||||
def is_package(cls, fullname: str) -> bool: ...
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
@classmethod
|
||||
def get_code(cls, fullname: str) -> None: ... # type: ignore
|
||||
@classmethod
|
||||
def get_source(cls, fullname: str) -> None: ... # type: ignore
|
||||
# Loader
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@staticmethod
|
||||
def module_repr(module: types.ModuleType) -> str: ... # type: ignore
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]:
|
||||
...
|
||||
@staticmethod
|
||||
def exec_module(module: types.ModuleType) -> None: ... # type: ignore
|
||||
else:
|
||||
class FrozenImporter(importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
@staticmethod
|
||||
def exec_module(module: types.ModuleType) -> None: ... # type: ignore
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
def is_package(cls, fullname: str) -> bool: ...
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
@classmethod
|
||||
def get_code(cls, fullname: str) -> None: ... # type: ignore
|
||||
@classmethod
|
||||
def get_source(cls, fullname: str) -> None: ... # type: ignore
|
||||
# Loader
|
||||
@classmethod
|
||||
def load_module(cls, fullname: str) -> types.ModuleType: ...
|
||||
|
||||
class WindowsRegisteryFinder(importlib.abc.MetaPathFinder):
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
if sys.version_info >= (3, 3):
|
||||
class WindowsRegisteryFinder(importlib.abc.MetaPathFinder):
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]],
|
||||
target: types.ModuleType = None) -> Optional[ModuleSpec]:
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]],
|
||||
target: types.ModuleType = None) -> Optional[ModuleSpec]:
|
||||
...
|
||||
else:
|
||||
class WindowsRegisteryFinder:
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
|
||||
class PathFinder(importlib.abc.MetaPathFinder): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class PathFinder(importlib.abc.MetaPathFinder): ...
|
||||
else:
|
||||
class PathFinder: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
SOURCE_SUFFIXES = ... # type: List[str]
|
||||
@@ -121,4 +175,4 @@ if sys.version_info >= (3, 3):
|
||||
|
||||
class ExtensionFileLoader(importlib.abc.ExecutionLoader):
|
||||
def get_filename(self, fullname: str) -> importlib.abc._Path: ...
|
||||
def get_source(self, fullname: str) -> None: ... # type: ignore
|
||||
def get_source(self, fullname: str) -> None: ... # type: ignore
|
||||
|
||||
@@ -52,11 +52,11 @@ class IOBase:
|
||||
def readline(self, size: int = ...) -> bytes: ...
|
||||
def __del__(self) -> None: ...
|
||||
else:
|
||||
def readline(self, limit: int = ...) -> bytes: ... # type: ignore
|
||||
def readline(self, limit: int = ...) -> bytes: ...
|
||||
if sys.version_info >= (3, 2):
|
||||
closed = ... # type: bool
|
||||
else:
|
||||
def closed(self) -> bool: ... # type: ignore
|
||||
def closed(self) -> bool: ...
|
||||
|
||||
class RawIOBase(IOBase):
|
||||
def readall(self) -> bytes: ...
|
||||
@@ -65,7 +65,7 @@ class RawIOBase(IOBase):
|
||||
if sys.version_info >= (3, 4):
|
||||
def read(self, size: int = ...) -> Optional[bytes]: ...
|
||||
else:
|
||||
def read(self, n: int = ...) -> Optional[bytes]: ... # type: ignore
|
||||
def read(self, n: int = ...) -> Optional[bytes]: ...
|
||||
|
||||
class BufferedIOBase(IOBase):
|
||||
def detach(self) -> RawIOBase: ...
|
||||
@@ -77,8 +77,8 @@ class BufferedIOBase(IOBase):
|
||||
def read(self, size: Optional[int] = ...) -> bytes: ...
|
||||
def read1(self, size: int = ...) -> bytes: ...
|
||||
else:
|
||||
def read(self, n: Optional[int] = ...) -> bytes: ... # type: ignore
|
||||
def read1(self, n: int = ...) -> bytes: ... # type: ignore
|
||||
def read(self, n: Optional[int] = ...) -> bytes: ...
|
||||
def read1(self, n: int = ...) -> bytes: ...
|
||||
|
||||
|
||||
class FileIO(RawIOBase):
|
||||
@@ -91,7 +91,7 @@ class FileIO(RawIOBase):
|
||||
Callable[[Union[int, str], str], int]] = ...) \
|
||||
-> None: ...
|
||||
else:
|
||||
def __init__(self, name: Union[str, bytes, int], # type: ignore
|
||||
def __init__(self, name: Union[str, bytes, int],
|
||||
mode: str = ..., closefd: bool = ...) -> None: ...
|
||||
|
||||
# TODO should extend from BufferedIOBase
|
||||
@@ -124,11 +124,11 @@ class BytesIO(BinaryIO):
|
||||
def readline(self, size: int = ...) -> bytes: ...
|
||||
def __del__(self) -> None: ...
|
||||
else:
|
||||
def readline(self, limit: int = ...): ... # type: ignore
|
||||
def readline(self, limit: int = ...): ...
|
||||
if sys.version_info >= (3, 2):
|
||||
closed = ... # type: bool
|
||||
else:
|
||||
def closed(self) -> bool: ... # type: ignore
|
||||
def closed(self) -> bool: ...
|
||||
# copied from BufferedIOBase
|
||||
def detach(self) -> RawIOBase: ...
|
||||
def readinto(self, b: bytearray) -> int: ...
|
||||
@@ -139,15 +139,15 @@ class BytesIO(BinaryIO):
|
||||
def read(self, size: Optional[int] = ...) -> bytes: ...
|
||||
def read1(self, size: int = ...) -> bytes: ...
|
||||
else:
|
||||
def read(self, n: Optional[int] = ...) -> bytes: ... # type: ignore
|
||||
def read1(self, n: int = ...) -> bytes: ... # type: ignore
|
||||
def read(self, n: Optional[int] = ...) -> bytes: ...
|
||||
def read1(self, n: int = ...) -> bytes: ...
|
||||
|
||||
class BufferedReader(BufferedIOBase):
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def peek(self, size: int = ...) -> bytes: ...
|
||||
else:
|
||||
def peek(self, n: int = ...) -> bytes: ... # type: ignore
|
||||
def peek(self, n: int = ...) -> bytes: ...
|
||||
|
||||
class BufferedWriter(BufferedIOBase):
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
|
||||
@@ -179,7 +179,7 @@ class TextIOBase(IOBase):
|
||||
elif sys.version_info >= (3, 2):
|
||||
def readline(self, limit: int = ...) -> str: ... # type: ignore
|
||||
else:
|
||||
def readline(self) -> str: ... # type: ignore
|
||||
def readline(self) -> str: ...
|
||||
if sys.version_info >= (3, 2):
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def tell(self) -> int: ...
|
||||
@@ -194,7 +194,7 @@ class TextIOWrapper(TextIO):
|
||||
# line_buffering: bool = ..., write_through: bool = ...) \
|
||||
# -> None: ...
|
||||
#else:
|
||||
# def __init__(self, buffer: IO[bytes], # type: ignore
|
||||
# def __init__(self, buffer: IO[bytes],
|
||||
# encoding: str = ..., errors: Optional[str] = ...,
|
||||
# newline: Optional[str] = ..., line_buffering: bool = ...) \
|
||||
# -> None: ...
|
||||
@@ -222,23 +222,23 @@ class TextIOWrapper(TextIO):
|
||||
if sys.version_info >= (3, 2):
|
||||
closed = ... # type: bool
|
||||
else:
|
||||
def closed(self) -> bool: ... # type: ignore
|
||||
def closed(self) -> bool: ...
|
||||
# copied from TextIOBase
|
||||
encoding = ... # type: str
|
||||
errors = ... # type: Optional[str]
|
||||
newlines = ... # type: Union[str, Tuple[str, ...], None]
|
||||
def __iter__(self) -> Iterator[str]: ... # type: ignore
|
||||
def __next__(self) -> str: ... # type: ignore
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __next__(self) -> str: ...
|
||||
def __enter__(self) -> 'TextIO': ...
|
||||
def detach(self) -> IOBase: ...
|
||||
def write(self, s: str) -> int: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def readline(self, size: int = ...) -> str: ... # type: ignore
|
||||
def readline(self, size: int = ...) -> str: ...
|
||||
def read(self, size: Optional[int] = ...) -> str: ...
|
||||
elif sys.version_info >= (3, 2):
|
||||
def readline(self, limit: int = ...) -> str: ... # type: ignore
|
||||
def readline(self, limit: int = ...) -> str: ...
|
||||
else:
|
||||
def readline(self) -> str: ... # type: ignore
|
||||
def readline(self) -> str: ...
|
||||
if sys.version_info >= (3, 2):
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def tell(self) -> int: ...
|
||||
|
||||
@@ -15,9 +15,9 @@ _PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes]
|
||||
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
_SC1ArgT = Union['SSLSocket', 'SSLObject']
|
||||
_SC1ArgT = Union[SSLSocket, SSLObject]
|
||||
else:
|
||||
_SC1ArgT = 'SSLSocket'
|
||||
_SC1ArgT = SSLSocket
|
||||
_SrvnmeCbType = Callable[[_SC1ArgT, Optional[str], 'SSLSocket'], Optional[int]]
|
||||
|
||||
class SSLError(OSError):
|
||||
@@ -202,7 +202,7 @@ class SSLContext:
|
||||
binary_form: bool = ...) \
|
||||
-> Union[List[_PeerCertRetDictType], List[bytes]]: ...
|
||||
else:
|
||||
def load_verify_locations(self, # type: ignore
|
||||
def load_verify_locations(self,
|
||||
cafile: Optional[str] = ...,
|
||||
capath: Optional[str] = ...) -> None: ...
|
||||
def set_default_verify_paths(self) -> None: ...
|
||||
|
||||
@@ -232,7 +232,7 @@ class TestLoader:
|
||||
def loadTestsFromModule(self, module: ModuleType,
|
||||
*, pattern: Any = ...) -> TestSuite: ...
|
||||
else:
|
||||
def loadTestsFromModule(self, # type: ignore
|
||||
def loadTestsFromModule(self,
|
||||
module: ModuleType) -> TestSuite: ...
|
||||
def loadTestsFromName(self, name: str,
|
||||
module: Optional[ModuleType] = ...) -> TestSuite: ...
|
||||
@@ -297,7 +297,7 @@ class TextTestRunner(TestRunner):
|
||||
warnings: Optional[Type[Warning]] = ...,
|
||||
*, tb_locals: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
stream: Optional[TextIO] = ...,
|
||||
descriptions: bool = ..., verbosity: int = ...,
|
||||
failfast: bool = ..., buffer: bool = ...,
|
||||
@@ -308,7 +308,7 @@ class TextTestRunner(TestRunner):
|
||||
if sys.version_info >= (3, 4):
|
||||
_DefaultTestType = Union[str, Iterable[str], None]
|
||||
else:
|
||||
_DefaultTestType = Optional[str]
|
||||
_DefaultTestType = Union[str, None]
|
||||
|
||||
# not really documented
|
||||
class TestProgram:
|
||||
|
||||
@@ -38,7 +38,7 @@ class Request:
|
||||
@full_url.deleter
|
||||
def full_url(self) -> None: ...
|
||||
else:
|
||||
full_url = ... # type: ignore # type: str
|
||||
full_url = ... # type: str
|
||||
type = ... # type: str
|
||||
host = ... # type: str
|
||||
origin_req_host = ... # type: str
|
||||
|
||||
Reference in New Issue
Block a user