Skip to content

Commit

Permalink
docs: Add IntoCondition, _Conditional docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned committed Sep 15, 2024
1 parent 8cad6af commit 2d9f248
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,29 @@ class _ConditionClosed(TypedDict, closed=True, total=False): # type: ignore[cal


class _Conditional(TypedDict, t.Generic[_C], total=False):
"""
A dictionary representation of a conditional encoding or property.
Parameters
----------
condition
One or more (predicate, statement) pairs which each form a condition.
value
An optional default value, used when no predicates were met.
"""

condition: Required[_C]
value: Any


IntoCondition: TypeAlias = Union[ConditionLike, _Conditional[Any]]
"""
Anything that can be converted into a conditional encoding or property.
Notes
-----
Represents all outputs from `when-then-otherwise` conditions, which are not ``SchemaBase`` types.
"""


class _Value(TypedDict, closed=True, total=False): # type: ignore[call-arg]
Expand Down

0 comments on commit 2d9f248

Please sign in to comment.