-
-
Notifications
You must be signed in to change notification settings - Fork 305
Update astroid nodes import #2833
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2833 +/- ##
==========================================
- Coverage 93.37% 93.36% -0.01%
==========================================
Files 92 92
Lines 11148 11139 -9
==========================================
- Hits 10409 10400 -9
Misses 739 739
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
LGTM. We could probably remove the reexport in 5.0 and add a deprecation now ?
Sounds good. Will add the deprecation in a separate PR. |
from astroid.nodes import Const | ||
from astroid.nodes.node_classes import ( | ||
Interpolation, | ||
Match, | ||
MatchAs, | ||
MatchCase, | ||
MatchClass, | ||
MatchMapping, | ||
MatchOr, | ||
MatchSequence, | ||
MatchSingleton, | ||
MatchStar, | ||
MatchValue, | ||
TemplateStr, | ||
Unknown, | ||
) |
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.
Risky to do this in the astroid.nodes package as it's going to easily create circular import, no ?
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.
Good point, though I believe it works in this case. We already use the module import.
astroid/astroid/nodes/as_string.py
Lines 13 to 16 in 0367141
from astroid import nodes | |
if TYPE_CHECKING: | |
from astroid import objects |
I don't believe it will but if something crashes, we can still move the import into the type checking block. We'd only need to add back the in-block import for the isinstance
check in visit_matchas
.
Description
pylint-dev/pylint#10592
Update node imports to use
from astroid import nodes
instead.If we want to, we could consider deprecating the re-export in
astroid/__init__.py
at some point.astroid/astroid/__init__.py
Lines 83 to 167 in 7c3b481