Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,6 +1,6 @@
import types
import unittest
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union
from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Type
class TestResults(NamedTuple):
failed: int
@@ -33,7 +33,7 @@ ELLIPSIS_MARKER: str
class Example:
source: str
want: str
exc_msg: Optional[str]
exc_msg: str | None
lineno: int
indent: int
options: Dict[int, bool]
@@ -41,10 +41,10 @@ class Example:
self,
source: str,
want: str,
exc_msg: Optional[str] = ...,
exc_msg: str | None = ...,
lineno: int = ...,
indent: int = ...,
options: Optional[Dict[int, bool]] = ...,
options: Dict[int, bool] | None = ...,
) -> None: ...
def __hash__(self) -> int: ...
@@ -52,26 +52,24 @@ class DocTest:
examples: List[Example]
globs: Dict[str, Any]
name: str
filename: Optional[str]
lineno: Optional[int]
docstring: Optional[str]
filename: str | None
lineno: int | None
docstring: str | None
def __init__(
self,
examples: List[Example],
globs: Dict[str, Any],
name: str,
filename: Optional[str],
lineno: Optional[int],
docstring: Optional[str],
filename: str | None,
lineno: int | None,
docstring: str | None,
) -> None: ...
def __hash__(self) -> int: ...
def __lt__(self, other: DocTest) -> bool: ...
class DocTestParser:
def parse(self, string: str, name: str = ...) -> List[Union[str, Example]]: ...
def get_doctest(
self, string: str, globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[int]
) -> DocTest: ...
def parse(self, string: str, name: str = ...) -> List[str | Example]: ...
def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ...
def get_examples(self, string: str, name: str = ...) -> List[Example]: ...
class DocTestFinder:
@@ -81,10 +79,10 @@ class DocTestFinder:
def find(
self,
obj: object,
name: Optional[str] = ...,
module: Union[None, bool, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
name: str | None = ...,
module: None | bool | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
extraglobs: Dict[str, Any] | None = ...,
) -> List[DocTest]: ...
_Out = Callable[[str], Any]
@@ -97,15 +95,15 @@ class DocTestRunner:
tries: int
failures: int
test: DocTest
def __init__(self, checker: Optional[OutputChecker] = ..., verbose: Optional[bool] = ..., optionflags: int = ...) -> None: ...
def __init__(self, checker: OutputChecker | None = ..., verbose: bool | None = ..., optionflags: int = ...) -> None: ...
def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
def run(
self, test: DocTest, compileflags: Optional[int] = ..., out: Optional[_Out] = ..., clear_globs: bool = ...
self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ...
) -> TestResults: ...
def summarize(self, verbose: Optional[bool] = ...) -> TestResults: ...
def summarize(self, verbose: bool | None = ...) -> TestResults: ...
def merge(self, other: DocTestRunner) -> None: ...
class OutputChecker:
@@ -126,40 +124,35 @@ class UnexpectedException(Exception):
class DebugRunner(DocTestRunner): ...
master: Optional[DocTestRunner]
master: DocTestRunner | None
def testmod(
m: Optional[types.ModuleType] = ...,
name: Optional[str] = ...,
globs: Optional[Dict[str, Any]] = ...,
verbose: Optional[bool] = ...,
m: types.ModuleType | None = ...,
name: str | None = ...,
globs: Dict[str, Any] | None = ...,
verbose: bool | None = ...,
report: bool = ...,
optionflags: int = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
extraglobs: Dict[str, Any] | None = ...,
raise_on_error: bool = ...,
exclude_empty: bool = ...,
) -> TestResults: ...
def testfile(
filename: str,
module_relative: bool = ...,
name: Optional[str] = ...,
package: Union[None, str, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
verbose: Optional[bool] = ...,
name: str | None = ...,
package: None | str | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
verbose: bool | None = ...,
report: bool = ...,
optionflags: int = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
extraglobs: Dict[str, Any] | None = ...,
raise_on_error: bool = ...,
parser: DocTestParser = ...,
encoding: Optional[str] = ...,
encoding: str | None = ...,
) -> TestResults: ...
def run_docstring_examples(
f: object,
globs: Dict[str, Any],
verbose: bool = ...,
name: str = ...,
compileflags: Optional[int] = ...,
optionflags: int = ...,
f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ...
) -> None: ...
def set_unittest_reportflags(flags: int) -> int: ...
@@ -168,9 +161,9 @@ class DocTestCase(unittest.TestCase):
self,
test: DocTest,
optionflags: int = ...,
setUp: Optional[Callable[[DocTest], Any]] = ...,
tearDown: Optional[Callable[[DocTest], Any]] = ...,
checker: Optional[OutputChecker] = ...,
setUp: Callable[[DocTest], Any] | None = ...,
tearDown: Callable[[DocTest], Any] | None = ...,
checker: OutputChecker | None = ...,
) -> None: ...
def setUp(self) -> None: ...
def tearDown(self) -> None: ...
@@ -190,10 +183,10 @@ class SkipDocTestCase(DocTestCase):
class _DocTestSuite(unittest.TestSuite): ...
def DocTestSuite(
module: Union[None, str, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
test_finder: Optional[DocTestFinder] = ...,
module: None | str | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
extraglobs: Dict[str, Any] | None = ...,
test_finder: DocTestFinder | None = ...,
**options: Any,
) -> _DocTestSuite: ...
@@ -204,15 +197,15 @@ class DocFileCase(DocTestCase):
def DocFileTest(
path: str,
module_relative: bool = ...,
package: Union[None, str, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
package: None | str | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
parser: DocTestParser = ...,
encoding: Optional[str] = ...,
encoding: str | None = ...,
**options: Any,
) -> DocFileCase: ...
def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ...
def script_from_examples(s: str) -> str: ...
def testsource(module: Union[None, str, types.ModuleType], name: str) -> str: ...
def debug_src(src: str, pm: bool = ..., globs: Optional[Dict[str, Any]] = ...) -> None: ...
def debug_script(src: str, pm: bool = ..., globs: Optional[Dict[str, Any]] = ...) -> None: ...
def debug(module: Union[None, str, types.ModuleType], name: str, pm: bool = ...) -> None: ...
def testsource(module: None | str | types.ModuleType, name: str) -> str: ...
def debug_src(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ...
def debug_script(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ...
def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ...