We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
So I've seen #452 and that "type" alises should work, but I think generic ones are missing.
In [2]: import cattrs In [3]: type Lol = int In [4]: c = cattrs.Converter() In [5]: c.structure(1, Lol) Out[5]: 1 In [6]: type Indexed[T] = T In [7]: c.structure(1, Indexed[int]) ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in <module>:1 │ │ │ │ /Users/rafal/Code/censored/.venv/lib/python3.12/site-packages/cattrs/converters.py:558 in │ │ structure │ │ │ │ 555 │ │ │ 556 │ def structure(self, obj: UnstructuredValue, cl: type[T]) -> T: │ │ 557 │ │ """Convert unstructured Python data structures to structured data.""" │ │ ❱ 558 │ │ return self._structure_func.dispatch(cl)(obj, cl) │ │ 559 │ │ │ 560 │ def get_structure_hook(self, type: Any, cache_result: bool = True) -> StructureHook: │ │ 561 │ │ """Get the structure hook for the given type. │ │ │ │ /Users/rafal/Code/censored/.venv/lib/python3.12/site-packages/cattrs/fns.py:22 in │ │ raise_error │ │ │ │ 19 def raise_error(_, cl: Type) -> NoReturn: │ │ 20 │ """At the bottom of the condition stack, we explode if we can't handle it.""" │ │ 21 │ msg = f"Unsupported type: {cl!r}. Register a structure hook for it." │ │ ❱ 22 │ raise StructureHandlerNotFoundError(msg, type_=cl) │ │ 23 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ StructureHandlerNotFoundError: Unsupported type: Indexed[int]. Register a structure hook for it.
The text was updated successfully, but these errors were encountered:
Interesting, good catch!
Sorry, something went wrong.
No branches or pull requests
Description
So I've seen #452 and that "type" alises should work, but I think generic ones are missing.
What I Did
The text was updated successfully, but these errors were encountered: