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

[flake8-pyi] Fix false negative for PYI046 with unused generic protocols #9405

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jan 5, 2024

I just fixed this false negative in flake8-pyi (PyCQA/flake8-pyi#460), and then realised ruff has the exact same bug! Luckily it's a very easy fix.

(The bug is that unused protocols go undetected if they're generic.)

@AlexWaygood AlexWaygood marked this pull request as draft January 5, 2024 18:38
@AlexWaygood AlexWaygood marked this pull request as ready for review January 5, 2024 18:39
Copy link
Contributor

github-actions bot commented Jan 5, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+2 -0 violations, +0 -0 fixes in 1 projects; 42 projects unchanged)

python/typeshed (+2 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-preview --select PYI

+ stubs/openpyxl/openpyxl/xml/_functions_overloads.pyi:32:7: PYI046 Private protocol `_HasTagAndGet` is never used
+ stubs/protobuf/google/protobuf/internal/type_checkers.pyi:5:7: PYI046 Private protocol `_ValueChecker` is never used

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PYI046 2 2 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+2 -0 violations, +0 -0 fixes in 1 projects; 42 projects unchanged)

python/typeshed (+2 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview --select PYI

+ stubs/openpyxl/openpyxl/xml/_functions_overloads.pyi:32:7: PYI046 Private protocol `_HasTagAndGet` is never used
+ stubs/protobuf/google/protobuf/internal/type_checkers.pyi:5:7: PYI046 Private protocol `_ValueChecker` is never used

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PYI046 2 2 0 0 0

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@zanieb zanieb merged commit cde4a7d into astral-sh:main Jan 5, 2024
17 checks passed
@AlexWaygood AlexWaygood deleted the pyi046 branch January 5, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants