Skip to content

Commit 08dd9e7

Browse files
committed
Add .list to helpers
1 parent d733fc7 commit 08dd9e7

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

examples/async/tuning/datasets.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ async def main() -> None:
4848
print(f"New {bad_dataset=} have a bad status {bad_dataset.status=}")
4949
await dataset.delete()
5050

51+
# You could call .list not only on .datasets,
52+
# but on .completions helper as well, it will substitute corresponding task_type as a filter
53+
async for dataset in sdk.datasets.completions.list():
54+
await dataset.delete()
55+
5156
async for dataset in sdk.datasets.list():
5257
await dataset.delete()
5358

examples/sync/tuning/datasets.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ def main() -> None:
4747
print(f"New {bad_dataset=} have a bad status {dataset.status=}")
4848
dataset.delete()
4949

50+
# You could call .list not only on .datasets,
51+
# but on .completions helper as well, it will substitute corresponding task_type as a filter
52+
for dataset in sdk.datasets.completions.list():
53+
dataset.delete()
54+
5055
for dataset in sdk.datasets.list():
5156
dataset.delete()
5257

src/yandex_cloud_ml_sdk/_datasets/task_types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,9 @@ def draft_from_path(self):
6666
def list_upload_formats(self):
6767
return partial(self._domain.list_upload_formats, task_type=self._task_type)
6868

69+
@property
70+
def list(self):
71+
return partial(self._domain.list, task_type=self._task_type)
72+
6973
def __repr__(self) -> str:
7074
return f'{self.__class__.__name__}(task_type={self._task_type})'

0 commit comments

Comments
 (0)