diff --git a/fastclasses_json/core.py b/fastclasses_json/core.py index 289e27a..9dee1f4 100644 --- a/fastclasses_json/core.py +++ b/fastclasses_json/core.py @@ -505,24 +505,23 @@ def referenced_types(cls): def extract_types(t): origin = typing_get_origin(t) if origin == tuple and typing_get_args(t): - xs = tuple() for type_arg in typing_get_args(t): - xs += extract_types(type_arg) - return xs - if (origin == typing.Union + yield from extract_types(type_arg) + elif (origin == typing.Union or issubclass_safe(origin, abc.Sequence)) and typing_get_args(t): type_arg = typing_get_args(t)[0] - return extract_types(type_arg) + yield from extract_types(type_arg) elif issubclass_safe(origin, abc.Mapping) and typing_get_args(t): key_type_arg, value_type_arg = typing_get_args(t) if key_type_arg is UUID: - return (UUID,) + extract_types(value_type_arg) - return extract_types(value_type_arg) + yield UUID + yield from extract_types(value_type_arg) elif is_dataclass(t) or issubclass_safe( t, (Enum, date, datetime, Decimal, UUID) ): - return (t,) - return tuple() + yield t + else: + yield from tuple() types = {} for _, field_type in typing.get_type_hints(cls).items(): diff --git a/scripts/version_changelog b/scripts/version_changelog index ed50b63..8c8c5e7 100755 --- a/scripts/version_changelog +++ b/scripts/version_changelog @@ -20,7 +20,7 @@ class ParseError(Exception): def print_usage_and_exit(exit_code=1): out = sys.stdout if exit_code == 0 else sys.stderr print(f"{sys.argv[0]} ", file=out) - exit(1) + exit(exit_code) def parse_version(line): diff --git a/setup.py b/setup.py index 73cec4b..b062de5 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,6 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Intended Audience :: Developers", - "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", ], )