-
Notifications
You must be signed in to change notification settings - Fork 794
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
feat(typing): Further simplify generated Literal
aliases
#3469
Conversation
AutosizeType_T: TypeAlias = Literal["pad", "none", "fit", "fit-x", "fit-y"] | ||
AxisOrient_T: TypeAlias = Literal["top", "bottom", "left", "right"] | ||
Baseline_T: TypeAlias = Literal["top", "middle", "bottom"] | ||
BinnedTimeUnit_T: TypeAlias = Literal[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the alias that I was aiming for when I opened this and below is an example of where it would appear.
Before
After
Everything else was a bonus
@@ -101,23 +101,47 @@ def add_literal( | |||
tp = alias | |||
elif (alias := self._literals_invert.get(tp)) and replace: | |||
tp = alias | |||
elif replace and info.is_union_enum(): | |||
# Handles one very specific edge case `WindowFieldDef` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Special case referenced in comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thanks! :)
Follow-up to: #3464 and #3431
Literal
s that only appear as part of aUnion
are now replaced by theUnion
(in all but 1 case)Literal
s in docstrings &TypeAlias
's in annotations now appear after all other types_typing.py
now has an autogenerated__all__