-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
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
Support stub files semantics (fixes #55) #110
base: master
Are you sure you want to change the base?
Support stub files semantics (fixes #55) #110
Conversation
…rate back the import code. This makes our support for imports complete.
Salut Serge, Cette pull request est prête depuis un bout de temps maintenant. J’aimerai savoir si je peux faire quelque chose pour faire avancer ? Merci |
This PR history is mixing so many things I'm not really encouraged to have a look at it :-) More important: the whole stub file support is not something I need for pythran, so I'm a bit reluctant to integrate it. Beniget is getting more and more complex and it's not something I enjoy. |
Merci pour ton honnêteté, Serge
Je comprends ta réticence.
It's probably possible to subclass
It is Python that turned out to be more complex that we though in my opinion, beniget complexity is just the reflect of the complexity of the Python language. Look at all the bugs we fixed together in the past two years!
Yes very sorry about that. As I suggested, splitting the PR up in two parts would help. Also I should really learn to do proper git-rebases ^^'. Bonne soirée, |
Fixes #55
The first thing this PR does is to greatly improves our understanding of imports, including relative imports, if beniget is given the module name (or if it can deduce the correct module name from the given filename).
This is required not to confuse any TypeVar Name with the actual imported name from typing.py.
Then… why do we need this after all ? Because some feature of the language in stubs alters the name resolution logic in order to special case some expressions. This special cased expressions should then be treated as deferred annotations (so they can contain forward references without the need to be quoted).
See: https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#language-features
More specifically, I'm using this feature to: