Skip to content

Commit 97a6999

Browse files
Koladata Teamcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 716150459 Change-Id: I2a202153a203ea6c49e859b356d8f3fc721a916f
1 parent 626081d commit 97a6999

File tree

1 file changed

+29
-50
lines changed

1 file changed

+29
-50
lines changed

docs/koda_v1_api_reference.md

Lines changed: 29 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ Returns `x` if `condition` is present, else raises error `message`.
253253
Example:
254254
x = kd.slice(1)
255255
y = kd.slice(2)
256-
kde.assertion.with_assertion(x, x < y, 'x must be less than y') -> x.
257-
kde.assertion.with_assertion(x, x > y, 'x must be greater than y') -> error.
256+
kd.assertion.with_assertion(x, x < y, 'x must be less than y') -> x.
257+
kd.assertion.with_assertion(x, x > y, 'x must be greater than y') -> error.
258258
259259
Args:
260260
x: The value to return if `condition` is present.
@@ -720,13 +720,13 @@ Get items from Lists or Dicts in `x` by `key_or_index`.
720720
Examples:
721721
l = kd.list([1, 2, 3])
722722
# Get List items by range slice from 1 to -1
723-
kde.get_item(l, slice(1, -1)) -> kd.slice([2, 3])
723+
kd.get_item(l, slice(1, -1)) -> kd.slice([2, 3])
724724
# Get List items by indices
725-
kde.get_item(l, kd.slice([2, 5])) -> kd.slice([3, None])
725+
kd.get_item(l, kd.slice([2, 5])) -> kd.slice([3, None])
726726
727727
d = kd.dict({'a': 1, 'b': 2})
728728
# Get Dict values by keys
729-
kde.get_item(d, kd.slice(['a', 'c'])) -> kd.slice([1, None])
729+
kd.get_item(d, kd.slice(['a', 'c'])) -> kd.slice([1, None])
730730
731731
Args:
732732
x: List or Dict DataSlice.
@@ -870,7 +870,7 @@ Aliases:
870870
- [kd.maybe](#kd.maybe)
871871

872872
``` {.no-copy}
873-
A shortcut for kde.get_attr(x, attr_name, default=None).
873+
A shortcut for kd.get_attr(x, attr_name, default=None).
874874
```
875875

876876
### `kd.core.no_bag(ds)` {#kd.core.no_bag}
@@ -1245,8 +1245,8 @@ Aliases:
12451245
Returns DataBag containing updates to a DataSlice of dicts.
12461246
12471247
This operator has two forms:
1248-
kde.dict_update(x, keys, values) where keys and values are slices
1249-
kde.dict_update(x, dict_updates) where dict_updates is a DataSlice of dicts
1248+
kd.dict_update(x, keys, values) where keys and values are slices
1249+
kd.dict_update(x, dict_updates) where dict_updates is a DataSlice of dicts
12501250
12511251
If both keys and values are specified, they must both be broadcastable to the
12521252
shape of `x`. If only keys is specified (as dict_updates), it must be
@@ -1565,8 +1565,8 @@ Aliases:
15651565
Returns a DataSlice with a new DataBag containing updated dicts.
15661566
15671567
This operator has two forms:
1568-
kde.with_dict_update(x, keys, values) where keys and values are slices
1569-
kde.with_dict_update(x, dict_updates) where dict_updates is a DataSlice of
1568+
kd.with_dict_update(x, keys, values) where keys and values are slices
1569+
kd.with_dict_update(x, dict_updates) where dict_updates is a DataSlice of
15701570
dicts
15711571
15721572
If both keys and values are specified, they must both be broadcastable to the
@@ -1807,7 +1807,7 @@ Aliases:
18071807
``` {.no-copy}
18081808
Aligns fn and args/kwargs and calls corresponding fn on corresponding arg.
18091809
1810-
Current implentaion is a wrapper around kde.py.map_py_on_cond (Python
1810+
Current implentaion is a wrapper around kd.py.map_py_on_cond (Python
18111811
based) so it might be slow and intended for experiments only.
18121812
18131813
If certain items of fn are missing, the corresponding items of the result will
@@ -2272,7 +2272,7 @@ Returns a DataSlice of Lists concatenated from the List items of `lists`.
22722272
22732273
Each input DataSlice must contain only present List items, and the item
22742274
schemas of each input must be compatible. Input DataSlices are aligned (see
2275-
`kde.align`) automatically before concatenation.
2275+
`kd.align`) automatically before concatenation.
22762276
22772277
If `lists` is empty, this returns a single empty list with OBJECT item schema.
22782278
@@ -3149,6 +3149,9 @@ input.
31493149
```
31503150

31513151
### `kd.math.cum_max(x, ndim=unspecified)` {#kd.math.cum_max}
3152+
Aliases:
3153+
3154+
- [kd.cum_max](#kd.cum_max)
31523155

31533156
``` {.no-copy}
31543157
Returns the cumulative max of items along the last ndim dimensions.
@@ -3745,24 +3748,7 @@ Aliases:
37453748
- [kd.map_py_on_present](#kd.map_py_on_present)
37463749

37473750
``` {.no-copy}
3748-
Apply python function `fn` to items present in all `args` and `kwargs`.
3749-
3750-
Also see kd.map_py().
3751-
3752-
Args:
3753-
fn: function.
3754-
*args: Input DataSlices.
3755-
schema: The schema to use for resulting DataSlice.
3756-
max_threads: maximum number of threads to use.
3757-
item_completed_callback: A callback that will be called after each item is
3758-
processed. It will be called in the original thread that called
3759-
`map_py_on_present` in case `max_threads` is greater than 1, as we rely on
3760-
this property for cases like progress reporting. As such, it can not be
3761-
attached to the `fn` itself.
3762-
**kwargs: Input DataSlices.
3763-
3764-
Returns:
3765-
Result DataSlice.
3751+
Deprecated. Use kd.map_py instead.
37663752
```
37673753

37683754
### `kd.py.map_py_on_selected(fn, cond, *args, schema=DataItem(None, schema: NONE), max_threads=DataItem(1, schema: INT32), item_completed_callback=DataItem(None, schema: NONE), **kwargs)` {#kd.py.map_py_on_selected}
@@ -4232,7 +4218,7 @@ Converts a string to a named schema, passes through schema otherwise.
42324218
The operator also passes through arolla.unspecified, and raises when
42334219
it receives anything else except unspecified, string or schema DataItem.
42344220
4235-
This operator exists to support kde.entities.new* family of operators.
4221+
This operator exists to support kd.core.new* family of operators.
42364222
42374223
Args:
42384224
name_or_schema: The input name or schema.
@@ -5343,7 +5329,7 @@ dimensions are unchanged. The last two dimensions corresponds to the groups
53435329
and the items within the groups.
53445330
53455331
Values of the DataSlice are the indices of the items within the parent
5346-
dimension. `kde.take(x, kde.group_by_indices(x))` would group the items in
5332+
dimension. `kd.take(x, kd.group_by_indices(x))` would group the items in
53475333
`x` by their values.
53485334
53495335
If sort=True groups are ordered by value, otherwise groups are ordered by the
@@ -5399,7 +5385,7 @@ Aliases:
53995385
- [kd.index](#kd.index)
54005386

54015387
``` {.no-copy}
5402-
Returns the indices of the elements computed over the last dim dimensions.
5388+
Returns the indices of the elements computed over dimension `dim`.
54035389
54045390
The resulting slice has the same shape as the input.
54055391
@@ -7031,6 +7017,10 @@ Alias for [kd.slices.count](#kd.slices.count) operator.
70317017

70327018
Alias for [kd.slices.cum_count](#kd.slices.cum_count) operator.
70337019

7020+
### `kd.cum_max(x, ndim=unspecified)` {#kd.cum_max}
7021+
7022+
Alias for [kd.math.cum_max](#kd.math.cum_max) operator.
7023+
70347024
### `kd.decode_itemid(ds)` {#kd.decode_itemid}
70357025

70367026
Alias for [kd.ids.decode_itemid](#kd.ids.decode_itemid) operator.
@@ -8669,8 +8659,8 @@ Returns size of a Dict.
86698659
Returns DataBag containing updates to a DataSlice of dicts.
86708660
86718661
This operator has two forms:
8672-
kde.dict_update(x, keys, values) where keys and values are slices
8673-
kde.dict_update(x, dict_updates) where dict_updates is a DataSlice of dicts
8662+
kd.dict_update(x, keys, values) where keys and values are slices
8663+
kd.dict_update(x, dict_updates) where dict_updates is a DataSlice of dicts
86748664
86758665
If both keys and values are specified, they must both be broadcastable to the
86768666
shape of `x`. If only keys is specified (as dict_updates), it must be
@@ -9254,17 +9244,6 @@ Returns:
92549244
Returns present iff this DataSlice is a primitive (scalar) Schema.
92559245
```
92569246

9257-
### `DataSlice.is_struct_schema()` {#DataSlice.is_struct_schema}
9258-
9259-
``` {.no-copy}
9260-
Returns present iff this DataSlice represents a Struct Schema.
9261-
9262-
Note that the Entity schema includes Entity, List and Dict schemas.
9263-
9264-
Returns:
9265-
Present iff this DataSlice represents a Struct Schema.
9266-
```
9267-
92689247
### `DataSlice.list_size(self)` {#DataSlice.list_size}
92699248

92709249
``` {.no-copy}
@@ -9274,7 +9253,7 @@ Returns size of a List.
92749253
### `DataSlice.maybe(self, attr_name)` {#DataSlice.maybe}
92759254

92769255
``` {.no-copy}
9277-
A shortcut for kde.get_attr(x, attr_name, default=None).
9256+
A shortcut for kd.get_attr(x, attr_name, default=None).
92789257
```
92799258

92809259
### `DataSlice.no_bag()` {#DataSlice.no_bag}
@@ -9679,8 +9658,8 @@ Alias for [DataSlice.with_bag](#DataSlice.with_bag) operator.
96799658
Returns a DataSlice with a new DataBag containing updated dicts.
96809659
96819660
This operator has two forms:
9682-
kde.with_dict_update(x, keys, values) where keys and values are slices
9683-
kde.with_dict_update(x, dict_updates) where dict_updates is a DataSlice of
9661+
kd.with_dict_update(x, keys, values) where keys and values are slices
9662+
kd.with_dict_update(x, dict_updates) where dict_updates is a DataSlice of
96849663
dicts
96859664
96869665
If both keys and values are specified, they must both be broadcastable to the
@@ -9775,7 +9754,7 @@ Returns a DataSlice of Lists concatenated from the List items of `lists`.
97759754
97769755
Each input DataSlice must contain only present List items, and the item
97779756
schemas of each input must be compatible. Input DataSlices are aligned (see
9778-
`kde.align`) automatically before concatenation.
9757+
`kd.align`) automatically before concatenation.
97799758
97809759
If `lists` is empty, this returns a single empty list.
97819760

0 commit comments

Comments
 (0)