Skip to content
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

Clean the walk function in rope.base.ast #536

Merged
merged 2 commits into from Nov 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions rope/base/ast.py
Expand Up @@ -22,7 +22,7 @@ def parse(source, filename="<string>"):
raise error


def walk(node, walker):
def walk(node, walker) -> None:
"""Walk the syntax tree"""
method_name = "_" + node.__class__.__name__
method = getattr(walker, method_name, None)
Expand All @@ -31,7 +31,8 @@ def walk(node, walker):
# In python < 2.7 ``node.module == ''`` for relative imports
# but for python 2.7 it is None. Generalizing it to ''.
node.module = ""
return method(node)
method(node)
return
for child in get_child_nodes(node):
walk(child, walker)

Expand Down