mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-20 18:14:26 +08:00
Mypy now supports sys.platform and sys.version_info checks (#410)
This commit is contained in:
@@ -34,7 +34,7 @@ class ArgumentParser:
|
||||
add_help: bool = ...,
|
||||
allow_abbrev: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
prog: Optional[str] = ...,
|
||||
usage: Optional[str] = ...,
|
||||
description: Optional[str] = ...,
|
||||
@@ -122,10 +122,10 @@ class FileType:
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
mode: str = ..., bufsize: int = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
mode: str = ..., bufsize: Optional[int] = ...) -> None: ...
|
||||
def __call__(self, string: str) -> IO[Any]: ...
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ if sys.version_info >= (3, 4):
|
||||
def new(key: _B, msg: Optional[_B] = ...,
|
||||
digestmod: Optional[Union[str, Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ...
|
||||
else:
|
||||
def new( # type: ignore
|
||||
key: _B, msg: Optional[_B] = ...,
|
||||
def new(key: _B, msg: Optional[_B] = ...,
|
||||
digestmod: Optional[Union[Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ...
|
||||
|
||||
class HMAC:
|
||||
|
||||
@@ -50,28 +50,27 @@ class Logger:
|
||||
stack_info: bool = ..., extra: Dict[str, Any] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
else:
|
||||
def debug(self, # type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def debug(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def info(self, # type: ignore
|
||||
def info(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def warning(self, # type: ignore
|
||||
def warning(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def warn(self, # type: ignore
|
||||
def warn(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def error(self, # type: ignore
|
||||
def error(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def critical(self, # type: ignore
|
||||
def critical(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def log(self, # type: ignore
|
||||
def log(self,
|
||||
lvl: int, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def exception(self, # type: ignore
|
||||
def exception(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def addFilter(self, filt: _FilterType) -> None: ...
|
||||
@@ -82,8 +81,7 @@ class Logger:
|
||||
if sys.version_info >= (3,):
|
||||
def findCaller(self, stack_info: bool = ...) -> Tuple[str, int, str, Optional[str]]: ...
|
||||
else:
|
||||
def findCaller(self # type: ignore
|
||||
) -> Tuple[str, int, str]: ...
|
||||
def findCaller(self) -> Tuple[str, int, str]: ...
|
||||
def handle(self, record: 'LogRecord') -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def makeRecord(self, name: str, lvl: int, fn: str, lno: int, msg: Text,
|
||||
@@ -93,7 +91,7 @@ class Logger:
|
||||
extra: Optional[Mapping[str, Any]] = ...,
|
||||
sinfo: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def makeRecord(self, # type: ignore
|
||||
def makeRecord(self,
|
||||
name: str, lvl: int, fn: str, lno: int, msg: Text,
|
||||
args: Mapping[str, Any],
|
||||
exc_info: Optional[_SysExcInfoType],
|
||||
@@ -136,7 +134,7 @@ class Formatter:
|
||||
datefmt: Optional[str] =...,
|
||||
style: str = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
fmt: Optional[str] = ...,
|
||||
datefmt: Optional[str] =...) -> None: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
@@ -181,7 +179,7 @@ class LogRecord:
|
||||
func: Optional[str] = ...,
|
||||
sinfo: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
name: str, level: int, pathname: str, lineno: int,
|
||||
msg: Text, args: _ArgsType,
|
||||
exc_info: Optional[_SysExcInfoType],
|
||||
@@ -215,25 +213,25 @@ class LoggerAdapter:
|
||||
stack_info: bool = ..., extra: Dict[str, Any] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
else:
|
||||
def debug(self, # type: ignore
|
||||
def debug(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def info(self, # type: ignore
|
||||
def info(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def warning(self, # type: ignore
|
||||
def warning(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def error(self, # type: ignore
|
||||
def error(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def exception(self, # type: ignore
|
||||
def exception(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def critical(self, # type: ignore
|
||||
def critical(self,
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def log(self, # type: ignore
|
||||
def log(self,
|
||||
lvl: int, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def isEnabledFor(self, lvl: int) -> None: ...
|
||||
@@ -282,29 +280,21 @@ if sys.version_info > (3,):
|
||||
stack_info: bool = ..., extra: Dict[str, Any] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
else:
|
||||
def debug(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def debug(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def info(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def info(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def warning(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def warning(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def warn(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def warn(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def error(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def error(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def critical(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def critical(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def exception(# type: ignore
|
||||
msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def exception(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
def log(# type: ignore
|
||||
lvl: int, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
def log(lvl: int, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
extra: Dict[str, Any] = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
def disable(lvl: int) -> None: ...
|
||||
|
||||
@@ -19,10 +19,8 @@ if sys.version_info >= (3, 4):
|
||||
def listen(port: int = ...,
|
||||
verify: Optional[Callable[[bytes], Optional[bytes]]] = ...) -> None: ...
|
||||
else:
|
||||
def fileConfig( # type: ignore
|
||||
fname: Union[str, IO[str]],
|
||||
def fileConfig(fname: Union[str, IO[str]],
|
||||
defaults: Optional[Dict[str, str]] = ...,
|
||||
disable_existing_loggers: bool = ...) -> None: ...
|
||||
def listen( # type: ignore
|
||||
port: int = ...) -> None: ...
|
||||
def listen(port: int = ...) -> None: ...
|
||||
def stopListening() -> None: ...
|
||||
|
||||
@@ -40,61 +40,41 @@ if sys.version_info >= (3,):
|
||||
def rotate(self, source: str, dest: str) -> None: ...
|
||||
|
||||
|
||||
# TODO uncomment when mypy handle conditionals
|
||||
#if sys.version_info >= (3,):
|
||||
# class RotatingFileHandler(BaseRotatingHandler):
|
||||
# def __init__(self, filename: str, mode: str = ..., maxBytes: int = ...,
|
||||
# backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
# delay: bool = ...) -> None: ...
|
||||
# def doRollover(self) -> None: ...
|
||||
#else:
|
||||
# class RotatingFileHandler(Handler):
|
||||
# def __init__(self, filename: str, mode: str = ..., maxBytes: int = ...,
|
||||
# backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
# delay: bool = ...) -> None: ...
|
||||
# def doRollover(self) -> None: ...
|
||||
class RotatingFileHandler(BaseRotatingHandler):
|
||||
def __init__(self, filename: str, mode: str = ..., maxBytes: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
|
||||
# TODO uncomment when mypy handle conditionals
|
||||
#if sys.version_info >= (3,):
|
||||
# class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
# if sys.version_info >= (3, 4):
|
||||
# def __init__(self, filename: str, when: str = ...,
|
||||
# interval: int = ...,
|
||||
# backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
# delay: bool = ..., utc: bool = ...,
|
||||
# atTime: Optional[datetime.datetime] = ...) -> None: ...
|
||||
# else:
|
||||
# def __init__(self, # type: ignore
|
||||
# filename: str, when: str = ..., interval: int = ...,
|
||||
# backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
# delay: bool = ..., utc: bool = ...) -> None: ...
|
||||
# def doRollover(self) -> None: ...
|
||||
#else:
|
||||
# class TimedRotatingFileHandler:
|
||||
# def __init__(self, # type: ignore
|
||||
# filename: str, when: str = ..., interval: int = ...,
|
||||
# backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
# delay: bool = ..., utc: bool = ...) -> None: ...
|
||||
# def doRollover(self) -> None: ...
|
||||
class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, filename: str, when: str = ...,
|
||||
interval: int = ...,
|
||||
if sys.version_info >= (3,):
|
||||
class RotatingFileHandler(BaseRotatingHandler):
|
||||
def __init__(self, filename: str, mode: str = ..., maxBytes: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...,
|
||||
atTime: Optional[datetime.datetime] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
delay: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
else:
|
||||
class RotatingFileHandler(Handler):
|
||||
def __init__(self, filename: str, mode: str = ..., maxBytes: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, filename: str, when: str = ...,
|
||||
interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...,
|
||||
atTime: Optional[datetime.datetime] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
filename: str, when: str = ..., interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
else:
|
||||
class TimedRotatingFileHandler:
|
||||
def __init__(self,
|
||||
filename: str, when: str = ..., interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
|
||||
class SocketHandler(Handler):
|
||||
@@ -104,7 +84,7 @@ class SocketHandler(Handler):
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, host: str, port: Optional[int]) -> None: ...
|
||||
else:
|
||||
def __init__(self, host: str, port: int) -> None: ... # type: ignore
|
||||
def __init__(self, host: str, port: int) -> None: ...
|
||||
def makeSocket(self) -> SocketType: ...
|
||||
def makePickle(self, record: LogRecord) -> bytes: ...
|
||||
def send(self, packet: bytes) -> None: ...
|
||||
@@ -168,7 +148,7 @@ class SMTPHandler(Handler):
|
||||
secure: Union[Tuple[str], Tuple[str, str], None] =...,
|
||||
timeout: float = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
mailhost: Union[str, Tuple[str, int]], fromaddr: str,
|
||||
toaddrs: List[str], subject: str,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
@@ -193,11 +173,11 @@ class HTTPHandler(Handler):
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
context: Optional[ssl.SSLContext] = ...) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
host: str, url: str, method: str = ..., secure: bool = ...,
|
||||
credentials: Optional[Tuple[str, str]] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
host: str, url: str, method: str = ...) -> None: ...
|
||||
def mapLogRecord(self, record: LogRecord) -> Dict[str, Any]: ...
|
||||
|
||||
@@ -213,7 +193,7 @@ if sys.version_info > (3,):
|
||||
def __init__(self, queue: Queue, *handlers: Handler,
|
||||
respect_handler_level: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, # type: ignore
|
||||
def __init__(self,
|
||||
queue: Queue, *handlers: Handler) -> None: ...
|
||||
def dequeue(self, block: bool) -> LogRecord: ...
|
||||
def prepare(self, record: LogRecord) -> Any: ...
|
||||
|
||||
@@ -32,7 +32,7 @@ def factorial(x: int) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def floor(x: float) -> int: ...
|
||||
else:
|
||||
def floor(x: float) -> float: ... # type: ignore
|
||||
def floor(x: float) -> float: ...
|
||||
def fmod(x: float, y: float) -> float: ...
|
||||
def frexp(x: float) -> Tuple[float, int]: ...
|
||||
def fsum(iterable: Iterable) -> float: ...
|
||||
|
||||
@@ -46,7 +46,7 @@ class ZipFile:
|
||||
def writestr(self, zinfo_or_arcname: _SZI, data: Union[bytes, str],
|
||||
compress_type: Optional[int] = ...) -> None: ...
|
||||
else:
|
||||
def writestr(self, # type: ignore
|
||||
def writestr(self,
|
||||
zinfo_or_arcname: _SZI, bytes: bytes,
|
||||
compress_type: Optional[int] = ...) -> None: ...
|
||||
|
||||
@@ -58,7 +58,7 @@ class PyZipFile(ZipFile):
|
||||
def writepy(self, pathname: str, basename: str = ...,
|
||||
filterfunc: Optional[Callable[[str], bool]] = ...) -> None: ...
|
||||
else:
|
||||
def writepy(self, # type: ignore
|
||||
def writepy(self,
|
||||
pathname: str, basename: str = ...) -> None: ...
|
||||
|
||||
class ZipInfo:
|
||||
|
||||
@@ -81,7 +81,7 @@ from asyncio.locks import (
|
||||
# See https://github.com/python/mypy/issues/1843
|
||||
SelectorEventLoop = ... # type: Type[AbstractEventLoop]
|
||||
if sys.platform == 'win32':
|
||||
ProactorEventLoop = ... # type: Type[AbstractEventLoop] # TODO: Windows only
|
||||
ProactorEventLoop = ... # type: Type[AbstractEventLoop]
|
||||
DefaultEventLoopPolicy = ... # type: Type[AbstractEventLoopPolicy]
|
||||
|
||||
# TODO: AbstractChildWatcher (UNIX only)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -117,6 +117,7 @@ def main():
|
||||
runs += 1
|
||||
flags = ['--python-version', '%d.%d' % (major, minor)]
|
||||
flags.append('--strict-optional')
|
||||
##flags.append('--warn-unused-ignores')
|
||||
sys.argv = ['mypy'] + flags + files
|
||||
if args.verbose:
|
||||
print("running", ' '.join(sys.argv))
|
||||
|
||||
6
third_party/3/pkg_resources.pyi
vendored
6
third_party/3/pkg_resources.pyi
vendored
@@ -6,6 +6,7 @@ from typing import (
|
||||
TypeVar, overload,
|
||||
)
|
||||
import importlib.abc
|
||||
import sys
|
||||
import types
|
||||
import zipimport
|
||||
|
||||
@@ -244,7 +245,10 @@ class ExtractionError(Exception):
|
||||
original_error = ... # type: Exception
|
||||
|
||||
|
||||
class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): ...
|
||||
else:
|
||||
class _Importer(importlib.abc.InspectLoader): ...
|
||||
|
||||
def register_finder(importer_type: type,
|
||||
distribution_finder: _DistFinderType) -> None : ...
|
||||
|
||||
Reference in New Issue
Block a user