File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 8
8
9
9
10
10
# dependencies
11
- from typing_extensions import Literal , TypeAlias , get_type_hints
11
+ from typing_extensions import Literal , ParamSpec , TypeAlias , get_type_hints
12
12
13
13
14
14
# submodules
30
30
31
31
# type hints
32
32
AnySpec : TypeAlias = "ArraySpec | ScalarSpec"
33
- TDataClass = TypeVar ( "TDataClass" , bound = DataClass [...] )
33
+ PInit = ParamSpec ( "PInit" )
34
34
TReturn = TypeVar ("TReturn" , AnyXarray , None )
35
35
36
36
@@ -135,7 +135,7 @@ class DataSpec:
135
135
"""Options for xarray data creation."""
136
136
137
137
@classmethod
138
- def from_dataclass (cls , dataclass : Type [DataClass [... ]]) -> "DataSpec" :
138
+ def from_dataclass (cls , dataclass : Type [DataClass [PInit ]]) -> "DataSpec" :
139
139
"""Create a data specification from a dataclass."""
140
140
specs = SpecDict ()
141
141
@@ -153,7 +153,7 @@ def from_dataclass(cls, dataclass: Type[DataClass[...]]) -> "DataSpec":
153
153
154
154
# runtime functions
155
155
@lru_cache (maxsize = None )
156
- def eval_fields (dataclass : Type [TDataClass ] ) -> Type [TDataClass ]:
156
+ def eval_fields (dataclass : Type [DataClass [ PInit ]] ) -> Type [DataClass [ PInit ] ]:
157
157
"""Evaluate field types of a dataclass."""
158
158
types = get_type_hints (dataclass , include_extras = True )
159
159
You can’t perform that action at this time.
0 commit comments