Various stubtest fixes (#5230)

This commit is contained in:
hatal175
2021-04-18 19:30:00 +03:00
committed by GitHub
parent f44f38fda3
commit fbf21995e3
14 changed files with 46 additions and 46 deletions

View File

@@ -1,7 +1,7 @@
import _random
import sys
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set
from typing import Any, Optional, Tuple, TypeVar, Union
from typing import Any, NoReturn, Optional, Tuple, TypeVar, Union
_T = TypeVar("_T")
@@ -45,7 +45,9 @@ class Random(_random.Random):
def weibullvariate(self, alpha: float, beta: float) -> float: ...
# SystemRandom is not implemented for all OS's; good on Windows & Linux
class SystemRandom(Random): ...
class SystemRandom(Random):
def getstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
def setstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
# ----- random function stubs -----
def seed(a: Any = ..., version: int = ...) -> None: ...

View File

@@ -1,5 +1,6 @@
import enum
import sys
from sre_constants import error as error
from typing import Any, AnyStr, Callable, Iterator, List, Optional, Tuple, Union, overload
# ----- re variables and constants -----
@@ -50,13 +51,6 @@ if sys.version_info < (3, 7):
# undocumented
_pattern_type: type
class error(Exception):
msg: str
pattern: str
pos: Optional[int]
lineno: Optional[int]
colno: Optional[int]
@overload
def compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]: ...
@overload

View File

@@ -19,4 +19,4 @@ class _ModifiedArgv0:
def run_module(
mod_name: str, init_globals: Optional[Dict[str, Any]] = ..., run_name: Optional[str] = ..., alter_sys: bool = ...
) -> Dict[str, Any]: ...
def run_path(path_name: str, init_globals: Optional[Dict[str, Any]] = ..., run_name: str = ...) -> Dict[str, Any]: ...
def run_path(path_name: str, init_globals: Optional[Dict[str, Any]] = ..., run_name: Optional[str] = ...) -> Dict[str, Any]: ...

View File

@@ -159,7 +159,11 @@ if sys.version_info >= (3,):
# See http://bugs.python.org/issue30218
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
def register_unpack_format(
name: str, extensions: List[str], function: Any, extra_args: Sequence[Tuple[str, Any]] = ..., description: str = ...
name: str,
extensions: List[str],
function: Any,
extra_args: Optional[Sequence[Tuple[str, Any]]] = ...,
description: str = ...,
) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...

View File

@@ -84,5 +84,21 @@ class SMTPServer(asyncore.dispatcher):
) -> Optional[str]: ...
class DebuggingServer(SMTPServer): ...
class PureProxy(SMTPServer): ...
class MailmanProxy(PureProxy): ...
class PureProxy(SMTPServer):
def process_message( # type: ignore
self,
peer: _Address,
mailfrom: str,
rcpttos: List[Text],
data: Union[bytes, str],
) -> Optional[str]: ...
class MailmanProxy(PureProxy):
def process_message( # type: ignore
self,
peer: _Address,
mailfrom: str,
rcpttos: List[Text],
data: Union[bytes, str],
) -> Optional[str]: ...

View File

@@ -124,7 +124,7 @@ class SMTP:
msg: _Message,
from_addr: Optional[str] = ...,
to_addrs: Optional[Union[str, Sequence[str]]] = ...,
mail_options: List[str] = ...,
mail_options: Sequence[str] = ...,
rcpt_options: Sequence[str] = ...,
) -> _SendErrs: ...
def close(self) -> None: ...

View File

@@ -16,7 +16,7 @@ def DateFromTicks(ticks: float) -> Date: ...
def TimeFromTicks(ticks: float) -> Time: ...
def TimestampFromTicks(ticks: float) -> Timestamp: ...
version_info: str
version_info: Tuple[int, int, int]
sqlite_version_info: Tuple[int, int, int]
if sys.version_info >= (3,):
Binary = memoryview
@@ -289,7 +289,7 @@ class Row(object):
def __hash__(self): ...
def __iter__(self): ...
def __le__(self, other): ...
def __len__(self, *args: Any, **kwargs: Any): ...
def __len__(self): ...
def __lt__(self, other): ...
def __ne__(self, other): ...

View File

