Skip to content

[ty] Ban Required, NotRequired and ReadOnly in parameter annotations#22888

Merged
AlexWaygood merged 1 commit intomainfrom
alex/required-type-expression-context
Jan 27, 2026
Merged

[ty] Ban Required, NotRequired and ReadOnly in parameter annotations#22888
AlexWaygood merged 1 commit intomainfrom
alex/required-type-expression-context

Conversation

@AlexWaygood
Copy link
Member

This is mandated by the typing conformance suite

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Jan 27, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

Typing conformance results improved 🎉

The percentage of diagnostics emitted that were expected errors increased from 78.80% to 78.82%. The percentage of expected errors that received a diagnostic increased from 69.23% to 69.32%.

Summary

Metric Old New Diff Outcome
True Positives 747 748 +1 ⏫ (✅)
False Positives 201 201 +0
False Negatives 332 331 -1 ⏬ (✅)
Total Diagnostics 948 949 +1
Precision 78.80% 78.82% +0.02% ⏫ (✅)
Recall 69.23% 69.32% +0.09% ⏫ (✅)

True positives added

Details
Location Name Message
typeddicts_required.py:16:5 invalid-type-form NotRequired is not allowed in function parameter annotations

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 27, 2026

mypy_primer results

Changes were detected when running on open source projects
core (https://github.com/home-assistant/core)
+ homeassistant/util/variance.py:47:12: error[invalid-return-type] Return type does not match returned value: expected `(**_P@ignore_variance) -> _R@ignore_variance`, found `_Wrapped[_P@ignore_variance, int | _R@ignore_variance | float | datetime, _P@ignore_variance, _R@ignore_variance | int | float | datetime]`
- Found 14486 diagnostics
+ Found 14487 diagnostics

No memory usage changes detected ✅

@AlexWaygood AlexWaygood marked this pull request as ready for review January 27, 2026 15:36
@AlexWaygood AlexWaygood merged commit f867db2 into main Jan 27, 2026
50 checks passed
@AlexWaygood AlexWaygood deleted the alex/required-type-expression-context branch January 27, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants