Skip to content

Fix all current mypy ignores#1827

Draft
puddly wants to merge 53 commits into
zigpy:devfrom
puddly:puddly/typing-fixes
Draft

Fix all current mypy ignores#1827
puddly wants to merge 53 commits into
zigpy:devfrom
puddly:puddly/typing-fixes

Conversation

@puddly

@puddly puddly commented May 30, 2026

Copy link
Copy Markdown
Collaborator

This is a (massive) typing-only PR that fixes all of the mypy ignores we currently use in zigpy. Untyped definitions are the only last hurdle and those should be fixable in a future PR. There are a few noisy checks like unreachable and redundant-expr that likely can be inlined at some point, allowing us to get rid of the mypy ignore config in its entirety.

All changes are compatible with both ZHA and quirks. There is a lot of internal type reshuffling, some hierarchy cleanup, and a few strange uses of if TYPE_CHECKING but overall the fixes are straightforward.

Mypy by default isn't very strict so I've also enabled more flags and repopulated the ignore lists again, bringing us back to square one.

@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.54751% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.50%. Comparing base (e891a9f) to head (d3806de).

Files with missing lines Patch % Lines
zigpy/zcl/foundation.py 96.55% 2 Missing ⚠️
zigpy/ota/providers.py 95.83% 1 Missing ⚠️
zigpy/quirks/v2/__init__.py 97.72% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1827      +/-   ##
==========================================
- Coverage   99.54%   99.50%   -0.04%     
==========================================
  Files          64       64              
  Lines       13213    13238      +25     
==========================================
+ Hits        13153    13173      +20     
- Misses         60       65       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant