Repository navigation
Add GenericMeta (so that classes can be Generic when they already hav… - #703
Conversation
|
I just tried this change locally, and it isn't working as advertised yet. Closing for now, until I can get it into a working state. |
|
There's also the issue that GenericMeta isn't part of the documented API of the typing module. It's not in |
|
Even if the only thing that was public was that there was a class of that name, that would be enough to safely typecheck the inheritance from the metaclass, which would allow a class to be typed as Generic while still using its own metaclass as well. |
|
Can you supply an example? (It should at least have *some* functionality in
the other metaclass.)
|
|
https://github.com/cpennington/XBlock/blob/static-typing/xblock/mixins.py#L333-L358 is the particular chunk of code that I was trying to make this work for. (This repo is also the one that was prompting me to make descriptor typing work correctly). |
|
OK, I think I see what you're after. I think we may have to document what you can/cannot do in a class derived from GenericMeta. Does the code in this PR actually make this work for you, or do you need additional mypy changes as well? |
|
It's broken right at the moment. I'll update once I've gotten it to work (my plan is to include as minimal a set of things in the stubs as I need to get that code working). |
|
Ok, this is now sufficient for the code I referenced above. |
|
Can you fix the test failure?
https://travis-ci.org/python/typeshed/jobs/180747613
|
|
Oops, should be fixed now. |
|
Thanks, this looks pretty harmless (and certainly minimal :-). I will merge it, even though I have lingering doubts about what should happen with the keyword args to |
…e a metaclass)