label-studio-sdk 0.0.19__tar.gz → 0.0.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- {label-studio-sdk-0.0.19/label_studio_sdk.egg-info → label-studio-sdk-0.0.20}/PKG-INFO +1 -1
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/__init__.py +1 -1
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/project.py +60 -5
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20/label_studio_sdk.egg-info}/PKG-INFO +1 -1
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/LICENSE +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/MANIFEST.in +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/README.md +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/docs/__init__.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/client.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/data_manager.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/users.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/utils.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk/workspaces.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk.egg-info/SOURCES.txt +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk.egg-info/dependency_links.txt +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk.egg-info/requires.txt +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk.egg-info/top_level.txt +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/requirements.txt +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/setup.cfg +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/setup.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/tests/__init__.py +0 -0
- {label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/tests/test_client.py +0 -0
|
@@ -7,6 +7,7 @@ import logging
|
|
|
7
7
|
from enum import Enum, auto
|
|
8
8
|
from random import sample, shuffle
|
|
9
9
|
from requests.exceptions import HTTPError, InvalidSchema, MissingSchema
|
|
10
|
+
from requests import Response
|
|
10
11
|
from pathlib import Path
|
|
11
12
|
from typing import Optional, Union, List, Dict, Callable
|
|
12
13
|
from .client import Client
|
|
@@ -1230,7 +1231,6 @@ class Project(Client):
|
|
|
1230
1231
|
'presign_ttl': presign_ttl,
|
|
1231
1232
|
'title': title,
|
|
1232
1233
|
'description': description,
|
|
1233
|
-
'project': self.id,
|
|
1234
1234
|
}
|
|
1235
1235
|
response = self.make_request('POST', '/api/storages/gcs', json=payload)
|
|
1236
1236
|
return response.json()
|
|
@@ -1801,7 +1801,7 @@ class Project(Client):
|
|
|
1801
1801
|
overlap=overlap,
|
|
1802
1802
|
)
|
|
1803
1803
|
|
|
1804
|
-
def export_snapshot_list(self):
|
|
1804
|
+
def export_snapshot_list(self) -> list:
|
|
1805
1805
|
"""
|
|
1806
1806
|
Get list of export snapshots for the current project
|
|
1807
1807
|
-------
|
|
@@ -1835,7 +1835,7 @@ class Project(Client):
|
|
|
1835
1835
|
annotation_filter_options_ground_truth: bool = True,
|
|
1836
1836
|
annotation_filter_options_skipped: bool = True,
|
|
1837
1837
|
interpolate_key_frames: bool = False,
|
|
1838
|
-
):
|
|
1838
|
+
) -> dict:
|
|
1839
1839
|
"""
|
|
1840
1840
|
Create new export snapshot
|
|
1841
1841
|
----------
|
|
@@ -1904,7 +1904,7 @@ class Project(Client):
|
|
|
1904
1904
|
)
|
|
1905
1905
|
return response.json()
|
|
1906
1906
|
|
|
1907
|
-
def export_snapshot_status(self, export_id: int):
|
|
1907
|
+
def export_snapshot_status(self, export_id: int) -> ExportSnapshotStatus:
|
|
1908
1908
|
"""
|
|
1909
1909
|
Get export snapshot status by Export ID
|
|
1910
1910
|
----------
|
|
@@ -1936,7 +1936,7 @@ class Project(Client):
|
|
|
1936
1936
|
|
|
1937
1937
|
def export_snapshot_download(
|
|
1938
1938
|
self, export_id: int, export_type: str = 'JSON', path: str = "."
|
|
1939
|
-
):
|
|
1939
|
+
) -> (int, str):
|
|
1940
1940
|
"""
|
|
1941
1941
|
Download file with export snapshot in provided format
|
|
1942
1942
|
----------
|
|
@@ -1966,6 +1966,24 @@ class Project(Client):
|
|
|
1966
1966
|
f.write(chunk)
|
|
1967
1967
|
return response.status_code, filename
|
|
1968
1968
|
|
|
1969
|
+
def export_snapshot_delete(self, export_id: int) -> int:
|
|
1970
|
+
"""Delete an export file by specified export ID
|
|
1971
|
+
|
|
1972
|
+
Parameters
|
|
1973
|
+
----------
|
|
1974
|
+
export_id: int
|
|
1975
|
+
Existing Export ID from current project
|
|
1976
|
+
|
|
1977
|
+
Returns
|
|
1978
|
+
----------
|
|
1979
|
+
Status code for operation
|
|
1980
|
+
"""
|
|
1981
|
+
response = self.make_request(
|
|
1982
|
+
'DELETE',
|
|
1983
|
+
f'/api/projects/{self.id}/exports/{export_id}',
|
|
1984
|
+
)
|
|
1985
|
+
return response.status_code
|
|
1986
|
+
|
|
1969
1987
|
def get_files_from_tasks(self, tasks: Dict, get_tasks: bool = False):
|
|
1970
1988
|
"""Copy files from tasks to cache folder
|
|
1971
1989
|
|
|
@@ -1997,3 +2015,40 @@ class Project(Client):
|
|
|
1997
2015
|
except (FileNotFoundError, InvalidSchema, MissingSchema, IOError):
|
|
1998
2016
|
logger.debug(f"Couldn't copy file {task['data'][key]}.")
|
|
1999
2017
|
return filenames
|
|
2018
|
+
|
|
2019
|
+
def delete_task(self, task_id: int) -> Response:
|
|
2020
|
+
"""Delete a task. To remove multiple tasks `use delete_tasks()`.
|
|
2021
|
+
|
|
2022
|
+
Parameters
|
|
2023
|
+
----------
|
|
2024
|
+
task_id: int
|
|
2025
|
+
Task id.
|
|
2026
|
+
"""
|
|
2027
|
+
assert isinstance(task_id, int), 'task_id should be int'
|
|
2028
|
+
return self.make_request("DELETE", f"/api/tasks/{task_id}")
|
|
2029
|
+
|
|
2030
|
+
def delete_tasks(self, task_ids: list) -> Response:
|
|
2031
|
+
"""Delete multiple tasks by IDs.
|
|
2032
|
+
|
|
2033
|
+
Parameters
|
|
2034
|
+
----------
|
|
2035
|
+
task_ids: list of int
|
|
2036
|
+
Task ids.
|
|
2037
|
+
"""
|
|
2038
|
+
assert isinstance(task_ids, list), 'task_ids should be list of int'
|
|
2039
|
+
payload = {"selectedItems": {"all": False, "included": task_ids}, "project": self.id}
|
|
2040
|
+
return self.make_request("POST", f"/api/dm/actions?project={self.id}&id=delete_tasks", json=payload)
|
|
2041
|
+
|
|
2042
|
+
def delete_all_tasks(self, excluded_ids: list = None) -> Response:
|
|
2043
|
+
"""Delete all tasks from the project.
|
|
2044
|
+
|
|
2045
|
+
Parameters
|
|
2046
|
+
----------
|
|
2047
|
+
excluded_ids: list of int
|
|
2048
|
+
Task ids that should be excluded from the deletion.
|
|
2049
|
+
"""
|
|
2050
|
+
assert isinstance(excluded_ids, list) or excluded_ids is None, 'excluded_ids should be list of int or None'
|
|
2051
|
+
if excluded_ids is None:
|
|
2052
|
+
excluded_ids = []
|
|
2053
|
+
payload = {"selectedItems": {"all": True, "excluded": excluded_ids}, "project": self.id}
|
|
2054
|
+
return self.make_request("POST", f"/api/dm/actions?project={self.id}&id=delete_tasks", json=payload)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{label-studio-sdk-0.0.19 → label-studio-sdk-0.0.20}/label_studio_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|