Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe361df

Browse files
committed
STY: Use subscriptable collections.abc types over the generic aliases in …
1 parent 7b5f39b commit fe361df

43 files changed

Lines changed: 70 additions & 83 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

numpy/__init__.pyi

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,26 +167,25 @@ from numpy.typing._extended_precision import (
167167
complex512 as complex512,
168168
)
169169

170-
from typing import (
171-
Literal as L,
172-
Any,
173-
ByteString,
170+
from collections.abc import (
174171
Callable,
175172
Container,
176-
Callable,
177-
Generic,
178-
IO,
179173
Iterable,
180174
Iterator,
181175
Mapping,
182-
NoReturn,
183-
overload,
184176
Sequence,
185177
Sized,
178+
)
179+
from typing import (
180+
Literal as L,
181+
Any,
182+
Generic,
183+
IO,
184+
NoReturn,
185+
overload,
186186
SupportsComplex,
187187
SupportsFloat,
188188
SupportsInt,
189-
Text,
190189
TypeVar,
191190
Union,
192191
Protocol,

numpy/_pytesttester.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Iterable, Literal as L
1+
from collections.abc import Iterable
2+
from typing import Literal as L
23

34
__all__: list[str]
45

numpy/core/_asarray.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import TypeVar, Union, Iterable, overload, Literal
1+
from collections.abc import Iterable
2+
from typing import TypeVar, Union, overload, Literal
23

34
from numpy import ndarray
45
from numpy.typing import ArrayLike, DTypeLike

numpy/core/_ufunc_config.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Callable, Any, Literal, TypedDict
1+
from collections.abc import Callable
2+
from typing import Any, Literal, TypedDict
23

34
from numpy import _SupportsWrite
45

numpy/core/arrayprint.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from types import TracebackType
2-
from typing import Any, Callable, Literal, TypedDict, SupportsIndex
2+
from collections.abc import Callable
3+
from typing import Any, Literal, TypedDict, SupportsIndex
34

45
# Using a private class is by no means ideal, but it is simply a consequence
56
# of a `contextlib.context` returning an instance of aforementioned class

numpy/core/einsumfunc.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import TypeVar, Any, overload, Union, Sequence, Literal
1+
from collections.abc import Sequence
2+
from typing import TypeVar, Any, overload, Union, Literal
23

34
from numpy import (
45
ndarray,

numpy/core/fromnumeric.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import datetime as dt
2-
from typing import Union, Sequence, Any, overload, TypeVar, Literal
2+
from collections.abc import Sequence
3+
from typing import Union, Any, overload, TypeVar, Literal
34

45
from numpy import (
56
ndarray,

numpy/core/multiarray.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
import os
44
import datetime as dt
5+
from collections.abc import Sequence, Callable, Iterable
56
from typing import (
67
Literal as L,
78
Any,
8-
Callable,
9-
Iterable,
109
overload,
1110
TypeVar,
1211
Union,
13-
Sequence,
1412
SupportsIndex,
1513
final,
1614
Final,

numpy/core/numeric.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
from collections.abc import Callable, Sequence
12
from typing import (
23
Any,
34
Union,
4-
Sequence,
5-
Callable,
65
overload,
76
TypeVar,
87
Literal,

numpy/core/numerictypes.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import sys
22
import types
3+
from collections.abc import Iterable
34
from typing import (
45
Literal as L,
56
Union,
67
overload,
78
Any,
89
TypeVar,
9-
Iterable,
1010
Protocol,
1111
TypedDict,
1212
)

0 commit comments

Comments
 (0)