diff options
| author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-12-21 23:41:09 +0100 |
|---|---|---|
| committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-12-23 21:15:00 +0100 |
| commit | fe361df62b101a27fd2ea203fb0b79b6a5f61401 (patch) | |
| tree | b4b8c0387ea22d4d70e83f318dd306cd75a782a5 /numpy/typing | |
| parent | 7b5f39b5eeac583f822741eaf95a8229f2b5f8d7 (diff) | |
| download | numpy-fe361df62b101a27fd2ea203fb0b79b6a5f61401.tar.gz | |
STY: Use subscriptable `collections.abc` types over the generic aliases in …
Diffstat (limited to 'numpy/typing')
| -rw-r--r-- | numpy/typing/_generic_alias.py | 4 | ||||
| -rw-r--r-- | numpy/typing/tests/data/fail/arrayprint.pyi | 3 | ||||
| -rw-r--r-- | numpy/typing/tests/data/pass/literal.py | 2 | ||||
| -rw-r--r-- | numpy/typing/tests/data/pass/simple.py | 2 | ||||
| -rw-r--r-- | numpy/typing/tests/data/reveal/arrayprint.pyi | 3 | ||||
| -rw-r--r-- | numpy/typing/tests/data/reveal/char.pyi | 2 | ||||
| -rw-r--r-- | numpy/typing/tests/data/reveal/nested_sequence.pyi | 3 | ||||
| -rw-r--r-- | numpy/typing/tests/data/reveal/testing.pyi | 3 | ||||
| -rw-r--r-- | numpy/typing/tests/test_generic_alias.py | 3 |
9 files changed, 13 insertions, 12 deletions
diff --git a/numpy/typing/_generic_alias.py b/numpy/typing/_generic_alias.py index 9579b22a4..0541ad77f 100644 --- a/numpy/typing/_generic_alias.py +++ b/numpy/typing/_generic_alias.py @@ -2,12 +2,10 @@ from __future__ import annotations import sys import types +from collections.abc import Generator, Iterable, Iterator from typing import ( Any, ClassVar, - Generator, - Iterable, - Iterator, NoReturn, TypeVar, TYPE_CHECKING, diff --git a/numpy/typing/tests/data/fail/arrayprint.pyi b/numpy/typing/tests/data/fail/arrayprint.pyi index 86297a0b2..71b921e3a 100644 --- a/numpy/typing/tests/data/fail/arrayprint.pyi +++ b/numpy/typing/tests/data/fail/arrayprint.pyi @@ -1,4 +1,5 @@ -from typing import Callable, Any +from collections.abc import Callable +from typing import Any import numpy as np AR: np.ndarray diff --git a/numpy/typing/tests/data/pass/literal.py b/numpy/typing/tests/data/pass/literal.py index ad74b417d..d06431eed 100644 --- a/numpy/typing/tests/data/pass/literal.py +++ b/numpy/typing/tests/data/pass/literal.py @@ -1,7 +1,7 @@ from __future__ import annotations from functools import partial -from typing import Callable +from collections.abc import Callable import pytest # type: ignore import numpy as np diff --git a/numpy/typing/tests/data/pass/simple.py b/numpy/typing/tests/data/pass/simple.py index 85965e0de..03ca3e83f 100644 --- a/numpy/typing/tests/data/pass/simple.py +++ b/numpy/typing/tests/data/pass/simple.py @@ -2,7 +2,7 @@ import operator import numpy as np -from typing import Iterable # noqa: F401 +from collections.abc import Iterable # Basic checks array = np.array([1, 2]) diff --git a/numpy/typing/tests/data/reveal/arrayprint.pyi b/numpy/typing/tests/data/reveal/arrayprint.pyi index e797097eb..6e65a8d8a 100644 --- a/numpy/typing/tests/data/reveal/arrayprint.pyi +++ b/numpy/typing/tests/data/reveal/arrayprint.pyi @@ -1,4 +1,5 @@ -from typing import Any, Callable +from collections.abc import Callable +from typing import Any import numpy as np AR: np.ndarray[Any, Any] diff --git a/numpy/typing/tests/data/reveal/char.pyi b/numpy/typing/tests/data/reveal/char.pyi index ce8c1b269..0563b3472 100644 --- a/numpy/typing/tests/data/reveal/char.pyi +++ b/numpy/typing/tests/data/reveal/char.pyi @@ -1,6 +1,6 @@ import numpy as np import numpy.typing as npt -from typing import Sequence +from collections.abc import Sequence AR_U: npt.NDArray[np.str_] AR_S: npt.NDArray[np.bytes_] diff --git a/numpy/typing/tests/data/reveal/nested_sequence.pyi b/numpy/typing/tests/data/reveal/nested_sequence.pyi index 771bd54bb..c9f91cfa2 100644 --- a/numpy/typing/tests/data/reveal/nested_sequence.pyi +++ b/numpy/typing/tests/data/reveal/nested_sequence.pyi @@ -1,4 +1,5 @@ -from typing import Sequence, Any +from collections.abc import Sequence +from typing import Any import numpy.typing as npt a: Sequence[int] diff --git a/numpy/typing/tests/data/reveal/testing.pyi b/numpy/typing/tests/data/reveal/testing.pyi index 9813dc723..fb419d48d 100644 --- a/numpy/typing/tests/data/reveal/testing.pyi +++ b/numpy/typing/tests/data/reveal/testing.pyi @@ -2,7 +2,8 @@ from __future__ import annotations import re import sys -from typing import Any, Callable, TypeVar +from collections.abc import Callable +from typing import Any, TypeVar from pathlib import Path import numpy as np diff --git a/numpy/typing/tests/test_generic_alias.py b/numpy/typing/tests/test_generic_alias.py index af6eb8b36..8df2eea93 100644 --- a/numpy/typing/tests/test_generic_alias.py +++ b/numpy/typing/tests/test_generic_alias.py @@ -5,8 +5,7 @@ import copy import types import pickle import weakref -from collections.abc import Callable -from typing import TypeVar, Any, Union +from typing import TypeVar, Any, Union, Callable import pytest import numpy as np |
