Skip to content

Conversation

@rchen152
Copy link
Contributor

I have made things!

Improves the mypy plugin to drop str from the types of labels created via gettext_lazy.

Instead of calculating and passing around a bool indicating whether an enum has any lazy label, the code now calculates a _LabelLaziness enum with three members - LAZY, NON_LAZY, and MIXED - and drops str from the label type for _LabelLaziness.LAZY.

Related issues

Closes #2887

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Great stuff! Thanks a lot!

@sobolevn sobolevn merged commit 32c3835 into typeddjango:master Oct 31, 2025
43 checks passed
@rchen152 rchen152 deleted the enum_label_type branch October 31, 2025 06:31
@ngnpope
Copy link
Member

ngnpope commented Oct 31, 2025

Thanks for the improvement! I completely overlooked that we can be more specific here. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Why do enum labels have type _StrOrPromise rather than _StrPromise?

3 participants