@@ -45,15 +45,15 @@ class ArraySpec:
45
45
role : Literal ["coord" , "data" ]
46
46
"""Role of the array."""
47
47
48
- default : Any
49
- """Default value of the array."""
50
-
51
- dims : Dims = ()
48
+ dims : Dims
52
49
"""Dimensions of the array."""
53
50
54
- dtype : Optional [AnyDType ] = None
51
+ dtype : Optional [AnyDType ]
55
52
"""Data type of the array."""
56
53
54
+ default : Any
55
+ """Default value of the array."""
56
+
57
57
origin : Optional [Type [DataClass [Any ]]] = None
58
58
"""Dataclass as origins of name, dims, and dtype."""
59
59
@@ -85,12 +85,12 @@ class ScalarSpec:
85
85
role : Literal ["attr" , "name" ]
86
86
"""Role of the scalar."""
87
87
88
+ type : Any
89
+ """Type (hint) of the scalar."""
90
+
88
91
default : Any
89
92
"""Default value of the scalar."""
90
93
91
- dtype : Any
92
- """Data type of the scalar."""
93
-
94
94
95
95
class SpecDict (Dict [str , AnySpec ]):
96
96
"""Dictionary of any specifications."""
@@ -178,22 +178,24 @@ def get_spec(field: AnyField) -> Optional[AnySpec]:
178
178
return ArraySpec (
179
179
name = name ,
180
180
role = role .value ,
181
+ dims = (), # dummy
182
+ dtype = None , # dummy
181
183
default = field .default ,
182
184
origin = get_dataclass (field .type ),
183
185
)
184
186
except TypeError :
185
187
return ArraySpec (
186
188
name = name ,
187
189
role = role .value ,
188
- default = field .default ,
189
190
dims = get_dims (field .type ),
190
191
dtype = get_dtype (field .type ),
192
+ default = field .default ,
191
193
)
192
194
193
195
if role is Role .ATTR or role is Role .NAME :
194
196
return ScalarSpec (
195
197
name = name ,
196
198
role = role .value ,
199
+ type = get_annotated (field .type ),
197
200
default = field .default ,
198
- dtype = get_annotated (field .type ),
199
201
)
0 commit comments