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

Fix annotations for statement method #2366

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Jan 28, 2024

Description

Statement isn't exported form astroid.nodes (anymore ?). All other annotations were updated to use _base_nodes.Statement. It seems these two were missed.

--
Side note
Any particular reason the base_nodes module should be considered private, i.e. prefixed with _? Probably missed that discussion.

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a82d9d9) 92.86% compared to head (f26a645) 92.86%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2366   +/-   ##
=======================================
  Coverage   92.86%   92.86%           
=======================================
  Files          94       94           
  Lines       11072    11072           
=======================================
  Hits        10282    10282           
  Misses        790      790           
Flag Coverage Δ
linux 92.67% <100.00%> (ø)
pypy 91.00% <100.00%> (ø)
windows 92.45% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
astroid/filter_statements.py 98.91% <100.00%> (ø)
astroid/nodes/node_ng.py 93.61% <100.00%> (ø)

@jacobtylerwalls
Copy link
Member

Daniël proposed it here:

mixins.py isn't included in the init.py of astroid and don't provide much use to anybody without actually using the nodes themselves. So I think we can consider this private API.

@cdce8p
Copy link
Member Author

cdce8p commented Jan 28, 2024

Daniël proposed it here:

mixins.py isn't included in the init.py of astroid and don't provide much use to anybody without actually using the nodes themselves. So I think we can consider this private API.

Hmm 🤔 Just interesting that we need to import _base_nodes even in pylint. The nodes.Statement issue exists there too. So it's probably not all that private...

@Pierre-Sassoulas
Copy link
Member

I agree with @cdce8p if we use the import in pylint it should be public (even if it's only for typing I guess).

@DanielNoord
Copy link
Collaborator

I think my main rationale was that it is an implementation detail and ideally should be exported as a Protocol. Making it private gave a bit more flexibility while we were still refactoring the code to become fully typed/type-safe.

However, I burned out quite a bit on trying to fully type astroid as it just seems impossible. I would be okay with making it public, but don't think plugin writers should really need it. It seems private to our "core" library. Not sure how we should indicate it as being so.

@jacobtylerwalls jacobtylerwalls merged commit 3e8f21d into pylint-dev:main Jan 31, 2024
21 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 31, 2024
@cdce8p cdce8p deleted the fix-annotation-statement branch January 31, 2024 14:39
jacobtylerwalls pushed a commit that referenced this pull request Jan 31, 2024
(cherry picked from commit 3e8f21d)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
@Pierre-Sassoulas Pierre-Sassoulas added backported Assigned once the backport is done and removed backport maintenance/3.3.x labels Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Assigned once the backport is done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants