Closed burnpanck closed 6 months ago
I don't have any experience with MyPy, but my gut feeling is that these tools always will have limited support to dynamic generation of entities. It may be feasible to spell out the exceptions instead of the codes and then generate the codes from the exception classes, but I guess this is probably not desirable anyway. The most conforming way would probably be to just spell out both the codes and the classes explicitly, and add a check for completeness somewhere in the tests.
There is a competing PR #336 whose changes would boil down to spelling the types out explicitly.
This is good input (with some caveats, eg. that an
assert
statement can never do security critical checks because it is skipped withpython -O
, or in that access tolocals()
andtype()
would be superior toeval
because it is not prone to code injection), but I think I we'll have to do it differently for the #336 reasons.