label-studio-sdk 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl
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.
- label_studio_sdk/__init__.py +26 -1
- label_studio_sdk/actions/__init__.py +2 -0
- label_studio_sdk/actions/client.py +62 -14
- label_studio_sdk/actions/types/__init__.py +2 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +3 -2
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +5 -0
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/errors/bad_request_error.py +3 -1
- label_studio_sdk/label_interface/interface.py +1 -1
- label_studio_sdk/{_legacy → label_interface}/objects.py +8 -22
- label_studio_sdk/projects/__init__.py +8 -2
- label_studio_sdk/projects/client.py +150 -17
- label_studio_sdk/projects/types/__init__.py +2 -1
- label_studio_sdk/projects/types/projects_update_response.py +96 -0
- label_studio_sdk/tasks/client.py +11 -8
- label_studio_sdk/types/__init__.py +18 -0
- label_studio_sdk/types/annotations_dm_field.py +120 -0
- label_studio_sdk/types/annotations_dm_field_last_action.py +19 -0
- label_studio_sdk/types/base_task.py +4 -2
- label_studio_sdk/types/base_task_file_upload.py +5 -0
- label_studio_sdk/types/base_task_updated_by.py +5 -0
- label_studio_sdk/types/data_manager_task_serializer.py +124 -0
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +5 -0
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +31 -0
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +37 -0
- label_studio_sdk/types/task.py +3 -2
- label_studio_sdk/types/task_annotators_item.py +5 -0
- label_studio_sdk/views/__init__.py +4 -0
- label_studio_sdk/views/types/__init__.py +4 -0
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +3 -2
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +5 -0
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +3 -2
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +5 -0
- {label_studio_sdk-1.0.1.dist-info → label_studio_sdk-1.0.3.dist-info}/METADATA +39 -7
- {label_studio_sdk-1.0.1.dist-info → label_studio_sdk-1.0.3.dist-info}/RECORD +36 -23
- {label_studio_sdk-1.0.1.dist-info → label_studio_sdk-1.0.3.dist-info}/WHEEL +0 -0
|
@@ -16,6 +16,7 @@ from .exports.client import AsyncExportsClient, ExportsClient
|
|
|
16
16
|
from .types.projects_create_response import ProjectsCreateResponse
|
|
17
17
|
from .types.projects_import_tasks_response import ProjectsImportTasksResponse
|
|
18
18
|
from .types.projects_list_response import ProjectsListResponse
|
|
19
|
+
from .types.projects_update_response import ProjectsUpdateResponse
|
|
19
20
|
|
|
20
21
|
# this is used as the default value for optional parameters
|
|
21
22
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -303,7 +304,25 @@ class ProjectsClient:
|
|
|
303
304
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
304
305
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
305
306
|
|
|
306
|
-
def update(
|
|
307
|
+
def update(
|
|
308
|
+
self,
|
|
309
|
+
id: int,
|
|
310
|
+
*,
|
|
311
|
+
title: typing.Optional[str] = OMIT,
|
|
312
|
+
description: typing.Optional[str] = OMIT,
|
|
313
|
+
label_config: typing.Optional[str] = OMIT,
|
|
314
|
+
expert_instruction: typing.Optional[str] = OMIT,
|
|
315
|
+
show_instruction: typing.Optional[bool] = OMIT,
|
|
316
|
+
show_skip_button: typing.Optional[bool] = OMIT,
|
|
317
|
+
enable_empty_annotation: typing.Optional[bool] = OMIT,
|
|
318
|
+
show_annotation_history: typing.Optional[bool] = OMIT,
|
|
319
|
+
reveal_preannotations_interactively: typing.Optional[bool] = OMIT,
|
|
320
|
+
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
321
|
+
maximum_annotations: typing.Optional[int] = OMIT,
|
|
322
|
+
color: typing.Optional[str] = OMIT,
|
|
323
|
+
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
324
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
325
|
+
) -> ProjectsUpdateResponse:
|
|
307
326
|
"""
|
|
308
327
|
Update the project settings for a specific project. For more information, see the following:
|
|
309
328
|
|
|
@@ -324,19 +343,55 @@ class ProjectsClient:
|
|
|
324
343
|
id : int
|
|
325
344
|
A unique integer value identifying this project.
|
|
326
345
|
|
|
327
|
-
|
|
346
|
+
title : typing.Optional[str]
|
|
347
|
+
Project title
|
|
348
|
+
|
|
349
|
+
description : typing.Optional[str]
|
|
350
|
+
Project description
|
|
351
|
+
|
|
352
|
+
label_config : typing.Optional[str]
|
|
353
|
+
Label config in XML format
|
|
354
|
+
|
|
355
|
+
expert_instruction : typing.Optional[str]
|
|
356
|
+
Labeling instructions to show to the user
|
|
357
|
+
|
|
358
|
+
show_instruction : typing.Optional[bool]
|
|
359
|
+
Show labeling instructions
|
|
360
|
+
|
|
361
|
+
show_skip_button : typing.Optional[bool]
|
|
362
|
+
Show skip button
|
|
363
|
+
|
|
364
|
+
enable_empty_annotation : typing.Optional[bool]
|
|
365
|
+
Allow empty annotations
|
|
366
|
+
|
|
367
|
+
show_annotation_history : typing.Optional[bool]
|
|
368
|
+
Show annotation history
|
|
369
|
+
|
|
370
|
+
reveal_preannotations_interactively : typing.Optional[bool]
|
|
371
|
+
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
372
|
+
|
|
373
|
+
show_collab_predictions : typing.Optional[bool]
|
|
374
|
+
Show predictions to annotators
|
|
375
|
+
|
|
376
|
+
maximum_annotations : typing.Optional[int]
|
|
377
|
+
Maximum annotations per task
|
|
378
|
+
|
|
379
|
+
color : typing.Optional[str]
|
|
380
|
+
Project color in HEX format
|
|
381
|
+
|
|
382
|
+
control_weights : typing.Optional[typing.Dict[str, typing.Any]]
|
|
383
|
+
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
328
384
|
|
|
329
385
|
request_options : typing.Optional[RequestOptions]
|
|
330
386
|
Request-specific configuration.
|
|
331
387
|
|
|
332
388
|
Returns
|
|
333
389
|
-------
|
|
334
|
-
|
|
390
|
+
ProjectsUpdateResponse
|
|
335
391
|
|
|
336
392
|
|
|
337
393
|
Examples
|
|
338
394
|
--------
|
|
339
|
-
from label_studio_sdk import Project
|
|
340
395
|
from label_studio_sdk.client import LabelStudio
|
|
341
396
|
|
|
342
397
|
client = LabelStudio(
|
|
@@ -344,18 +399,31 @@ class ProjectsClient:
|
|
|
344
399
|
)
|
|
345
400
|
client.projects.update(
|
|
346
401
|
id=1,
|
|
347
|
-
request=Project(),
|
|
348
402
|
)
|
|
349
403
|
"""
|
|
350
404
|
_response = self._client_wrapper.httpx_client.request(
|
|
351
405
|
f"api/projects/{jsonable_encoder(id)}/",
|
|
352
406
|
method="PATCH",
|
|
353
|
-
json=
|
|
407
|
+
json={
|
|
408
|
+
"title": title,
|
|
409
|
+
"description": description,
|
|
410
|
+
"label_config": label_config,
|
|
411
|
+
"expert_instruction": expert_instruction,
|
|
412
|
+
"show_instruction": show_instruction,
|
|
413
|
+
"show_skip_button": show_skip_button,
|
|
414
|
+
"enable_empty_annotation": enable_empty_annotation,
|
|
415
|
+
"show_annotation_history": show_annotation_history,
|
|
416
|
+
"reveal_preannotations_interactively": reveal_preannotations_interactively,
|
|
417
|
+
"show_collab_predictions": show_collab_predictions,
|
|
418
|
+
"maximum_annotations": maximum_annotations,
|
|
419
|
+
"color": color,
|
|
420
|
+
"control_weights": control_weights,
|
|
421
|
+
},
|
|
354
422
|
request_options=request_options,
|
|
355
423
|
omit=OMIT,
|
|
356
424
|
)
|
|
357
425
|
if 200 <= _response.status_code < 300:
|
|
358
|
-
return pydantic_v1.parse_obj_as(
|
|
426
|
+
return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
|
|
359
427
|
try:
|
|
360
428
|
_response_json = _response.json()
|
|
361
429
|
except JSONDecodeError:
|
|
@@ -476,7 +544,7 @@ class ProjectsClient:
|
|
|
476
544
|
if 200 <= _response.status_code < 300:
|
|
477
545
|
return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
|
|
478
546
|
if _response.status_code == 400:
|
|
479
|
-
raise BadRequestError(pydantic_v1.parse_obj_as(
|
|
547
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
|
480
548
|
try:
|
|
481
549
|
_response_json = _response.json()
|
|
482
550
|
except JSONDecodeError:
|
|
@@ -820,8 +888,24 @@ class AsyncProjectsClient:
|
|
|
820
888
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
821
889
|
|
|
822
890
|
async def update(
|
|
823
|
-
self,
|
|
824
|
-
|
|
891
|
+
self,
|
|
892
|
+
id: int,
|
|
893
|
+
*,
|
|
894
|
+
title: typing.Optional[str] = OMIT,
|
|
895
|
+
description: typing.Optional[str] = OMIT,
|
|
896
|
+
label_config: typing.Optional[str] = OMIT,
|
|
897
|
+
expert_instruction: typing.Optional[str] = OMIT,
|
|
898
|
+
show_instruction: typing.Optional[bool] = OMIT,
|
|
899
|
+
show_skip_button: typing.Optional[bool] = OMIT,
|
|
900
|
+
enable_empty_annotation: typing.Optional[bool] = OMIT,
|
|
901
|
+
show_annotation_history: typing.Optional[bool] = OMIT,
|
|
902
|
+
reveal_preannotations_interactively: typing.Optional[bool] = OMIT,
|
|
903
|
+
show_collab_predictions: typing.Optional[bool] = OMIT,
|
|
904
|
+
maximum_annotations: typing.Optional[int] = OMIT,
|
|
905
|
+
color: typing.Optional[str] = OMIT,
|
|
906
|
+
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
907
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
908
|
+
) -> ProjectsUpdateResponse:
|
|
825
909
|
"""
|
|
826
910
|
Update the project settings for a specific project. For more information, see the following:
|
|
827
911
|
|
|
@@ -842,19 +926,55 @@ class AsyncProjectsClient:
|
|
|
842
926
|
id : int
|
|
843
927
|
A unique integer value identifying this project.
|
|
844
928
|
|
|
845
|
-
|
|
929
|
+
title : typing.Optional[str]
|
|
930
|
+
Project title
|
|
931
|
+
|
|
932
|
+
description : typing.Optional[str]
|
|
933
|
+
Project description
|
|
934
|
+
|
|
935
|
+
label_config : typing.Optional[str]
|
|
936
|
+
Label config in XML format
|
|
937
|
+
|
|
938
|
+
expert_instruction : typing.Optional[str]
|
|
939
|
+
Labeling instructions to show to the user
|
|
940
|
+
|
|
941
|
+
show_instruction : typing.Optional[bool]
|
|
942
|
+
Show labeling instructions
|
|
943
|
+
|
|
944
|
+
show_skip_button : typing.Optional[bool]
|
|
945
|
+
Show skip button
|
|
946
|
+
|
|
947
|
+
enable_empty_annotation : typing.Optional[bool]
|
|
948
|
+
Allow empty annotations
|
|
949
|
+
|
|
950
|
+
show_annotation_history : typing.Optional[bool]
|
|
951
|
+
Show annotation history
|
|
952
|
+
|
|
953
|
+
reveal_preannotations_interactively : typing.Optional[bool]
|
|
954
|
+
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
955
|
+
|
|
956
|
+
show_collab_predictions : typing.Optional[bool]
|
|
957
|
+
Show predictions to annotators
|
|
958
|
+
|
|
959
|
+
maximum_annotations : typing.Optional[int]
|
|
960
|
+
Maximum annotations per task
|
|
961
|
+
|
|
962
|
+
color : typing.Optional[str]
|
|
963
|
+
Project color in HEX format
|
|
964
|
+
|
|
965
|
+
control_weights : typing.Optional[typing.Dict[str, typing.Any]]
|
|
966
|
+
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
846
967
|
|
|
847
968
|
request_options : typing.Optional[RequestOptions]
|
|
848
969
|
Request-specific configuration.
|
|
849
970
|
|
|
850
971
|
Returns
|
|
851
972
|
-------
|
|
852
|
-
|
|
973
|
+
ProjectsUpdateResponse
|
|
853
974
|
|
|
854
975
|
|
|
855
976
|
Examples
|
|
856
977
|
--------
|
|
857
|
-
from label_studio_sdk import Project
|
|
858
978
|
from label_studio_sdk.client import AsyncLabelStudio
|
|
859
979
|
|
|
860
980
|
client = AsyncLabelStudio(
|
|
@@ -862,18 +982,31 @@ class AsyncProjectsClient:
|
|
|
862
982
|
)
|
|
863
983
|
await client.projects.update(
|
|
864
984
|
id=1,
|
|
865
|
-
request=Project(),
|
|
866
985
|
)
|
|
867
986
|
"""
|
|
868
987
|
_response = await self._client_wrapper.httpx_client.request(
|
|
869
988
|
f"api/projects/{jsonable_encoder(id)}/",
|
|
870
989
|
method="PATCH",
|
|
871
|
-
json=
|
|
990
|
+
json={
|
|
991
|
+
"title": title,
|
|
992
|
+
"description": description,
|
|
993
|
+
"label_config": label_config,
|
|
994
|
+
"expert_instruction": expert_instruction,
|
|
995
|
+
"show_instruction": show_instruction,
|
|
996
|
+
"show_skip_button": show_skip_button,
|
|
997
|
+
"enable_empty_annotation": enable_empty_annotation,
|
|
998
|
+
"show_annotation_history": show_annotation_history,
|
|
999
|
+
"reveal_preannotations_interactively": reveal_preannotations_interactively,
|
|
1000
|
+
"show_collab_predictions": show_collab_predictions,
|
|
1001
|
+
"maximum_annotations": maximum_annotations,
|
|
1002
|
+
"color": color,
|
|
1003
|
+
"control_weights": control_weights,
|
|
1004
|
+
},
|
|
872
1005
|
request_options=request_options,
|
|
873
1006
|
omit=OMIT,
|
|
874
1007
|
)
|
|
875
1008
|
if 200 <= _response.status_code < 300:
|
|
876
|
-
return pydantic_v1.parse_obj_as(
|
|
1009
|
+
return pydantic_v1.parse_obj_as(ProjectsUpdateResponse, _response.json()) # type: ignore
|
|
877
1010
|
try:
|
|
878
1011
|
_response_json = _response.json()
|
|
879
1012
|
except JSONDecodeError:
|
|
@@ -994,7 +1127,7 @@ class AsyncProjectsClient:
|
|
|
994
1127
|
if 200 <= _response.status_code < 300:
|
|
995
1128
|
return pydantic_v1.parse_obj_as(ProjectsImportTasksResponse, _response.json()) # type: ignore
|
|
996
1129
|
if _response.status_code == 400:
|
|
997
|
-
raise BadRequestError(pydantic_v1.parse_obj_as(
|
|
1130
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
|
998
1131
|
try:
|
|
999
1132
|
_response_json = _response.json()
|
|
1000
1133
|
except JSONDecodeError:
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
from .projects_create_response import ProjectsCreateResponse
|
|
4
4
|
from .projects_import_tasks_response import ProjectsImportTasksResponse
|
|
5
5
|
from .projects_list_response import ProjectsListResponse
|
|
6
|
+
from .projects_update_response import ProjectsUpdateResponse
|
|
6
7
|
|
|
7
|
-
__all__ = ["ProjectsCreateResponse", "ProjectsImportTasksResponse", "ProjectsListResponse"]
|
|
8
|
+
__all__ = ["ProjectsCreateResponse", "ProjectsImportTasksResponse", "ProjectsListResponse", "ProjectsUpdateResponse"]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
from ...core.datetime_utils import serialize_datetime
|
|
7
|
+
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProjectsUpdateResponse(pydantic_v1.BaseModel):
|
|
11
|
+
"""
|
|
12
|
+
Project
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
title: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Project title
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
description: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
Project description
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
label_config: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Label config in XML format
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
expert_instruction: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
31
|
+
"""
|
|
32
|
+
Labeling instructions to show to the user
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
show_instruction: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
36
|
+
"""
|
|
37
|
+
Show labeling instructions
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
show_skip_button: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
41
|
+
"""
|
|
42
|
+
Show skip button
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
enable_empty_annotation: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
46
|
+
"""
|
|
47
|
+
Allow empty annotations
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
show_annotation_history: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
51
|
+
"""
|
|
52
|
+
Show annotation history
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
reveal_preannotations_interactively: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
56
|
+
"""
|
|
57
|
+
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
show_collab_predictions: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
61
|
+
"""
|
|
62
|
+
Show predictions to annotators
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
maximum_annotations: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
66
|
+
"""
|
|
67
|
+
Maximum annotations per task
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
color: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
71
|
+
"""
|
|
72
|
+
Project color in HEX format
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
|
|
76
|
+
"""
|
|
77
|
+
Dict of weights for each control tag in metric calculation. Each control tag (e.g. label or choice) will have its own key in control weight dict with weight for each label and overall weight. For example, if a bounding box annotation with a control tag named my_bbox should be included with 0.33 weight in agreement calculation, and the first label Car should be twice as important as Airplane, then you need to specify: {'my_bbox': {'type': 'RectangleLabels', 'labels': {'Car': 1.0, 'Airplane': 0.5}, 'overall': 0.33}
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
def json(self, **kwargs: typing.Any) -> str:
|
|
81
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
82
|
+
return super().json(**kwargs_with_defaults)
|
|
83
|
+
|
|
84
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
85
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
86
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
87
|
+
|
|
88
|
+
return deep_union_pydantic_dicts(
|
|
89
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
class Config:
|
|
93
|
+
frozen = True
|
|
94
|
+
smart_union = True
|
|
95
|
+
extra = pydantic_v1.Extra.allow
|
|
96
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
label_studio_sdk/tasks/client.py
CHANGED
|
@@ -10,6 +10,7 @@ from ..core.pagination import AsyncPager, SyncPager
|
|
|
10
10
|
from ..core.pydantic_utilities import pydantic_v1
|
|
11
11
|
from ..core.request_options import RequestOptions
|
|
12
12
|
from ..types.base_task import BaseTask
|
|
13
|
+
from ..types.data_manager_task_serializer import DataManagerTaskSerializer
|
|
13
14
|
from ..types.project_import import ProjectImport
|
|
14
15
|
from ..types.task import Task
|
|
15
16
|
from .types.tasks_list_request_fields import TasksListRequestFields
|
|
@@ -163,7 +164,7 @@ class TasksClient:
|
|
|
163
164
|
Specify which fields to include in the response
|
|
164
165
|
|
|
165
166
|
query : typing.Optional[str]
|
|
166
|
-
Additional query to filter tasks. It must be JSON encoded string of dict containing one of the following parameters: `{"filters": ..., "selectedItems": ..., "ordering": ...}`. Check Data Manager > Create View for more details about filters, selectedItems and ordering.
|
|
167
|
+
Additional query to filter tasks. It must be JSON encoded string of dict containing one of the following parameters: `{"filters": ..., "selectedItems": ..., "ordering": ...}`. Check [Data Manager > Create View > see `data` field](#tag/Data-Manager/operation/api_dm_views_create) for more details about filters, selectedItems and ordering.
|
|
167
168
|
|
|
168
169
|
- **filters**: dict with `"conjunction"` string (`"or"` or `"and"`) and list of filters in `"items"` array. Each filter is a dictionary with keys: `"filter"`, `"operator"`, `"type"`, `"value"`. [Read more about available filters](https://labelstud.io/sdk/data_manager.html)<br/> Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
|
|
169
170
|
- **selectedItems**: dictionary with keys: `"all"`, `"included"`, `"excluded"`. If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br/> Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`
|
|
@@ -284,7 +285,7 @@ class TasksClient:
|
|
|
284
285
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
285
286
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
286
287
|
|
|
287
|
-
def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
288
|
+
def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DataManagerTaskSerializer:
|
|
288
289
|
"""
|
|
289
290
|
Get task data, metadata, annotations and other attributes for a specific labeling task by task ID.
|
|
290
291
|
The task ID is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
|
|
@@ -299,7 +300,7 @@ class TasksClient:
|
|
|
299
300
|
|
|
300
301
|
Returns
|
|
301
302
|
-------
|
|
302
|
-
|
|
303
|
+
DataManagerTaskSerializer
|
|
303
304
|
Task
|
|
304
305
|
|
|
305
306
|
Examples
|
|
@@ -317,7 +318,7 @@ class TasksClient:
|
|
|
317
318
|
f"api/tasks/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
318
319
|
)
|
|
319
320
|
if 200 <= _response.status_code < 300:
|
|
320
|
-
return pydantic_v1.parse_obj_as(
|
|
321
|
+
return pydantic_v1.parse_obj_as(DataManagerTaskSerializer, _response.json()) # type: ignore
|
|
321
322
|
try:
|
|
322
323
|
_response_json = _response.json()
|
|
323
324
|
except JSONDecodeError:
|
|
@@ -571,7 +572,7 @@ class AsyncTasksClient:
|
|
|
571
572
|
Specify which fields to include in the response
|
|
572
573
|
|
|
573
574
|
query : typing.Optional[str]
|
|
574
|
-
Additional query to filter tasks. It must be JSON encoded string of dict containing one of the following parameters: `{"filters": ..., "selectedItems": ..., "ordering": ...}`. Check Data Manager > Create View for more details about filters, selectedItems and ordering.
|
|
575
|
+
Additional query to filter tasks. It must be JSON encoded string of dict containing one of the following parameters: `{"filters": ..., "selectedItems": ..., "ordering": ...}`. Check [Data Manager > Create View > see `data` field](#tag/Data-Manager/operation/api_dm_views_create) for more details about filters, selectedItems and ordering.
|
|
575
576
|
|
|
576
577
|
- **filters**: dict with `"conjunction"` string (`"or"` or `"and"`) and list of filters in `"items"` array. Each filter is a dictionary with keys: `"filter"`, `"operator"`, `"type"`, `"value"`. [Read more about available filters](https://labelstud.io/sdk/data_manager.html)<br/> Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
|
|
577
578
|
- **selectedItems**: dictionary with keys: `"all"`, `"included"`, `"excluded"`. If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br/> Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`
|
|
@@ -692,7 +693,9 @@ class AsyncTasksClient:
|
|
|
692
693
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
693
694
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
694
695
|
|
|
695
|
-
async def get(
|
|
696
|
+
async def get(
|
|
697
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
698
|
+
) -> DataManagerTaskSerializer:
|
|
696
699
|
"""
|
|
697
700
|
Get task data, metadata, annotations and other attributes for a specific labeling task by task ID.
|
|
698
701
|
The task ID is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
|
|
@@ -707,7 +710,7 @@ class AsyncTasksClient:
|
|
|
707
710
|
|
|
708
711
|
Returns
|
|
709
712
|
-------
|
|
710
|
-
|
|
713
|
+
DataManagerTaskSerializer
|
|
711
714
|
Task
|
|
712
715
|
|
|
713
716
|
Examples
|
|
@@ -725,7 +728,7 @@ class AsyncTasksClient:
|
|
|
725
728
|
f"api/tasks/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
726
729
|
)
|
|
727
730
|
if 200 <= _response.status_code < 300:
|
|
728
|
-
return pydantic_v1.parse_obj_as(
|
|
731
|
+
return pydantic_v1.parse_obj_as(DataManagerTaskSerializer, _response.json()) # type: ignore
|
|
729
732
|
try:
|
|
730
733
|
_response_json = _response.json()
|
|
731
734
|
except JSONDecodeError:
|
|
@@ -3,14 +3,22 @@
|
|
|
3
3
|
from .annotation import Annotation
|
|
4
4
|
from .annotation_filter_options import AnnotationFilterOptions
|
|
5
5
|
from .annotation_last_action import AnnotationLastAction
|
|
6
|
+
from .annotations_dm_field import AnnotationsDmField
|
|
7
|
+
from .annotations_dm_field_last_action import AnnotationsDmFieldLastAction
|
|
6
8
|
from .azure_blob_export_storage import AzureBlobExportStorage
|
|
7
9
|
from .azure_blob_export_storage_status import AzureBlobExportStorageStatus
|
|
8
10
|
from .azure_blob_import_storage import AzureBlobImportStorage
|
|
9
11
|
from .azure_blob_import_storage_status import AzureBlobImportStorageStatus
|
|
10
12
|
from .base_task import BaseTask
|
|
13
|
+
from .base_task_file_upload import BaseTaskFileUpload
|
|
14
|
+
from .base_task_updated_by import BaseTaskUpdatedBy
|
|
11
15
|
from .base_user import BaseUser
|
|
12
16
|
from .converted_format import ConvertedFormat
|
|
13
17
|
from .converted_format_status import ConvertedFormatStatus
|
|
18
|
+
from .data_manager_task_serializer import DataManagerTaskSerializer
|
|
19
|
+
from .data_manager_task_serializer_annotators_item import DataManagerTaskSerializerAnnotatorsItem
|
|
20
|
+
from .data_manager_task_serializer_drafts_item import DataManagerTaskSerializerDraftsItem
|
|
21
|
+
from .data_manager_task_serializer_predictions_item import DataManagerTaskSerializerPredictionsItem
|
|
14
22
|
from .export import Export
|
|
15
23
|
from .export_convert import ExportConvert
|
|
16
24
|
from .export_create import ExportCreate
|
|
@@ -48,6 +56,7 @@ from .s3import_storage_status import S3ImportStorageStatus
|
|
|
48
56
|
from .serialization_option import SerializationOption
|
|
49
57
|
from .serialization_options import SerializationOptions
|
|
50
58
|
from .task import Task
|
|
59
|
+
from .task_annotators_item import TaskAnnotatorsItem
|
|
51
60
|
from .task_filter_options import TaskFilterOptions
|
|
52
61
|
from .user_simple import UserSimple
|
|
53
62
|
from .view import View
|
|
@@ -60,14 +69,22 @@ __all__ = [
|
|
|
60
69
|
"Annotation",
|
|
61
70
|
"AnnotationFilterOptions",
|
|
62
71
|
"AnnotationLastAction",
|
|
72
|
+
"AnnotationsDmField",
|
|
73
|
+
"AnnotationsDmFieldLastAction",
|
|
63
74
|
"AzureBlobExportStorage",
|
|
64
75
|
"AzureBlobExportStorageStatus",
|
|
65
76
|
"AzureBlobImportStorage",
|
|
66
77
|
"AzureBlobImportStorageStatus",
|
|
67
78
|
"BaseTask",
|
|
79
|
+
"BaseTaskFileUpload",
|
|
80
|
+
"BaseTaskUpdatedBy",
|
|
68
81
|
"BaseUser",
|
|
69
82
|
"ConvertedFormat",
|
|
70
83
|
"ConvertedFormatStatus",
|
|
84
|
+
"DataManagerTaskSerializer",
|
|
85
|
+
"DataManagerTaskSerializerAnnotatorsItem",
|
|
86
|
+
"DataManagerTaskSerializerDraftsItem",
|
|
87
|
+
"DataManagerTaskSerializerPredictionsItem",
|
|
71
88
|
"Export",
|
|
72
89
|
"ExportConvert",
|
|
73
90
|
"ExportCreate",
|
|
@@ -105,6 +122,7 @@ __all__ = [
|
|
|
105
122
|
"SerializationOption",
|
|
106
123
|
"SerializationOptions",
|
|
107
124
|
"Task",
|
|
125
|
+
"TaskAnnotatorsItem",
|
|
108
126
|
"TaskFilterOptions",
|
|
109
127
|
"UserSimple",
|
|
110
128
|
"View",
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
from ..core.datetime_utils import serialize_datetime
|
|
7
|
+
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
|
+
from .annotations_dm_field_last_action import AnnotationsDmFieldLastAction
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AnnotationsDmField(pydantic_v1.BaseModel):
|
|
12
|
+
id: typing.Optional[int] = None
|
|
13
|
+
result: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
|
|
14
|
+
"""
|
|
15
|
+
List of annotation results for the task
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
created_username: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
19
|
+
"""
|
|
20
|
+
Username string
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
created_ago: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
24
|
+
"""
|
|
25
|
+
Time delta from creation time
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
completed_by: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
|
|
29
|
+
"""
|
|
30
|
+
User details who completed this annotation.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
unique_id: typing.Optional[str] = None
|
|
34
|
+
was_cancelled: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
35
|
+
"""
|
|
36
|
+
User skipped the task
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
ground_truth: typing.Optional[bool] = pydantic_v1.Field(default=None)
|
|
40
|
+
"""
|
|
41
|
+
This annotation is a Ground Truth (ground_truth)
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
created_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
|
|
45
|
+
"""
|
|
46
|
+
Creation time
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
updated_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
|
|
50
|
+
"""
|
|
51
|
+
Last updated time
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
draft_created_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
|
|
55
|
+
"""
|
|
56
|
+
Draft creation time
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
lead_time: typing.Optional[float] = pydantic_v1.Field(default=None)
|
|
60
|
+
"""
|
|
61
|
+
How much time it took to annotate the task
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
import_id: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
65
|
+
"""
|
|
66
|
+
Original annotation ID that was at the import step or NULL if this annotation wasn't imported
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
last_action: typing.Optional[AnnotationsDmFieldLastAction] = pydantic_v1.Field(default=None)
|
|
70
|
+
"""
|
|
71
|
+
Action which was performed in the last annotation history item
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
task: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
75
|
+
"""
|
|
76
|
+
Corresponding task for this annotation
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
project: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
80
|
+
"""
|
|
81
|
+
Project ID for this annotation
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
updated_by: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
85
|
+
"""
|
|
86
|
+
Last user who updated this annotation
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
parent_prediction: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
90
|
+
"""
|
|
91
|
+
Points to the prediction from which this annotation was created
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
parent_annotation: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
95
|
+
"""
|
|
96
|
+
Points to the parent annotation from which this annotation was created
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
last_created_by: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
100
|
+
"""
|
|
101
|
+
User who created the last annotation history item
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
def json(self, **kwargs: typing.Any) -> str:
|
|
105
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
106
|
+
return super().json(**kwargs_with_defaults)
|
|
107
|
+
|
|
108
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
109
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
110
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
111
|
+
|
|
112
|
+
return deep_union_pydantic_dicts(
|
|
113
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
class Config:
|
|
117
|
+
frozen = True
|
|
118
|
+
smart_union = True
|
|
119
|
+
extra = pydantic_v1.Extra.allow
|
|
120
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
AnnotationsDmFieldLastAction = typing.Union[
|
|
6
|
+
typing.Literal[
|
|
7
|
+
"prediction",
|
|
8
|
+
"propagated_annotation",
|
|
9
|
+
"imported",
|
|
10
|
+
"submitted",
|
|
11
|
+
"updated",
|
|
12
|
+
"skipped",
|
|
13
|
+
"accepted",
|
|
14
|
+
"rejected",
|
|
15
|
+
"fixed_and_accepted",
|
|
16
|
+
"deleted_review",
|
|
17
|
+
],
|
|
18
|
+
typing.Any,
|
|
19
|
+
]
|
|
@@ -5,6 +5,8 @@ import typing
|
|
|
5
5
|
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
|
7
7
|
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
|
+
from .base_task_file_upload import BaseTaskFileUpload
|
|
9
|
+
from .base_task_updated_by import BaseTaskUpdatedBy
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
class BaseTask(pydantic_v1.BaseModel):
|
|
@@ -79,12 +81,12 @@ class BaseTask(pydantic_v1.BaseModel):
|
|
|
79
81
|
Project ID for this task
|
|
80
82
|
"""
|
|
81
83
|
|
|
82
|
-
updated_by: typing.Optional[
|
|
84
|
+
updated_by: typing.Optional[BaseTaskUpdatedBy] = pydantic_v1.Field(default=None)
|
|
83
85
|
"""
|
|
84
86
|
Last annotator or reviewer who updated this task
|
|
85
87
|
"""
|
|
86
88
|
|
|
87
|
-
file_upload: typing.Optional[
|
|
89
|
+
file_upload: typing.Optional[BaseTaskFileUpload] = pydantic_v1.Field(default=None)
|
|
88
90
|
"""
|
|
89
91
|
Uploaded file used as data source for this task
|
|
90
92
|
"""
|