File tree Expand file tree Collapse file tree
src/odin/annotated_resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,15 +172,15 @@ def construct_field(self) -> Field:
172172def _create_field_from_list_type (args : tuple , options : Options ) -> BaseField :
173173 """Handle the various types of list."""
174174 if args :
175- (field ,) = args
175+ (tp ,) = args
176176 # Use get origin to determine if value is also sub-scripted. This is
177177 # required as issubclass cannot be used on sub-scripted fields.
178- if not (get_origin ( field ) or field is Any ) and issubclass (field , ResourceBase ):
179- options .field_args ["resource" ] = field
178+ if not (tp is Any or get_origin ( tp )) and issubclass (tp , ResourceBase ):
179+ options .field_args ["resource" ] = tp
180180 options .field_type = ListOf
181181
182182 else :
183- options .field_args ["field" ] = process_attribute (field )
183+ options .field_args ["field" ] = process_attribute (tp )
184184 options .field_type = TypedListField
185185 else :
186186 options .field_type = ListField
@@ -285,6 +285,9 @@ def _create_field_for_type(tp, options: Options) -> Field:
285285 # Is a basic type
286286 if isinstance (tp , type ):
287287 _set_options_field_type (options , tp )
288+ elif tp is Any :
289+ # For Python 3.10
290+ options .field_type = AnyField
288291 else :
289292 msg = f"Annotation is not a type instance { tp !r} "
290293 raise ResourceDefError (msg )
You can’t perform that action at this time.
0 commit comments