Skip to content

Commit facb65a

Browse files
committed
jitclass type stubs
1 parent ab13490 commit facb65a

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎maint/stubtest/allowlist.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ numba\.core\.untyped_passes\..*
2323
numba\.core\.utils\..*
2424
numba\.cpython\..*
2525
numba\.cuda\..*
26-
numba\.experimental\..*
26+
numba\.experimental\.structref
2727
numba\.misc\.POST
2828
numba\.misc\.appdirs\..*
2929
numba\.misc\.coverage_support\..*
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from collections.abc import Mapping, Sequence
2+
from typing import Protocol, TypeAlias, overload, type_check_only
3+
4+
from typing_extensions import TypeVar
5+
6+
from numba.core import types
7+
8+
###
9+
10+
_ToSpec: TypeAlias = Mapping[str, types.Type] | Sequence[tuple[str, types.Type]]
11+
12+
_ClsT = TypeVar("_ClsT", bound=type)
13+
14+
@type_check_only
15+
class _Wrap(Protocol):
16+
def __call__(self, cls: _ClsT) -> _ClsT: ...
17+
18+
###
19+
20+
@overload
21+
def jitclass(cls_or_spec: None = None, spec: _ToSpec | None = None) -> _Wrap: ...
22+
@overload
23+
def jitclass(cls_or_spec: _ToSpec, spec: None = None) -> _Wrap: ...
24+
@overload
25+
def jitclass(cls_or_spec: _ClsT, spec: _ToSpec | None = None) -> _ClsT: ...

0 commit comments

Comments
 (0)