Skip to content

Commit 80a0812

Browse files
committed
docs: Replace markdown syntax with rst directives
1 parent 7d41219 commit 80a0812

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

altair/vegalite/v5/api.py

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -892,53 +892,51 @@ def when(
892892
empty: _AltOptional[bool] = Undefined,
893893
**constraints: _FieldEqualType,
894894
) -> _When:
895-
"""Start a `when-then-otherwise` condition.
895+
"""Start a ``when-then-otherwise`` condition.
896896
897-
The resulting predicate is an `AND` reduction over `predicate` and optional `*`, `**`, arguments.
897+
The resulting predicate is an ``AND`` reduction over ``predicate`` and optional ``*``, ``**``, arguments.
898898
899899
Parameters
900900
----------
901901
predicate
902902
A selection or test predicate.
903-
`str` input will be treated as a test operand.
903+
``str`` input will be treated as a test operand.
904904
*more_predicates
905-
Additional predicates, restricted to types supporting `&`.
905+
Additional predicates, restricted to types supporting ``&``.
906906
empty
907-
For selection parameters, the predicate of empty selections returns `True` by default.
908-
Override this behavior, with `empty=False`.
907+
For selection parameters, the predicate of empty selections returns ``True`` by default.
908+
Override this behavior, with ``empty=False``.
909909
**constraints
910-
Specify [Field Equal Predicate](https://vega.github.io/vega-lite/docs/predicate.html#equal-predicate)'s.
911-
Shortcut for `alt.datum.field_name == value`, see examples for usage.
910+
Specify `Field Equal Predicate <https://vega.github.io/vega-lite/docs/predicate.html#equal-predicate/>`__'s.
911+
Shortcut for ``alt.datum.field_name == value``, see examples for usage.
912912
913913
Returns
914914
-------
915-
When
916-
A partial state which requires calling `then(statement)` to finish the condition.
915+
result: When
916+
A partial state which requires calling ``result.then(statement)`` to finish the condition.
917917
918918
Notes
919919
-----
920-
- Directly inspired by the `when-then-otherwise` syntax used in `polars.when`.
921-
- `predicate` accepts all inputs valid in `alt.condition(predicate=...)`
920+
- Directly inspired by the ``when-then-otherwise`` syntax used in ``polars.when``.
921+
- ``predicate`` accepts all inputs valid in ``alt.condition(predicate=...)``
922922
923923
References
924924
----------
925-
[polars.when](https://docs.pola.rs/py-polars/html/reference/expressions/api/polars.when.html)
925+
`polars.when <https://docs.pola.rs/py-polars/html/reference/expressions/api/polars.when.html/>`__
926926
927927
Examples
928928
--------
929-
Using keyword-argument `constraints` can simplify compositions like:
930-
931-
```py
932-
import altair as alt
933-
verbose_composition = (
934-
(alt.datum.Name == "Name_1")
935-
& (alt.datum.Color == "Green")
936-
& (alt.datum.Age == 25)
937-
& (alt.datum.StartDate == "2000-10-01")
938-
)
939-
when_verbose = alt.when(verbose_composition)
940-
when_concise = alt.when(Name="Name_1", Color="Green", Age=25, StartDate="2000-10-01")
941-
```
929+
Using keyword-argument ``constraints`` can simplify compositions like::
930+
931+
import altair as alt
932+
verbose_composition = (
933+
(alt.datum.Name == "Name_1")
934+
& (alt.datum.Color == "Green")
935+
& (alt.datum.Age == 25)
936+
& (alt.datum.StartDate == "2000-10-01")
937+
)
938+
when_verbose = alt.when(verbose_composition)
939+
when_concise = alt.when(Name="Name_1", Color="Green", Age=25, StartDate="2000-10-01")
942940
"""
943941
# TODO
944942
# ----

doc/user_guide/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ API Functions
166166
topo_feature
167167
value
168168
vconcat
169+
when
169170

170171
Low-Level Schema Wrappers
171172
-------------------------

0 commit comments

Comments
 (0)