Tin Tvrtković
Tin Tvrtković
@aha79 I think we can evaluate ForwardRefs without causing the recursive issue. An example: ``` import typing from cattr import GenConverter YY = typing.List[typing.Tuple[typing.Optional[typing.ForwardRef("YY")], int]] YY.__args__[0].__args__[0].__args__[0]._evaluate(globals(), locals(), set()) c =...
Hm, interesting. We don't support NewTypes currently (there's an open issue for that), so I don't know if I'm OK with having a NewType hook as part of this thing....
Yep, that sounds like a good start.
Since Python 3.7, explicit subclasses aren't removed from unions any longer. The code snippet from the OP works now: ``` ❯ poetry run python a10.py typing.Union[__main__.BaseClass, __main__.SubClass] BaseClass(base_field=7) SubClass(base_field=8, sub_field='bar')...
Ah sorry, the copy branch took a lot longer than I was expecting. I don't think I have all of these though, if you reopen I will merge in.
Ugh, I've been bitten by the unsafe `issubclass` builtin in another project. I think the easiest solution is just to create our own `is_subclass`, which eats any exceptions and just...
That's a great question, and doing this is definitely one of the use cases for cattrs. The problem is I don't know what the output format would be, so I...
I'm going to be diving into this this week (partially because I need better functionality here too). Thanks for the example, these kinds of use cases are exactly what I...
Hm it looks like the `__note__` PEP got changed in the meantime (https://peps.python.org/pep-0678/), and it now has `.add_note()` and `__notes__` instead of just `__note__`. I'll need to account for this...
Yeah, as you folks found out, `singledispatch` is very inadequate for a bunch of use cases using more abstract types (i.e. not actual classes). That's why after checking singledispatch cattrs...