33
44# standard library
55from types import FunctionType
6- from typing import Any , Callable , Dict , Hashable , Iterable , Optional , Tuple , overload
6+ from typing import Any , Callable , Hashable , Iterable , Optional , overload
77
88
99# dependencies
@@ -193,9 +193,9 @@ def asseries(obj: Any, *, factory: Any = None) -> Any:
193193 return squeeze (series )
194194
195195
196- def get_attrs (spec : Spec ) -> Dict [Hashable , Any ]:
196+ def get_attrs (spec : Spec ) -> dict [Hashable , Any ]:
197197 """Derive attributes from a specification."""
198- data : Dict [Hashable , Any ] = {}
198+ data : dict [Hashable , Any ] = {}
199199
200200 for field in spec .fields .of (Tag .ATTR ):
201201 data .update (items (field ))
@@ -217,9 +217,9 @@ def get_columns(spec: Spec) -> Optional[pd.MultiIndex]:
217217 )
218218
219219
220- def get_data (spec : Spec ) -> Dict [Hashable , Any ]:
220+ def get_data (spec : Spec ) -> dict [Hashable , Any ]:
221221 """Derive data from a specification."""
222- data : Dict [Hashable , Any ] = {}
222+ data : dict [Hashable , Any ] = {}
223223
224224 for field in spec .fields .of (Tag .DATA ):
225225 for key , val in items (field ):
@@ -233,7 +233,7 @@ def get_index(spec: Spec) -> Optional[pd.MultiIndex]:
233233 if not (fields := spec .fields .of (Tag .INDEX )):
234234 return None
235235
236- data : Dict [Hashable , Any ] = {}
236+ data : dict [Hashable , Any ] = {}
237237
238238 for field in fields :
239239 for key , val in items (field ):
@@ -251,12 +251,12 @@ def ensure(data: Any, dtype: Optional[str]) -> Any:
251251 data = [data ]
252252
253253 if isinstance (data , (pd .Index , pd .Series )):
254- return type (data )(data , dtype = dtype , copy = False )
254+ return type (data )(data , dtype = dtype , copy = False ) # type: ignore
255255 else :
256256 return pd .array (data , dtype = dtype , copy = False )
257257
258258
259- def items (field : Field ) -> Iterable [Tuple [Hashable , Any ]]:
259+ def items (field : Field ) -> Iterable [tuple [Hashable , Any ]]:
260260 """Generate default(s) of a field specification."""
261261 if field .has (Tag .MULTIPLE ):
262262 yield from field .default .items ()
0 commit comments