-
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
Supports standard library nodes #46
Supports standard library nodes #46
Conversation
Hey Tristan. The only reason for not using |
The main motivation to use standard library ast nodes is to be compatible with all the code that already exist that is using the standard library. It's not about performance really to me, but I agree it should improve it a little. More specifically, I'm looking at beginet to be the core of a new library which will aim at analyzing the code structure of entire packages and the relationship between them for documentation purposes. My plan it to use beniget to solve these issues twisted/pydoctor#295 twisted/pydoctor#348, by creating a code model which will be used by pydoctor to do the name resolution. One of the challenges is to find the canonical name for each symbols (because one symbol can be imported and accessible in several modules). Another challenge is the handling of Hope this answer your question |
gast has a And thanks for sharing your plan. I'll try to support this by making beniget more robust, as in fixing #44 ! |
I get it... But it's too bad because making But I'll see what I can do about this... |
I’m reopening this pull request (and I’ll update it as well) because I think it’s highly relevant in terms of performance gain. Generating the def use chains takes about a third of the time taken to produce the gast… |
…-library. Partial success only...
We could use a subclass for the standard library nodes, It might be even more clean and do not require to change all the |
I'm marking this PR as draft until I implement a much less intrusive diff |
Salut @serge-sans-paille, J'espère que tu vas bien. Je me permet de te relancer quant à ces changements. L'idée c'est ne plus utiliser Le reste du code spécifique à la librairie standard est dans un nouveau module: La suggestion initiale d'utiliser un mapping C'est pour ça que j'espère vraiment que tu vas considérer ces changements, Merci, |
Hey @tristanlatr . I'm not a big fan of the name based-check, and the additional checks for two different kind of nodes.
instead of
? |
Yes that could work! But |
Après quelques analyses, Le but ici est de rendre la classe Donc ça implique créer les attributs de classes suivant:
Pour Ensuite:
Je ne suis pas certain que passer le module ast de reference par le constructeur est le plus simple: pourquoi pas une classe dérivée et assigner le module Merci, |
Fix #45.
It's still works with
gast
of course. But starting at Pyhton 3.6 beniget provides abeniget.standard
module which has the same public interface as the main module except it works with standard library nodes.All test classes have been adjusted to allow changing the reference ast module, standard library test are implemented as a subclass fo the original test case.