Skip to content

Commit

Permalink
refactor: add empty as an explicit condition kwarg
Browse files Browse the repository at this point in the history
This was already being handled internally, but now aligns with `when` and provides a documentable parameter.
Related: vega#3485 (comment)
  • Loading branch information
dangotbanned committed Jul 21, 2024
1 parent 72bd84d commit 09c355d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,8 @@ def condition(
predicate: _PredicateType,
if_true: _StatementType,
if_false: _StatementType,
*,
empty: Optional[bool] = Undefined,
**kwargs,
) -> SchemaBase | dict[str, _ConditionType | Any]:
"""A conditional attribute or encoding
Expand All @@ -1513,7 +1515,6 @@ def condition(
spec: dict or VegaLiteSchema
the spec that describes the condition
"""
empty = kwargs.pop("empty", Undefined)
condition = _predicate_to_condition(predicate, empty=empty)
return _condition_to_selection(condition, if_true, if_false, **kwargs)

Expand Down

0 comments on commit 09c355d

Please sign in to comment.