Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed Dec 2, 2024
1 parent 2eedc81 commit 1fd4df1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions src/cattrs/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,14 +963,6 @@ def _get_dis_func(
# logic.
union_types = tuple(e for e in union_types if e is not NoneType)

# TODO: technically both disambiguators could support TypedDicts too
if not all(has(get_origin(e) or e) for e in union_types):
raise StructureHandlerNotFoundError(
"Only unions of attrs classes and dataclasses supported "
"currently. Register a structure hook manually.",
type_=union,
)

return create_default_dis_func(
self,
*union_types,
Expand Down
2 changes: 1 addition & 1 deletion src/cattrs/disambiguators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def is_supported_union(typ: Any) -> bool:
"""Whether the type is a union of attrs classes."""
"""Whether the type is a union of attrs classes or dataclasses."""
return is_union_type(typ) and all(
e is NoneType or has(get_origin(e) or e) for e in typ.__args__
)
Expand Down

0 comments on commit 1fd4df1

Please sign in to comment.