-
Notifications
You must be signed in to change notification settings - Fork 793
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
refactor: Simplify channels.py
overloads
#3659
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Trying to unpack all the recursion, this change has no impact on codegen
Trying to narrow down the differences, so that this logic can eventually be removed.
For transforming annotations from mixed or partial sources
- Safer, since an existing remapping could have been `pop()`'d - Quite a lot more explicit
This initial suite has highlighted some (pre-existing) issues with the `@overload` defs Pushing to demonstrate the need for changes in subsequent commits
dangotbanned
added a commit
that referenced
this pull request
Oct 27, 2024
Discovered while writing tests for #3659. The attribute syntax version is what is displayed, but the method syntax one was not equivalent. Results in no `titleColor` being applied and is silently ignored during validation. https://altair-viz.github.io/gallery/layered_chart_with_dual_axis.html
Was originally going to remove the negative (ignore) cases. Think they are actually a good idea to keep, to confirm assumptions of signatures
These all use property setters, but provide a fully constructed object - as a single positional-only argument.
No overload variant of "to_type_repr" of "SchemaInfo" matches argument types "str", "bool" [call-overload]
dangotbanned
commented
Oct 27, 2024
dangotbanned
commented
Oct 27, 2024
Reducing code lines while still passing tests is always something to cheer for👍 |
**Pushing this as an example only** Intended to support the description I gave as *solution 2* in #3659 (comment) c6f0df8
Also aligns a missed `attr` -> `prop` rename
I expect that syntax will probably be unfamiliar to most. Tried (and failed) to find an example in the [docs](https://docs.python.org/3/reference/expressions.html#yield-expressions) I think I picked it up from [more_itertools](https://github.com/more-itertools/more-itertools/blob/abbcfbce24cb59e62e01daac4d80f9658202708a/more_itertools/more.py)
dangotbanned
changed the title
refactor(DRAFT): Simplify
refactor: Simplify Oct 28, 2024
channels.py
overloadschannels.py
overloads
dangotbanned
commented
Oct 29, 2024
References the thread for context #3659 (comment)
mattijn
approved these changes
Oct 29, 2024
Thanks for reviewing @mattijn! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR significantly reduces the number of
@overload
definitions for channel property setters.At the same time, it makes many of them more permissive (
Sequence
vslist
) and adds support for(datetime|date)
.Supporting
(datetime|date)
was my original aim, following #3653.However, once I had a better understanding of the prior
codegen.py
these changes came together.Tasks
tools/*
.schemapi.utils
commits.schemapi.codegen
commitchannels.py
overloads #3659 (commits)Deferred
list[core.ConditionalValueDef...]
api._Conditions
would be the equivalentRelated