Skip to content

Commit 12f7f51

Browse files
πŸ—‘οΈ mark NBitBase as deprecated in type stubs (#425)
* πŸ—‘οΈ mark`NBitBase` as deprecated in type stubs * πŸ—‘οΈ update deprecation message for `NBitBase` Co-Authored-By: Joren Hammudoglu <[email protected]> * πŸ“ add documentation link for `NBitBase` deprecation Co-Authored-By: Joren Hammudoglu <[email protected]> --------- Co-authored-by: Joren Hammudoglu <[email protected]>
1 parent 4f8a355 commit 12f7f51

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

β€Žsrc/numpy-stubs/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,9 @@ _SignedIntegerT = TypeVar("_SignedIntegerT", bound=signedinteger)
670670
_UnsignedIntegerT = TypeVar("_UnsignedIntegerT", bound=unsignedinteger)
671671
_CharT = TypeVar("_CharT", bound=character)
672672

673-
_BitT = TypeVar("_BitT", bound=NBitBase, default=Any)
674-
_BitT1 = TypeVar("_BitT1", bound=NBitBase, default=Any)
675-
_BitT2 = TypeVar("_BitT2", bound=NBitBase, default=_BitT1)
673+
_BitT = TypeVar("_BitT", bound=NBitBase, default=Any) # pyright: ignore[reportDeprecated]
674+
_BitT1 = TypeVar("_BitT1", bound=NBitBase, default=Any) # pyright: ignore[reportDeprecated]
675+
_BitT2 = TypeVar("_BitT2", bound=NBitBase, default=_BitT1) # pyright: ignore[reportDeprecated]
676676

677677
_ItemT_co = TypeVar("_ItemT_co", default=Any, covariant=True)
678678
_BoolItemT_co = TypeVar("_BoolItemT_co", bound=py_bool, default=py_bool, covariant=True)

β€Žsrc/numpy-stubs/_typing/_nbit_base.pyi

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# mypy: disable-error-code="misc"
22
from typing import final, type_check_only
3+
from typing_extensions import deprecated
34

45
# exported as numpy.typing.NBitBase
56

7+
# Documentation: https://numpy.org/numtype/user_guide/differences/#no-more-nbitbase
68
@final
9+
@deprecated(
10+
"NBitBase is deprecated and should not be used. "
11+
"NumPy scalar types are now concrete and no longer accept generic bounds like np.floating[T]. "
12+
"Use abstract types (e.g., np.floating) as bounds instead."
13+
)
714
class NBitBase: ...
815

916
###
1017
#
1118

1219
# long double
1320
@type_check_only
14-
class _64L(NBitBase): ... # pyright: ignore[reportGeneralTypeIssues]
21+
class _64L(NBitBase): ... # pyright: ignore[reportDeprecated, reportGeneralTypeIssues]
1522

1623
@type_check_only
1724
class _64(_64L): ...

0 commit comments

Comments
Β (0)