mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 10:51:15 +08:00
Various stubtest fixes (#5230)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -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]]: ...
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user