Restore stubtest 0.930 (#6663)

This commit is contained in:
Sebastian Rittau
2021-12-23 05:18:19 +01:00
committed by GitHub
parent 9bf2ceb963
commit 3fb2bcd4c1
51 changed files with 478 additions and 123 deletions

View File

@@ -1,10 +1,8 @@
from typing import Tuple
IMPORT_MAPPING: dict[str, str]
NAME_MAPPING: dict[tuple[str, str], tuple[str, str]]
PYTHON2_EXCEPTIONS: Tuple[str, ...]
MULTIPROCESSING_EXCEPTIONS: Tuple[str, ...]
PYTHON2_EXCEPTIONS: tuple[str, ...]
MULTIPROCESSING_EXCEPTIONS: tuple[str, ...]
REVERSE_IMPORT_MAPPING: dict[str, str]
REVERSE_NAME_MAPPING: dict[tuple[str, str], tuple[str, str]]
PYTHON3_OSERROR_EXCEPTIONS: Tuple[str, ...]
PYTHON3_IMPORTERROR_EXCEPTIONS: Tuple[str, ...]
PYTHON3_OSERROR_EXCEPTIONS: tuple[str, ...]
PYTHON3_IMPORTERROR_EXCEPTIONS: tuple[str, ...]

View File

@@ -1,7 +1,11 @@
import sys
import types
from importlib.machinery import ModuleSpec
from typing import Any
if sys.version_info >= (3, 7):
check_hash_based_pycs: str
def create_builtin(__spec: ModuleSpec) -> types.ModuleType: ...
def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> None: ...
def acquire_lock() -> None: ...

View File

@@ -13,7 +13,7 @@ _INITPRE: str # undocumented
def _find_executable(executable: str, path: str | None = ...) -> str | None: ... # undocumented
if sys.version_info >= (3, 7):
if sys.version_info >= (3, 8):
def _read_output(commandstring: str, capture_stderr: bool = ...) -> str | None: ... # undocumented
else:

View File

@@ -5,14 +5,17 @@ from typing import IO, Any, Callable, ClassVar, NoReturn, Type
from . import events, futures, proactor_events, selector_events, streams, windows_utils
__all__ = [
"SelectorEventLoop",
"ProactorEventLoop",
"IocpProactor",
"DefaultEventLoopPolicy",
"WindowsSelectorEventLoopPolicy",
"WindowsProactorEventLoopPolicy",
]
if sys.version_info >= (3, 7):
__all__ = (
"SelectorEventLoop",
"ProactorEventLoop",
"IocpProactor",
"DefaultEventLoopPolicy",
"WindowsSelectorEventLoopPolicy",
"WindowsProactorEventLoopPolicy",
)
else:
__all__ = ["SelectorEventLoop", "ProactorEventLoop", "IocpProactor", "DefaultEventLoopPolicy"]
NULL: int
INFINITE: int

View File

@@ -1,5 +1,7 @@
from _curses import _CursesWindow
version: str
class _Curses_Panel: # type is <class '_curses_panel.curses panel'> (note the space in the class name)
def above(self) -> _Curses_Panel: ...
def below(self) -> _Curses_Panel: ...

View File

@@ -6,6 +6,8 @@ _T = TypeVar("_T")
_KeyType = Union[str, bytes]
_ValueType = Union[str, bytes]
open_flags: str
class error(OSError): ...
# Actual typename gdbm, not exposed by the implementation

View File

@@ -1,4 +1,5 @@
import numbers
import sys
from types import TracebackType
from typing import Any, Container, NamedTuple, Sequence, Tuple, Type, TypeVar, Union, overload
@@ -21,6 +22,8 @@ ROUND_UP: str
ROUND_HALF_DOWN: str
ROUND_05UP: str
if sys.version_info >= (3, 7):
HAVE_CONTEXTVAR: bool
HAVE_THREADS: bool
MAX_EMAX: int
MAX_PREC: int

View File

@@ -0,0 +1,40 @@
from . import (
bdist_dumb as bdist_dumb,
bdist_rpm as bdist_rpm,
build as build,
build_clib as build_clib,
build_ext as build_ext,
build_py as build_py,
build_scripts as build_scripts,
check as check,
clean as clean,
install as install,
install_data as install_data,
install_headers as install_headers,
install_lib as install_lib,
register as register,
sdist as sdist,
upload as upload,
)
__all__ = [
"build",
"build_py",
"build_ext",
"build_clib",
"build_scripts",
"clean",
"install",
"install_lib",
"install_headers",
"install_scripts",
"install_data",
"sdist",
"register",
"bdist",
"bdist_dumb",
"bdist_rpm",
"bdist_wininst",
"check",
"upload",
]

View File

@@ -7,6 +7,9 @@ from typing import Any, AnyStr, Callable, Union, overload
_Hash = Any
_DigestMod = Union[str, Callable[[], _Hash], ModuleType]
trans_5C: bytes
trans_36: bytes
digest_size: None
if sys.version_info >= (3, 8):

View File

@@ -53,6 +53,8 @@ CO_ITERABLE_COROUTINE: int
CO_ASYNC_GENERATOR: int
TPFLAGS_IS_ABSTRACT: int
modulesbyfile: dict[str, Any]
def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> list[tuple[str, Any]]: ...
def getmodulename(path: str) -> str | None: ...
def ismodule(object: object) -> TypeGuard[ModuleType]: ...

View File

@@ -1,4 +1,10 @@
from typing import Any, Callable, Iterator
from typing import Any, Callable, Iterator, Pattern
ESCAPE: Pattern[str]
ESCAPE_ASCII: Pattern[str]
HAS_UTF8: Pattern[bytes]
ESCAPE_DCT: dict[str, str]
INFINITY: float
def py_encode_basestring(s: str) -> str: ... # undocumented
def py_encode_basestring_ascii(s: str) -> str: ... # undocumented

View File

@@ -1,3 +1,5 @@
import sys
ENDMARKER: int
NAME: int
NUMBER: int
@@ -57,6 +59,8 @@ ATEQUAL: int
AWAIT: int
ASYNC: int
ERRORTOKEN: int
if sys.version_info >= (3, 7):
COLONEQUAL: int
N_TOKENS: int
NT_OFFSET: int
tok_name: dict[int, str]

View File

@@ -13,6 +13,7 @@ if sys.platform != "win32":
POLLOUT: int
POLLPRI: int
POLLRDBAND: int
POLLRDHUP: int
POLLRDNORM: int
POLLWRBAND: int
POLLWRNORM: int
@@ -118,6 +119,7 @@ if sys.platform == "linux":
@classmethod
def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ...
EPOLLERR: int
EPOLLEXCLUSIVE: int
EPOLLET: int
EPOLLHUP: int
EPOLLIN: int
@@ -126,10 +128,12 @@ if sys.platform == "linux":
EPOLLOUT: int
EPOLLPRI: int
EPOLLRDBAND: int
EPOLLRDHUP: int
EPOLLRDNORM: int
EPOLLWRBAND: int
EPOLLWRNORM: int
EPOLL_RDHUP: int
EPOLL_CLOEXEC: int
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
# Solaris only

View File

@@ -40,6 +40,8 @@ if sys.version_info >= (3, 7):
SQLITE_DELETE: int
SQLITE_DENY: int
SQLITE_DETACH: int
if sys.version_info >= (3, 7):
SQLITE_DONE: int
SQLITE_DROP_INDEX: int
SQLITE_DROP_TABLE: int
SQLITE_DROP_TEMP_INDEX: int

View File

@@ -1,18 +1,5 @@
from sre_constants import (
SRE_FLAG_ASCII as SRE_FLAG_ASCII,
SRE_FLAG_DEBUG as SRE_FLAG_DEBUG,
SRE_FLAG_DOTALL as SRE_FLAG_DOTALL,
SRE_FLAG_IGNORECASE as SRE_FLAG_IGNORECASE,
SRE_FLAG_LOCALE as SRE_FLAG_LOCALE,
SRE_FLAG_MULTILINE as SRE_FLAG_MULTILINE,
SRE_FLAG_TEMPLATE as SRE_FLAG_TEMPLATE,
SRE_FLAG_UNICODE as SRE_FLAG_UNICODE,
SRE_FLAG_VERBOSE as SRE_FLAG_VERBOSE,
SRE_INFO_CHARSET as SRE_INFO_CHARSET,
SRE_INFO_LITERAL as SRE_INFO_LITERAL,
SRE_INFO_PREFIX as SRE_INFO_PREFIX,
_NamedIntConstant,
)
from sre_constants import *
from sre_constants import _NamedIntConstant
from sre_parse import SubPattern
from typing import Any, Pattern

View File

@@ -1,6 +1,8 @@
import sys
from typing import Any
MAXGROUPS: int
MAGIC: int
class error(Exception):
@@ -20,6 +22,9 @@ OPCODES: list[_NamedIntConstant]
ATCODES: list[_NamedIntConstant]
CHCODES: list[_NamedIntConstant]
OP_IGNORE: dict[_NamedIntConstant, _NamedIntConstant]
if sys.version_info >= (3, 7):
OP_LOCALE_IGNORE: dict[_NamedIntConstant, _NamedIntConstant]
OP_UNICODE_IGNORE: dict[_NamedIntConstant, _NamedIntConstant]
AT_MULTILINE: dict[_NamedIntConstant, _NamedIntConstant]
AT_LOCALE: dict[_NamedIntConstant, _NamedIntConstant]
AT_UNICODE: dict[_NamedIntConstant, _NamedIntConstant]

View File

@@ -1,4 +1,5 @@
import sys
from sre_constants import *
from sre_constants import _NamedIntConstant as _NIC, error as _Error
from typing import Any, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload
@@ -12,6 +13,8 @@ WHITESPACE: frozenset[str]
ESCAPES: dict[str, tuple[_NIC, int]]
CATEGORIES: dict[str, tuple[_NIC, _NIC] | tuple[_NIC, list[tuple[_NIC, _NIC]]]]
FLAGS: dict[str, int]
if sys.version_info >= (3, 7):
TYPE_FLAGS: int
GLOBAL_FLAGS: int
class Verbose(Exception): ...

View File

@@ -220,7 +220,7 @@ if sys.version_info >= (3, 7):
HAS_TLSv1: bool
HAS_TLSv1_1: bool
HAS_TLSv1_2: bool
HAS_TLSv1_3: bool
HAS_TLSv1_3: bool
HAS_ALPN: bool
HAS_ECDH: bool
HAS_SNI: bool

View File

@@ -64,9 +64,8 @@ UF_IMMUTABLE: int
UF_APPEND: int
UF_OPAQUE: int
UF_NOUNLINK: int
if sys.platform == "darwin":
UF_COMPRESSED: int # OS X 10.6+ only
UF_HIDDEN: int # OX X 10.5+ only
UF_COMPRESSED: int # OS X 10.6+ only
UF_HIDDEN: int # OX X 10.5+ only
SF_ARCHIVED: int
SF_IMMUTABLE: int
SF_APPEND: int

View File

@@ -1,3 +1,11 @@
b1_set: set[int]
b3_exceptions: dict[int, str]
c22_specials: set[int]
c6_set: set[int]
c7_set: set[int]
c8_set: set[int]
c9_set: set[int]
def in_table_a1(code: str) -> bool: ...
def in_table_b1(code: str) -> bool: ...
def map_table_b3(code: str) -> str: ...

View File

@@ -1,3 +1,5 @@
import sys
single_input: int
file_input: int
eval_input: int
@@ -84,5 +86,13 @@ comp_if: int
encoding_decl: int
yield_expr: int
yield_arg: int
if sys.version_info >= (3, 7):
sync_comp_for: int
if sys.version_info >= (3, 8):
func_body_suite: int
func_type: int
func_type_input: int
namedexpr_test: int
typelist: int
sym_name: dict[int, str]

View File

@@ -1,7 +1,9 @@
from typing import overload
from typing_extensions import Literal
LOG_ALERT: int
LOG_AUTH: int
LOG_AUTHPRIV: Literal[80]
LOG_CONS: int
LOG_CRIT: int
LOG_CRON: int
@@ -25,6 +27,7 @@ LOG_NDELAY: int
LOG_NEWS: int
LOG_NOTICE: int
LOG_NOWAIT: int
LOG_ODELAY: Literal[4]
LOG_PERROR: int
LOG_PID: int
LOG_SYSLOG: int

View File

@@ -10,15 +10,25 @@ from .case import (
skipIf as skipIf,
skipUnless as skipUnless,
)
from .loader import (
TestLoader as TestLoader,
defaultTestLoader as defaultTestLoader,
findTestCases as findTestCases,
getTestCaseNames as getTestCaseNames,
makeSuite as makeSuite,
)
from .main import TestProgram as TestProgram, main as main
from .result import TestResult as TestResult
from .runner import TextTestResult as TextTestResult, TextTestRunner as TextTestRunner
from .signals import (
installHandler as installHandler,
registerResult as registerResult,
removeHandler as removeHandler,
removeResult as removeResult,
)
from .suite import BaseTestSuite as BaseTestSuite, TestSuite as TestSuite
if sys.version_info >= (3, 8):
from .case import addModuleCleanup as addModuleCleanup
from unittest.loader import *
from unittest.main import *
from unittest.result import TestResult as TestResult
from unittest.runner import *
from unittest.signals import *
from unittest.suite import *
def load_tests(loader: TestLoader, tests: TestSuite, pattern: str | None) -> TestSuite: ...

View File

@@ -32,6 +32,8 @@ if sys.version_info >= (3, 9):
_E = TypeVar("_E", bound=BaseException)
_FT = TypeVar("_FT", bound=Callable[..., Any])
DIFF_OMITTED: str
class _BaseTestCaseContext:
def __init__(self, test_case: TestCase) -> None: ...

View File

@@ -3,11 +3,13 @@ import unittest.case
import unittest.result
import unittest.suite
from types import ModuleType
from typing import Any, Callable, List, Sequence, Type
from typing import Any, Callable, List, Pattern, Sequence, Type
_SortComparisonMethod = Callable[[str, str], int]
_SuiteClass = Callable[[List[unittest.case.TestCase]], unittest.suite.TestSuite]
VALID_MODULE_NAME: Pattern[str]
class TestLoader:
errors: list[Type[BaseException]]
testMethodPrefix: str

View File

@@ -6,6 +6,9 @@ import unittest.suite
from types import ModuleType
from typing import Any, Iterable, Protocol, Type
MAIN_EXAMPLES: str
MODULE_EXAMPLES: str
class _TestRunner(Protocol):
def run(self, test: unittest.suite.TestSuite | unittest.case.TestCase) -> unittest.result.TestResult: ...

View File

@@ -5,23 +5,57 @@ _T = TypeVar("_T")
_TT = TypeVar("_TT", bound=Type[Any])
_R = TypeVar("_R")
__all__ = [
"Mock",
"MagicMock",
"patch",
"sentinel",
"DEFAULT",
"ANY",
"call",
"create_autospec",
"AsyncMock",
"FILTER_DIR",
"NonCallableMock",
"NonCallableMagicMock",
"mock_open",
"PropertyMock",
"seal",
]
if sys.version_info >= (3, 8):
__all__ = (
"Mock",
"MagicMock",
"patch",
"sentinel",
"DEFAULT",
"ANY",
"call",
"create_autospec",
"AsyncMock",
"FILTER_DIR",
"NonCallableMock",
"NonCallableMagicMock",
"mock_open",
"PropertyMock",
"seal",
)
elif sys.version_info >= (3, 7):
__all__ = (
"Mock",
"MagicMock",
"patch",
"sentinel",
"DEFAULT",
"ANY",
"call",
"create_autospec",
"FILTER_DIR",
"NonCallableMock",
"NonCallableMagicMock",
"mock_open",
"PropertyMock",
"seal",
)
else:
__all__ = (
"Mock",
"MagicMock",
"patch",
"sentinel",
"DEFAULT",
"ANY",
"call",
"create_autospec",
"FILTER_DIR",
"NonCallableMock",
"NonCallableMagicMock",
"mock_open",
"PropertyMock",
)
__version__: str
FILTER_DIR: Any
@@ -39,7 +73,7 @@ class _Sentinel:
sentinel: Any
DEFAULT: Any
class _Call(Tuple[Any, ...]):
class _Call(tuple[Any, ...]):
def __new__(
cls, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ...
) -> Any: ...
@@ -53,6 +87,11 @@ class _Call(Tuple[Any, ...]):
__ne__: Any
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
def __getattr__(self, attr: Any) -> Any: ...
if sys.version_info >= (3, 8):
@property
def args(self): ...
@property
def kwargs(self): ...
def call_list(self) -> Any: ...
call: _Call
@@ -60,12 +99,6 @@ call: _Call
class _CallList(List[_Call]):
def __contains__(self, value: Any) -> bool: ...
class _MockIter:
obj: Any
def __init__(self, obj: Any) -> None: ...
def __iter__(self) -> Any: ...
def __next__(self) -> Any: ...
class Base:
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
@@ -141,7 +174,10 @@ class CallableMixin(Base):
_new_parent: Any | None = ...,
**kwargs: Any,
) -> None: ...
def __call__(_mock_self, *args: Any, **kwargs: Any) -> Any: ...
if sys.version_info >= (3, 8):
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
else:
def __call__(_mock_self, *args: Any, **kwargs: Any) -> Any: ...
class Mock(CallableMixin, NonCallableMock): ...
@@ -160,23 +196,41 @@ class _patch(Generic[_T]):
additional_patchers: Any
# If new==DEFAULT, self is _patch[Any]. Ideally we'd be able to add an overload for it so that self is _patch[MagicMock],
# but that's impossible with the current type system.
def __init__(
self: _patch[_T],
getter: Callable[[], Any],
attribute: str,
new: _T,
spec: Any | None,
create: bool,
spec_set: Any | None,
autospec: Any | None,
new_callable: Any | None,
kwargs: Mapping[str, Any],
) -> None: ...
if sys.version_info >= (3, 10):
def __init__(
self: _patch[_T],
getter: Callable[[], Any],
attribute: str,
new: _T,
spec: Any | None,
create: bool,
spec_set: Any | None,
autospec: Any | None,
new_callable: Any | None,
kwargs: Mapping[str, Any],
*,
unsafe: bool = ...,
) -> None: ...
else:
def __init__(
self: _patch[_T],
getter: Callable[[], Any],
attribute: str,
new: _T,
spec: Any | None,
create: bool,
spec_set: Any | None,
autospec: Any | None,
new_callable: Any | None,
kwargs: Mapping[str, Any],
) -> None: ...
def copy(self) -> _patch[_T]: ...
@overload
def __call__(self, func: _TT) -> _TT: ...
@overload
def __call__(self, func: Callable[..., _R]) -> Callable[..., _R]: ...
if sys.version_info >= (3, 8):
def decoration_helper(self, patched, args, keywargs): ...
def decorate_class(self, klass: _TT) -> _TT: ...
def decorate_callable(self, func: Callable[..., _R]) -> Callable[..., _R]: ...
if sys.version_info >= (3, 8):
@@ -357,10 +411,11 @@ if sys.version_info >= (3, 8):
class MagicProxy:
name: Any
parent: Any
def __init__(self, name: Any, parent: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def create_mock(self) -> Any: ...
def __get__(self, obj: Any, _type: Any | None = ...) -> Any: ...
def __init__(self, name, parent) -> None: ...
if sys.version_info < (3, 8):
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def create_mock(self): ...
def __get__(self, obj, _type: Any | None = ...): ...
class _ANY:
def __eq__(self, other: Any) -> bool: ...

View File

@@ -6,6 +6,9 @@ _SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, TracebackType]
_F = TypeVar("_F", bound=Callable[..., Any])
STDOUT_LINE: str
STDERR_LINE: str
# undocumented
def failfast(method: _F) -> _F: ...

