Skip to content
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 34 commits into from
Oct 29, 2024
Merged

Conversation

dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Oct 26, 2024

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 vs list) 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

Deferred

  • Replacing 45x list[core.ConditionalValueDef...]
    • api._Conditions would be the equivalent

Related

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]
@mattijn
Copy link
Contributor

mattijn commented Oct 27, 2024

Reducing code lines while still passing tests is always something to cheer for👍

@dangotbanned dangotbanned changed the title refactor(DRAFT): Simplify channels.py overloads refactor: Simplify channels.py overloads Oct 28, 2024
@dangotbanned dangotbanned marked this pull request as ready for review October 29, 2024 10:12
@dangotbanned dangotbanned marked this pull request as draft October 29, 2024 15:43
@dangotbanned
Copy link
Member Author

Thanks for reviewing @mattijn!

@dangotbanned dangotbanned merged commit 2d812af into main Oct 29, 2024
21 checks passed
@dangotbanned dangotbanned deleted the property-setters-redux branch October 29, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants