sematic-ai / sematic

An open-source ML pipeline development platform
Other
972 stars 59 forks source link

Fix serialization dataclass check #1059

Closed augray closed 1 year ago

augray commented 1 year ago

The code for checking whether a type in serialization.py would fail if given _is_dataclass(Union), because Union has no __dict__. This change fixes it. Note that if you use a bare Union in a function type annotation, you still get the following:

TypeError: Invalid type annotation for argument 'x' of sematic.tests.test_function.f: typing.Union must be parametrized (typing.Union[...] instead of typing.Union).