-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Fix issues with
Chart|LayerChart.encode
, 1.32x speedup to `in…
…fer_encoding_types` (#3444) * fix, doc, perf: Fix issues with `Chart|LayerChart.encode`, 1.33x speedup to `infer_encoding_types` Fixes: - [Sphinx warning](https://altair-viz.github.io/user_guide/generated/toplevel/altair.Chart.html#altair.Chart) on `Chart.encode`. Also incorrectly under `Attributes` section - Preserve static typing previously found in `_encode_signature` but lost after `_EncodingMixin.encode` - Re-running `mypy` output 'Found 63 errors in 47 files (checked 360 source files)', tests/examples Perf: - This was a response to the `TODO` left at the top of `infer_encoding_types` - Will be adding the benchmark to the PR description * fix(typing): Resolve assignment type errors revealed Incompatible types in assignment (expression has type "Chart", variable has type "DataFrame") * fix(typing): Resolve direct arg-type errors revealed `Color` -> `Fill` when passed to `fill` channel * fix(typing): Resolve `alt.condition` overload-related arg-type errors revealed 'error: Argument "color" to "encode" of "_EncodingMixin" has incompatible type "dict[Any, Any] | SchemaBase"; expected "str | Color | dict[Any, Any] | ColorDatum | ColorValue | UndefinedType" [arg-type]' * test: update `infer_encoding_types` tests - New implementation does not use `**kwargs`, which eliminates an entire class of tests based on `.encode(invalidChannel=...)` as these now trigger a runtime error * test: Rename `invalidChannel` to `invalidArgument` Fixes https://github.com/vega/altair/pull/3444/files/e4ab7052e9a1e62ff1fd80379864489c69a1e020#r1657008627 * chore: remove PR note comment Fixes #3444 (comment) * docs: fix typo * Exclude LookupData export from core.py to fix issue with mypy where it assumes that altair.LookupData comes from core.py instead of api.py * Remove 'pd' and 'jsonschema' from __init__.py __all__. Unclear why they show up only now... * Format code --------- Co-authored-by: Stefan Binder <[email protected]> Co-authored-by: Mattijn van Hoek <[email protected]>
- Loading branch information
1 parent
79783ef
commit c82f8c2
Showing
13 changed files
with
568 additions
and
457 deletions.
There are no files selected for viewing
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
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
Oops, something went wrong.