Skip to content

Commit

Permalink
Cast field_type to being a type
Browse files Browse the repository at this point in the history
  • Loading branch information
fleonce committed Jan 10, 2025
1 parent f0f7bc4 commit 6da2d4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion with_argparse/configure_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _call_dataclass(self, args: Sequence[Any], kwargs: Mapping[str, Any]):
field_default = field.default if not field_required else None
field_type = field.type
if isinstance(field_type, str):
field_type = field_hints.get(field.name)
field_type = typing.cast(type, field_hints.get(field.name))

known_types = {type, Literal, GenericAlias}
if type(field_type) not in known_types and typing.get_origin(field_type) not in known_types:
Expand Down

0 comments on commit 6da2d4d

Please sign in to comment.