PR: Remove from ast import * from rope.base.ast#632
PR: Remove from ast import * from rope.base.ast#632edreamleo wants to merge 4 commits intopython-rope:masterfrom edreamleo:ekr-direct-ast
from ast import * from rope.base.ast#632Conversation
| """Get all the names from a given file using ast.""" | ||
| try: | ||
| root_node = ast.parse(module.read_bytes()) | ||
| root_node = rope.base.ast.parse(module.read_bytes()) |
There was a problem hiding this comment.
As far as I am aware, this should use the stdlib ast parser
There was a problem hiding this comment.
@bagel897 Thanks for you comment! rope.base.ast.parse wraps stdlib.ast.parse: it regularizes the source argument and catches two exceptions. These seem like reasonable things to do.
@lieryan would like to replace the one remaining call to stdlib.ast.parse with a call to rope.base.ast.parse.
I see two remaining tasks before marking this PR as ready for review:
- Merge PR PR: eliminate call_for_nodes #633
so thatrope.base.astwill define only two names:rope_parse(see below) andRopeNodeVisitor. - Merge PR PR: Rename rope.base.ast.parse to rope_parse #635,
removing all ambiguity between the twoparsemethods. - Merge PR PR: Remove 'ast' qualification from refs to RopeNodeVisitor #637,
removing unnecessary qualification ofRopeNodeVisitor.
|
Closed for same reason as #635 (comment). This is not the direction we want to take with |
|
@lieryan I think we both want to move on. However, I would push back just a bit more. I created various PRs thinking that smaller PRs would be more acceptable to you. I didn't mean to badger you. I apologize if you felt put upon. I still think that removing Let's put this discussion in perspective. Only three functions are involved, and I don't much care what they are called, nor do I care much what qualifiers are used, so long as Rope's code uses the qualifiers consistently. |
Another attempt at removing
from ast import *fromrope.base.ast.import astwhenever a module usesstdlib.ast.from rope.base import aststatements.from rope.base.ast import RopeNodeVisitoras needed,removing several different qualifiers from references to
RopeNodeVisitor.ast.parsewithrope.base.ast.parse.rope.base.ast.iter_child_nodeswithast.iter_child_nodes.ast.call_for_nodeswithrope.base.ast.call_for_nodes.rope.base.astqualifiers byastwhen referring tostdlib.astnodes.from rope.base.ast import literal_eval,and qualify
literal_evalwithast.Summary of changes
astalways meansstdlib.ast.rope.base.astqualifications for theparseandcall_for_nodesfunctions.Alternatively, we could rename
ast.pytorast.pyand use therastqualifier.RopeNodeVisitor.In short, all references to
stdlib.astandrope.base.astare uniform and explicit.Update
As noted below, three helper PR's will make most of the changes mentioned above.