Skip to content

Commit db68945

Browse files
authored
🐛 fix unavailable typing imports on python<3.11 (codemod) (#8)
2 parents dbd4042 + a9c60f8 commit db68945

File tree

93 files changed

+233
-127
lines changed

Some content is hidden

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

93 files changed

+233
-127
lines changed

src/numpy-stubs/__config__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from enum import Enum
22
from types import ModuleType
3-
from typing import Final, Literal as L, NotRequired, TypedDict, overload, type_check_only
3+
from typing import Final, Literal as L, TypedDict, overload, type_check_only
4+
from typing_extensions import NotRequired
45

56
_CompilerConfigDictValue = TypedDict(
67
"_CompilerConfigDictValue",

src/numpy-stubs/_array_api_info.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from typing import ClassVar, Literal, TypeAlias, TypeVar, TypedDict, final, overload, type_check_only
2-
from typing_extensions import Never
1+
from typing import ClassVar, Literal, TypeAlias, TypedDict, final, overload, type_check_only
2+
from typing_extensions import Never, TypeVar
33

44
import numpy as np
55

src/numpy-stubs/_core/_asarray.pyi

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

45
from numpy._typing import DTypeLike, NDArray, _SupportsArrayFunc
56

src/numpy-stubs/_core/defchararray.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Literal as L, SupportsIndex, SupportsInt, TypeAlias, TypeVar, overload
1+
from typing import Any, Literal as L, SupportsIndex, SupportsInt, TypeAlias, overload
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45
from numpy._core.multiarray import compare_chararrays

src/numpy-stubs/_core/einsumfunc.pyi

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

45
import numpy as np
56
from numpy._typing import (

src/numpy-stubs/_core/fromnumeric.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections.abc import Sequence
2-
from typing import Any, Literal, NoReturn, Protocol, SupportsIndex, TypeAlias, TypeVar, overload, type_check_only
3-
from typing_extensions import Never, deprecated
2+
from typing import Any, Literal, NoReturn, Protocol, SupportsIndex, TypeAlias, overload, type_check_only
3+
from typing_extensions import Never, TypeVar, deprecated
44

55
import numpy as np
66
from numpy._typing import (

src/numpy-stubs/_core/function_base.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Literal as L, SupportsIndex, TypeVar, overload
1+
from typing import Any, Literal as L, SupportsIndex, overload
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45
from numpy._typing import DTypeLike, NDArray, _ArrayLikeComplex_co, _ArrayLikeFloat_co, _DTypeLike

src/numpy-stubs/_core/multiarray.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ from typing import (
99
Protocol,
1010
SupportsIndex,
1111
TypeAlias,
12-
TypeVar,
1312
TypedDict,
1413
final,
1514
overload,
1615
type_check_only,
1716
)
18-
from typing_extensions import CapsuleType, Unpack
17+
from typing_extensions import CapsuleType, TypeVar, Unpack
1918

2019
import numpy as np
2120
from numpy import ( # noqa: ICN003

src/numpy-stubs/_core/numeric.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ from typing import (
77
SupportsAbs,
88
SupportsIndex,
99
TypeAlias,
10-
TypeVar,
1110
overload,
1211
)
13-
from typing_extensions import TypeIs, Unpack
12+
from typing_extensions import TypeIs, TypeVar, Unpack
1413

1514
import numpy as np
1615
from numpy import ( # noqa: ICN003

src/numpy-stubs/_core/records.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from _typeshed import Incomplete, StrOrBytesPath
22
from collections.abc import Iterable, Sequence
33
from types import EllipsisType
4-
from typing import Any, Literal, Protocol, SupportsIndex, TypeAlias, TypeVar, overload, type_check_only
4+
from typing import Any, Literal, Protocol, SupportsIndex, TypeAlias, overload, type_check_only
5+
from typing_extensions import TypeVar
56

67
import numpy as np
78
from numpy._typing import (

src/numpy-stubs/_core/shape_base.pyi

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

45
import numpy as np
56
from numpy._typing import ArrayLike, DTypeLike, NDArray, _ArrayLike, _DTypeLike

src/numpy-stubs/_typing/_array_like.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
from collections.abc import Callable, Collection, Sequence
3-
from typing import Any, Never as _UnknownType, Protocol, TypeAlias, TypeVar, runtime_checkable
3+
from typing import Any, Never as _UnknownType, Protocol, TypeAlias, runtime_checkable
4+
from typing_extensions import TypeVar
45

56
import numpy as np
67
from numpy.dtypes import StringDType

src/numpy-stubs/_typing/_callable.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ from typing import (
33
NoReturn,
44
Protocol,
55
TypeAlias,
6-
TypeVar,
76
final,
87
overload,
98
type_check_only,
109
)
10+
from typing_extensions import TypeVar
1111

1212
import numpy as np
1313

src/numpy-stubs/_typing/_dtype_like.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Sequence
2-
from typing import Any, Protocol, TypeAlias, TypeVar, TypedDict, runtime_checkable
2+
from typing import Any, Protocol, TypeAlias, TypedDict, runtime_checkable
3+
from typing_extensions import TypeVar
34

45
import numpy as np
56

src/numpy-stubs/_typing/_nested_sequence.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Iterator
2-
from typing import Any, Protocol, TypeVar
2+
from typing import Any, Protocol
3+
from typing_extensions import TypeVar
34

45
__all__ = ["_NestedSequence"]
56

src/numpy-stubs/_typing/_ufunc.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ from typing import (
22
Any,
33
Generic,
44
Literal,
5-
LiteralString,
65
NoReturn,
76
Protocol,
87
SupportsIndex,
98
TypeAlias,
10-
TypeVar,
119
TypedDict,
1210
overload,
1311
type_check_only,
1412
)
15-
from typing_extensions import Unpack
13+
from typing_extensions import LiteralString, TypeVar, Unpack
1614

1715
import numpy as np
1816
import numpy.typing as npt

src/numpy-stubs/ctypeslib/_ctypeslib.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import ctypes as ct
22
from _typeshed import StrOrBytesPath
33
from collections.abc import Iterable, Sequence
4-
from typing import Any, ClassVar, Generic, Literal as L, TypeAlias, TypeVar, overload
4+
from typing import Any, ClassVar, Generic, Literal as L, TypeAlias, overload
5+
from typing_extensions import TypeVar
56

67
import numpy as np
78
from numpy._core._internal import _ctypes

src/numpy-stubs/dtypes.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ from typing import (
33
Final,
44
Generic,
55
Literal as L,
6-
LiteralString,
76
NoReturn,
8-
Self,
97
TypeAlias,
108
final,
119
type_check_only,
1210
)
13-
from typing_extensions import TypeVar
11+
from typing_extensions import LiteralString, Self, TypeVar
1412

1513
import numpy as np
1614

src/numpy-stubs/fft/_helper.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Literal as L, TypeVar, overload
1+
from typing import Any, Literal as L, overload
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45
from numpy._typing import ArrayLike, NDArray, _ArrayLike, _ArrayLikeComplex_co, _ArrayLikeFloat_co, _ShapeLike

src/numpy-stubs/lib/_arraypad_impl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Mapping
2-
from typing import Any, Literal as L, Protocol, TypeAlias, TypeVar, overload, type_check_only
2+
from typing import Any, Literal as L, Protocol, TypeAlias, overload, type_check_only
3+
from typing_extensions import TypeVar
34

45
import numpy as np
56
from numpy._typing import ArrayLike, NDArray, _ArrayLike, _ArrayLikeInt

src/numpy-stubs/lib/_arraysetops_impl.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from typing import Any, Generic, Literal as L, NamedTuple, SupportsIndex, TypeVar, overload
2-
from typing_extensions import deprecated
1+
from typing import Any, Generic, Literal as L, NamedTuple, SupportsIndex, overload
2+
from typing_extensions import TypeVar, deprecated
33

44
import numpy as np
55
from numpy._typing import (

src/numpy-stubs/lib/_arrayterator_impl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from collections.abc import Generator, Iterator
22
from types import EllipsisType
3-
from typing import Any, TypeAlias, TypeVar
3+
from typing import Any, TypeAlias
4+
from typing_extensions import TypeVar
45

56
import numpy as np
67

src/numpy-stubs/lib/_function_base_impl.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ from typing import (
33
Any,
44
Concatenate,
55
Literal as L,
6-
ParamSpec,
76
Protocol,
87
SupportsIndex,
98
SupportsInt,
109
TypeAlias,
11-
TypeVar,
1210
overload,
1311
type_check_only,
1412
)
15-
from typing_extensions import TypeIs, deprecated
13+
from typing_extensions import ParamSpec, TypeIs, TypeVar, deprecated
1614

1715
import numpy as np
1816
from numpy import vectorize # noqa: ICN003

src/numpy-stubs/lib/_npyio_impl.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import zipfile
33
from _typeshed import StrOrBytesPath, StrPath, SupportsKeysAndGetItem, SupportsRead, SupportsWrite
44
from collections.abc import Callable, Collection, Iterable, Iterator, Mapping, Sequence
55
from re import Pattern
6-
from typing import IO, Any, Generic, Literal as L, Protocol, TypeVar, overload, type_check_only
7-
from typing_extensions import Self, deprecated
6+
from typing import IO, Any, Generic, Literal as L, Protocol, overload, type_check_only
7+
from typing_extensions import Self, TypeVar, deprecated
88

99
import numpy as np
1010
from numpy._core.multiarray import packbits, unpackbits

src/numpy-stubs/lib/_polynomial_impl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Literal as L, NoReturn, SupportsIndex, SupportsInt, TypeAlias, TypeVar, overload
1+
from typing import Any, Literal as L, NoReturn, SupportsIndex, SupportsInt, TypeAlias, overload
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45
from numpy import poly1d # noqa: ICN003

src/numpy-stubs/lib/_shape_base_impl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Callable, Sequence
2-
from typing import Any, Concatenate, ParamSpec, Protocol, SupportsIndex, TypeVar, overload, type_check_only
2+
from typing import Any, Concatenate, Protocol, SupportsIndex, overload, type_check_only
3+
from typing_extensions import ParamSpec, TypeVar
34

45
import numpy as np
56
from numpy._core.shape_base import vstack as row_stack

src/numpy-stubs/lib/_stride_tricks_impl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Iterable
2-
from typing import Any, SupportsIndex, TypeVar, overload
2+
from typing import Any, SupportsIndex, overload
3+
from typing_extensions import TypeVar
34

45
import numpy as np
56
from numpy._typing import ArrayLike, NDArray, _ArrayLike, _Shape, _ShapeLike

src/numpy-stubs/lib/_twodim_base_impl.pyi

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

45
import numpy as np
56
from numpy._typing import (

src/numpy-stubs/lib/_type_check_impl.pyi

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

45
import numpy as np
56
from numpy._typing import ArrayLike, NBitBase, NDArray, _64Bit, _ArrayLike, _ScalarLike_co, _SupportsDType

src/numpy-stubs/lib/_ufunclike_impl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, TypeVar, overload
1+
from typing import Any, overload
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45
from numpy._typing import NDArray, _ArrayLikeFloat_co, _ArrayLikeObject_co, _FloatLike_co

src/numpy-stubs/linalg/_linalg.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ from typing import (
66
SupportsIndex,
77
SupportsInt,
88
TypeAlias,
9-
TypeVar,
109
overload,
1110
)
11+
from typing_extensions import TypeVar
1212

1313
import numpy as np
1414
from numpy import vecdot # noqa: ICN003

src/numpy-stubs/ma/core.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Incomplete
22
from collections.abc import Callable
3-
from typing import Any, TypeVar
4-
from typing_extensions import Self
3+
from typing import Any
4+
from typing_extensions import Self, TypeVar
55

66
import numpy as np
77
from numpy import amax, amin, angle, bool_, clip, expand_dims, indices, squeeze # noqa: ICN003

src/numpy-stubs/ma/mrecords.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete
2-
from typing import Any, TypeVar
2+
from typing import Any
3+
from typing_extensions import TypeVar
34

45
import numpy as np
56

src/numpy-stubs/polynomial/_polybase.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ from typing import (
88
Final,
99
Generic,
1010
Literal,
11-
LiteralString,
12-
Self,
1311
SupportsIndex,
1412
TypeAlias,
1513
TypeGuard,
1614
overload,
1715
)
18-
from typing_extensions import TypeVar
16+
from typing_extensions import LiteralString, Self, TypeVar
1917

2018
import numpy as np
2119
import numpy.typing as npt

src/numpy-stubs/polynomial/_polytypes.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ from collections.abc import Callable, Sequence
22
from typing import (
33
Any,
44
Literal,
5-
LiteralString,
65
NoReturn,
76
Protocol,
8-
Self,
97
SupportsIndex,
108
SupportsInt,
119
TypeAlias,
1210
overload,
1311
type_check_only,
1412
)
15-
from typing_extensions import TypeVar
13+
from typing_extensions import LiteralString, Self, TypeVar
1614

1715
import numpy as np
1816
import numpy.typing as npt

src/numpy-stubs/polynomial/chebyshev.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ from typing import (
44
Concatenate,
55
Final,
66
Literal as L,
7-
TypeVar,
87
overload,
98
)
9+
from typing_extensions import TypeVar
1010

1111
import numpy as np
1212
import numpy.typing as npt

src/numpy-stubs/polynomial/hermite.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Final, Literal as L, TypeVar
1+
from typing import Any, Final, Literal as L
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45

src/numpy-stubs/polynomial/hermite_e.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Final, Literal as L, TypeVar
1+
from typing import Any, Final, Literal as L
2+
from typing_extensions import TypeVar
23

34
import numpy as np
45

src/numpy-stubs/polynomial/polyutils.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ from typing import (
55
Literal,
66
SupportsIndex,
77
TypeAlias,
8-
TypeVar,
98
overload,
109
)
10+
from typing_extensions import TypeVar
1111

1212
import numpy as np
1313
import numpy.typing as npt

0 commit comments

Comments
 (0)