-
Notifications
You must be signed in to change notification settings - Fork 176
Closed
Description
See PR #579.
Background
- rope.base.ast contains five functions: parse, walk, get_child_nodes, call_for_nodes, and get_children.
- Calls to the parse and walk functions appear in many places throughout Rope's code.
- Calls to the get_child_nodes, call_for_nodes, and get_children appear less frequently.
None of these three functions appear in Python's ast module. - Only rope.base.ast.parse calls Python's ast.parse function.
- No calls to Python's ast.walk function appear in Rope's code.
Proposal
It should be straightforward and safe to do the following:
- Delete rope/base/ast.py, moving its functions to rope/base/astutils.py.
As a happy side effect, this will eliminatefrom ast import *from Rope's codebase. - Import
rope.base.astutilsinstead ofrope.base.asteverywhere. - Import Python's
astmodule as needed, including in astutils.py. - Access all functions in rope.base.astutils using the
astutilsqualifier, except within astutils itself.
Rationale
astwill always mean Python'sastmodule.- It will always be clear that
parseandwalkrefer to the functions inastutils.
Update: The new code revealed that _search_in_f_string In rope/refactor/occurrences.py calls the "real" ast.parse and ast.walk functions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels