Merge in TypeVars and Generic base classes in ApplyTypeAnnotationVisitor#596
Merge in TypeVars and Generic base classes in ApplyTypeAnnotationVisitor#596stroxler merged 1 commit intoInstagram:mainfrom martindemello:typevar
Conversation
* Tracks TypeVars that are used in type annotations in the pyi file, and adds their Assign statements to the merged file. * Adds Generic[T] as a base class if needed.
stroxler
left a comment
There was a problem hiding this comment.
This looks great, thanks!
One question for you: will it work for your use case to match on just TypeVar, under the assumption that a stub always uses from typing import TypeVar?
Reason being, I think the current match won't work if the call is to typing.TypeVar.
If that's good enough for you, I'd say let's merge and I'll look at generalizing later. If not, my suggestion would be to get rid of the filter on Name, and instead use the qualified name provider to get the full name and compare to typing.TypeVar.
|
yes, i think just |
stroxler
left a comment
There was a problem hiding this comment.
Sounds good.
I'll aim to use QalifiedNameProvider at some later point but happy to unblock you now
adds their Assign statements to the merged file.