Skip to content

Switch to storing AST nodes on the stack for more accurate method signature check and easy access to parent nodes #623

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stefmolin
Copy link
Contributor

AST nodes have knowledge of their children, but not their parents which is why we use a stack in the DocstringVisitor. Currently it is used to track a node's unambiguous name (e.g., my_module.MyClass.__init__). This PR changes that to store the AST nodes themselves, which allows us to use a node's ancestry for more robust logic. For example, with this change, we can distinguish between a function and a method, and more precisely determine whether to ignore self and cls parameters in a signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant