Skip to content

Commit 2594b0f

Browse files
committed
feat(lab-4021): add method add_consensus to assets domain
1 parent 4247b88 commit 2594b0f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/kili/domain_api/assets.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ class AssetsNamespace(DomainNamespace):
265265
- move_to_next_step(): Move assets to the next workflow step
266266
- assign(): Assign assets to labelers
267267
- update_priority(): Update asset priorities
268+
- add_consensus(): Activate or deactivate consensus on an asset
268269
269270
Examples:
270271
>>> kili = Kili()
@@ -2174,3 +2175,44 @@ def update_priority(
21742175
priorities=priorities if priorities is not None else [],
21752176
**kwargs,
21762177
)
2178+
2179+
@typechecked
2180+
def add_consensus(
2181+
self,
2182+
*,
2183+
asset_id: str,
2184+
project_id: str,
2185+
is_consensus: bool,
2186+
) -> bool:
2187+
"""Activate or deactivate consensus on an asset.
2188+
2189+
Args:
2190+
asset_id: The internal asset ID to modify.
2191+
project_id: The project ID.
2192+
is_consensus: Whether to activate (True) or deactivate (False) consensus on the asset.
2193+
2194+
Returns:
2195+
The consensus value that was set (True if consensus was activated, False if deactivated).
2196+
2197+
Examples:
2198+
>>> # Activate consensus on an asset
2199+
>>> result = kili.assets.add_consensus(
2200+
... asset_id="ckg22d81r0jrg0885unmuswj8",
2201+
... project_id="my_project",
2202+
... is_consensus=True
2203+
... )
2204+
>>> # result is True
2205+
2206+
>>> # Deactivate consensus on an asset
2207+
>>> result = kili.assets.add_consensus(
2208+
... asset_id="ckg22d81r0jrg0885unmuswj8",
2209+
... project_id="my_project",
2210+
... is_consensus=False
2211+
... )
2212+
>>> # result is False
2213+
"""
2214+
return self._client.set_asset_consensus(
2215+
asset_id=asset_id,
2216+
project_id=project_id,
2217+
is_consensus=is_consensus,
2218+
)

0 commit comments

Comments
 (0)