@@ -8,7 +8,7 @@ class error(Exception):
pos: Optional[int]
lineno: int
colno: int
def __init__(self, msg: str, pattern: Union[str, bytes] = ..., pos: int = ...) -> None: ...
def __init__(self, msg: str, pattern: Optional[Union[str, bytes]] = ..., pos: Optional[int] = ...) -> None: ...
class _NamedIntConstant(int):
name: Any

View File

@@ -66,14 +66,11 @@ class Au_write:
def getframerate(self) -> int: ...
def setnframes(self, nframes: int) -> None: ...
def getnframes(self) -> int: ...
def setcomptype(self, comptype: str, compname: str) -> None: ...
def setcomptype(self, type: str, name: str) -> None: ...
def getcomptype(self) -> str: ...
def getcompname(self) -> str: ...
def setparams(self, params: _sunau_params) -> None: ...
def getparams(self) -> _sunau_params: ...
def setmark(self, id: Any, pos: Any, name: Any) -> NoReturn: ...
def getmark(self, id: Any) -> NoReturn: ...
def getmarkers(self) -> None: ...
def tell(self) -> int: ...
# should be any bytes-like object after 3.4, but we don't have a type for that
def writeframesraw(self, data: bytes) -> None: ...

View File

@@ -37,6 +37,7 @@ plistlib.Dict.__init__
pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args
random.Random.randrange # missing undocumented arg _int
random.randrange # missing undocumented arg _int
sched.Event.__doc__ # __slots__ is overridden
secrets.SystemRandom.getstate
smtplib.SMTP.sendmail
sre_compile.dis

View File

@@ -47,6 +47,7 @@ pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - funct
queue.SimpleQueue.__init__
random.Random.randrange # missing undocumented arg _int
random.randrange # missing undocumented arg _int
sched.Event.__doc__ # __slots__ is overridden
secrets.SystemRandom.getstate
smtplib.SMTP.sendmail
sre_constants.RANGE_IGNORE

View File

@@ -70,6 +70,7 @@ platform.DEV_NULL
queue.SimpleQueue.__init__
random.Random.randrange # missing undocumented arg _int
random.randrange # missing undocumented arg _int
sched.Event.__doc__ # __slots__ is overridden
secrets.SystemRandom.getstate
select.epoll.register
smtplib.SMTP.sendmail

View File

@@ -90,6 +90,7 @@ platform.uname_result.__new__
platform.uname_result._fields
platform.uname_result.processor
queue.SimpleQueue.__init__
sched.Event.__doc__ # __slots__ is overridden
secrets.SystemRandom.getstate
select.epoll.register
smtplib.LMTP.__init__

View File

@@ -213,35 +213,18 @@ pydoc.TextDoc.docmodule
pydoc.TextDoc.docother
pydoc.TextDoc.docproperty
pydoc.TextDoc.docroutine
random.SystemRandom.getstate
re.error.__init__
runpy.run_path
sched.Event.__doc__
select.poll
selectors.DevpollSelector
selectors.KqueueSelector
shutil.register_unpack_format
signal.SIGEMT
signal.SIGINFO
smtpd.MailmanProxy.process_message
smtpd.PureProxy.process_message
smtplib.SMTP.send_message
socketserver.BaseServer.fileno
socketserver.BaseServer.get_request
socketserver.BaseServer.server_bind
sqlite3.Row.__len__
sqlite3.dbapi2.Row.__len__
sqlite3.dbapi2.version_info
sqlite3.version_info
sre_constants.error.__init__
select.poll # Depends on configuration
selectors.DevpollSelector # Depends on configuration
selectors.KqueueSelector # Depends on system
signal.SIGEMT # Depends on system
signal.SIGINFO # Depends on system
socketserver.BaseServer.fileno # implemented in derived classes
socketserver.BaseServer.get_request # implemented in derived classes
socketserver.BaseServer.server_bind # implemented in derived classes
ssl.PROTOCOL_SSLv2 # Defined only if compiled with ssl v2
ssl.Purpose.__new__ # You cannot override __new__ in NamedTuple and runtime uses namedtuple.
ssl._ASN1Object.__new__ # You cannot override __new__ in NamedTuple and runtime uses namedtuple.
subprocess.Popen.__init__
sunau.Au_write.getmark
sunau.Au_write.getmarkers
sunau.Au_write.setcomptype
sunau.Au_write.setmark
sys.gettotalrefcount # Available on python debug builds
sys.implementation # Actually SimpleNamespace but then you wouldn't have convenient attributes
tarfile.TarFile.errors # errors is initialized for some reason as None even though it really only accepts str