View File

@@ -3,6 +3,9 @@ from _typeshed import StrOrBytesPath
from types import SimpleNamespace
from typing import Sequence
if sys.version_info >= (3, 9):
CORE_VENV_DEPS: tuple[str, ...]
class EnvBuilder:
system_site_packages: bool
clear: bool

View File

@@ -6,6 +6,9 @@ XINCLUDE: str
XINCLUDE_INCLUDE: str
XINCLUDE_FALLBACK: str
if sys.version_info >= (3, 9):
DEFAULT_MAX_INCLUSION_DEPTH: int
class FatalIncludeError(SyntaxError): ...
def default_loader(href: str | bytes | int, parse: str, encoding: str | None = ...) -> str | Element: ...

View File

@@ -1,12 +1,16 @@
from array import array
from typing import Any
from typing_extensions import Literal
DEFLATED: int
DEF_MEM_LEVEL: int
MAX_WBITS: int
ZLIB_VERSION: str
Z_NO_COMPRESSION: Literal[0]
Z_PARTIAL_FLUSH: Literal[1]
Z_BEST_COMPRESSION: int
Z_BEST_SPEED: int
Z_BLOCK: Literal[5]
Z_DEFAULT_COMPRESSION: int
Z_DEFAULT_STRATEGY: int
Z_FILTERED: int
@@ -17,6 +21,7 @@ Z_HUFFMAN_ONLY: int
Z_NO_FLUSH: int
Z_RLE: int
Z_SYNC_FLUSH: int
Z_TREES: Literal[6]
DEF_BUF_SIZE: int
ZLIB_RUNTIME_VERSION: str