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
PR: Second round: clean imports and qualifiers #584
Conversation
@lieryan I plan no more commits to this branch. |
rope/refactor/functionutils.py
Outdated
@@ -1,7 +1,6 @@ | |||
import rope.base.exceptions | |||
import rope.base.pyobjects | |||
# import rope.base.exceptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import?
# import rope.base.exceptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. I'll remove that comment.
@edreamleo thanks for doing this. Maybe rather than adding comments about the full import qualification, we should just document this centrally? I'd recommend a new section in |
@lieryan But who reads "central" documentation? I like to document the code in place if it's not too odious. |
@lieryan I see you have already updated master, so I'll use your suggested code. |
@lieryan I'm good with this PR now. We could quibble about exactly when to use full qualification, but who would want to do that :-) |
Import style consistency is nice, but I'm personally not too fussed if sometimes we forget about it and a couple non compliant imports slipped in 🤷♂️. If necessary, in the future, we can write a pre-commit/GHA script to enforce the import style. So that it'll always be consistent without needing the comments. It seems like it can be a useful capability for Though I think I'm getting too much into ideas mode here, let's pull back before I get in too deep into this. |
Agreed, the comments are fine as is for now, it's not a blocker for this PR. |
This PR continues PR #583. This PR suggests a consistent style for imports, thereby regularizing (minimizing) qualified names. All changes should be straightforward and uncontroversial.
This PR adds or maintains (with new comments) fully qualified names for
builtins
,change
,fscommands
, andwildcards
when those names would clash with other names.This PR removes qualifications for modules (like pyobjects and several others) whose names conflict neither with the names other modules (in stdlib or Rope) nor other vars.
Note: The qualification of
ast
remains completely unchanged. Some files userope.base.ast
; other files accessrope.base.ast
with an unqualifiedast
.