diff options
author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-12-21 20:24:22 +0100 |
---|---|---|
committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-12-23 21:15:00 +0100 |
commit | 7b5f39b5eeac583f822741eaf95a8229f2b5f8d7 (patch) | |
tree | a7a83a47f39d1e4e29becb5f835158e4b1c86e3a /numpy/testing/_private | |
parent | 99ed44df750fedfc0bbf956c88d15befd5e760cd (diff) | |
download | numpy-7b5f39b5eeac583f822741eaf95a8229f2b5f8d7.tar.gz |
STY: Use subscriptable `builtins` types over the generic aliases in `typing`
Diffstat (limited to 'numpy/testing/_private')
-rw-r--r-- | numpy/testing/_private/utils.pyi | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/numpy/testing/_private/utils.pyi b/numpy/testing/_private/utils.pyi index 4ba5d82ee..ab3e6f805 100644 --- a/numpy/testing/_private/utils.pyi +++ b/numpy/testing/_private/utils.pyi @@ -11,16 +11,11 @@ from typing import ( AnyStr, Callable, ClassVar, - Dict, Iterable, - List, NoReturn, overload, Pattern, Sequence, - Set, - Tuple, - Type, type_check_only, TypeVar, Union, @@ -59,14 +54,14 @@ _ComparisonFunc = Callable[ ], ] -__all__: List[str] +__all__: list[str] class KnownFailureException(Exception): ... class IgnoreException(Exception): ... class clear_and_catch_warnings(warnings.catch_warnings): - class_modules: ClassVar[Tuple[types.ModuleType, ...]] - modules: Set[types.ModuleType] + class_modules: ClassVar[tuple[types.ModuleType, ...]] + modules: set[types.ModuleType] @overload def __new__( cls, @@ -85,10 +80,10 @@ class clear_and_catch_warnings(warnings.catch_warnings): record: bool, modules: Iterable[types.ModuleType] = ..., ) -> clear_and_catch_warnings: ... - def __enter__(self) -> None | List[warnings.WarningMessage]: ... + def __enter__(self) -> None | list[warnings.WarningMessage]: ... def __exit__( self, - __exc_type: None | Type[BaseException] = ..., + __exc_type: None | type[BaseException] = ..., __exc_val: None | BaseException = ..., __exc_tb: None | types.TracebackType = ..., ) -> None: ... @@ -98,34 +93,34 @@ class clear_and_catch_warnings(warnings.catch_warnings): @type_check_only class _clear_and_catch_warnings_with_records(clear_and_catch_warnings): - def __enter__(self) -> List[warnings.WarningMessage]: ... + def __enter__(self) -> list[warnings.WarningMessage]: ... @type_check_only class _clear_and_catch_warnings_without_records(clear_and_catch_warnings): def __enter__(self) -> None: ... class suppress_warnings: - log: List[warnings.WarningMessage] + log: list[warnings.WarningMessage] def __init__( self, forwarding_rule: L["always", "module", "once", "location"] = ..., ) -> None: ... def filter( self, - category: Type[Warning] = ..., + category: type[Warning] = ..., message: str = ..., module: None | types.ModuleType = ..., ) -> None: ... def record( self, - category: Type[Warning] = ..., + category: type[Warning] = ..., message: str = ..., module: None | types.ModuleType = ..., - ) -> List[warnings.WarningMessage]: ... + ) -> list[warnings.WarningMessage]: ... def __enter__(self: _T) -> _T: ... def __exit__( self, - __exc_type: None | Type[BaseException] = ..., + __exc_type: None | type[BaseException] = ..., __exc_val: None | BaseException = ..., __exc_tb: None | types.TracebackType = ..., ) -> None: ... @@ -151,10 +146,10 @@ else: if sys.platform == "linux": def jiffies( _proc_pid_stat: str | bytes | os.PathLike[Any] = ..., - _load_time: List[float] = ..., + _load_time: list[float] = ..., ) -> int: ... else: - def jiffies(_load_time: List[float] = ...) -> int: ... + def jiffies(_load_time: list[float] = ...) -> int: ... def build_err_msg( arrays: Iterable[object], @@ -246,7 +241,7 @@ def assert_array_less( def runstring( astr: str | bytes | types.CodeType, - dict: None | Dict[str, Any], + dict: None | dict[str, Any], ) -> Any: ... def assert_string_equal(actual: str, desired: str) -> None: ... @@ -256,11 +251,11 @@ def rundocs( raise_on_error: bool = ..., ) -> None: ... -def raises(*args: Type[BaseException]) -> Callable[[_FT], _FT]: ... +def raises(*args: type[BaseException]) -> Callable[[_FT], _FT]: ... @overload def assert_raises( # type: ignore - expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...], + expected_exception: type[BaseException] | tuple[type[BaseException], ...], callable: Callable[..., Any], /, *args: Any, @@ -268,14 +263,14 @@ def assert_raises( # type: ignore ) -> None: ... @overload def assert_raises( - expected_exception: Type[_ET] | Tuple[Type[_ET], ...], + expected_exception: type[_ET] | tuple[type[_ET], ...], *, msg: None | str = ..., ) -> unittest.case._AssertRaisesContext[_ET]: ... @overload def assert_raises_regex( - expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...], + expected_exception: type[BaseException] | tuple[type[BaseException], ...], expected_regex: str | bytes | Pattern[Any], callable: Callable[..., Any], /, @@ -284,14 +279,14 @@ def assert_raises_regex( ) -> None: ... @overload def assert_raises_regex( - expected_exception: Type[_ET] | Tuple[Type[_ET], ...], + expected_exception: type[_ET] | tuple[type[_ET], ...], expected_regex: str | bytes | Pattern[Any], *, msg: None | str = ..., ) -> unittest.case._AssertRaisesContext[_ET]: ... def decorate_methods( - cls: Type[Any], + cls: type[Any], decorator: Callable[[Callable[..., Any]], Any], testmatch: None | str | bytes | Pattern[Any] = ..., ) -> None: ... @@ -338,11 +333,11 @@ def assert_array_max_ulp( @overload def assert_warns( - warning_class: Type[Warning], + warning_class: type[Warning], ) -> contextlib._GeneratorContextManager[None]: ... @overload def assert_warns( - warning_class: Type[Warning], + warning_class: type[Warning], func: Callable[..., _T], /, *args: Any, |