Skip to content

Commit

Permalink
fix: Support already parsed shorthand in FieldChannelMixin
Browse files Browse the repository at this point in the history
Ensures the same output from
```py
alt.Y("count()")
alt.Y(alt.agg.count())
```
  • Loading branch information
dangotbanned committed Jul 26, 2024
1 parent 766d1bf commit 5929a5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion altair/vegalite/v5/schema/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def to_dict(

if shorthand is Undefined:
parsed = {}
elif isinstance(shorthand, str):
elif isinstance(shorthand, (str, dict)):
parsed = parse_shorthand(shorthand, data=context.get("data", None))
type_required = "type" in self._kwds # type: ignore[attr-defined]
type_in_shorthand = "type" in parsed
Expand Down
2 changes: 1 addition & 1 deletion tools/generate_schema_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def to_dict(
if shorthand is Undefined:
parsed = {}
elif isinstance(shorthand, str):
elif isinstance(shorthand, (str, dict)):
parsed = parse_shorthand(shorthand, data=context.get("data", None))
type_required = "type" in self._kwds # type: ignore[attr-defined]
type_in_shorthand = "type" in parsed
Expand Down

0 comments on commit 5929a5e

Please sign in to comment.