label-studio-sdk 0.0.32__py3-none-any.whl → 1.0.0__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 +206 -6
- label_studio_sdk/_extensions/label_studio_tools/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/core/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +163 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/exceptions.py +2 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +228 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/params.py +45 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/__init__.py +1 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/beam.py +34 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/example.py +17 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/registry.py +67 -0
- label_studio_sdk/_extensions/label_studio_tools/postprocessing/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/postprocessing/video.py +97 -0
- label_studio_sdk/_legacy/__init__.py +11 -0
- label_studio_sdk/_legacy/client.py +471 -0
- label_studio_sdk/_legacy/exceptions.py +10 -0
- label_studio_sdk/_legacy/label_interface/__init__.py +1 -0
- label_studio_sdk/_legacy/label_interface/base.py +77 -0
- label_studio_sdk/_legacy/label_interface/control_tags.py +756 -0
- label_studio_sdk/_legacy/label_interface/data_examples.json +96 -0
- label_studio_sdk/_legacy/label_interface/interface.py +925 -0
- label_studio_sdk/_legacy/label_interface/label_tags.py +72 -0
- label_studio_sdk/_legacy/label_interface/object_tags.py +292 -0
- label_studio_sdk/_legacy/label_interface/region.py +43 -0
- label_studio_sdk/_legacy/objects.py +35 -0
- label_studio_sdk/{project.py → _legacy/project.py} +711 -258
- label_studio_sdk/_legacy/schema/label_config_schema.json +226 -0
- label_studio_sdk/{users.py → _legacy/users.py} +15 -13
- label_studio_sdk/{utils.py → _legacy/utils.py} +31 -30
- label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +13 -11
- label_studio_sdk/actions/__init__.py +2 -0
- label_studio_sdk/actions/client.py +150 -0
- label_studio_sdk/annotations/__init__.py +2 -0
- label_studio_sdk/annotations/client.py +750 -0
- label_studio_sdk/client.py +164 -436
- label_studio_sdk/converter/__init__.py +7 -0
- label_studio_sdk/converter/audio.py +56 -0
- label_studio_sdk/converter/brush.py +452 -0
- label_studio_sdk/converter/converter.py +1175 -0
- label_studio_sdk/converter/exports/__init__.py +0 -0
- label_studio_sdk/converter/exports/csv.py +82 -0
- label_studio_sdk/converter/exports/csv2.py +103 -0
- label_studio_sdk/converter/funsd.py +85 -0
- label_studio_sdk/converter/imports/__init__.py +0 -0
- label_studio_sdk/converter/imports/coco.py +314 -0
- label_studio_sdk/converter/imports/colors.py +198 -0
- label_studio_sdk/converter/imports/label_config.py +45 -0
- label_studio_sdk/converter/imports/pathtrack.py +269 -0
- label_studio_sdk/converter/imports/yolo.py +236 -0
- label_studio_sdk/converter/main.py +202 -0
- label_studio_sdk/converter/utils.py +473 -0
- label_studio_sdk/core/__init__.py +33 -0
- label_studio_sdk/core/api_error.py +15 -0
- label_studio_sdk/core/client_wrapper.py +55 -0
- label_studio_sdk/core/datetime_utils.py +28 -0
- label_studio_sdk/core/file.py +38 -0
- label_studio_sdk/core/http_client.py +443 -0
- label_studio_sdk/core/jsonable_encoder.py +99 -0
- label_studio_sdk/core/pagination.py +87 -0
- label_studio_sdk/core/pydantic_utilities.py +28 -0
- label_studio_sdk/core/query_encoder.py +33 -0
- label_studio_sdk/core/remove_none_from_dict.py +11 -0
- label_studio_sdk/core/request_options.py +32 -0
- label_studio_sdk/data_manager.py +32 -23
- label_studio_sdk/environment.py +7 -0
- label_studio_sdk/errors/__init__.py +6 -0
- label_studio_sdk/errors/bad_request_error.py +8 -0
- label_studio_sdk/errors/internal_server_error.py +8 -0
- label_studio_sdk/export_storage/__init__.py +28 -0
- label_studio_sdk/export_storage/azure/__init__.py +5 -0
- label_studio_sdk/export_storage/azure/client.py +722 -0
- label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +52 -0
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +52 -0
- label_studio_sdk/export_storage/client.py +107 -0
- label_studio_sdk/export_storage/gcs/__init__.py +5 -0
- label_studio_sdk/export_storage/gcs/client.py +722 -0
- label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +52 -0
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +52 -0
- label_studio_sdk/export_storage/local/__init__.py +5 -0
- label_studio_sdk/export_storage/local/client.py +688 -0
- label_studio_sdk/export_storage/local/types/__init__.py +6 -0
- label_studio_sdk/export_storage/local/types/local_create_response.py +47 -0
- label_studio_sdk/export_storage/local/types/local_update_response.py +47 -0
- label_studio_sdk/export_storage/redis/__init__.py +5 -0
- label_studio_sdk/export_storage/redis/client.py +714 -0
- label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +57 -0
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +57 -0
- label_studio_sdk/export_storage/s3/__init__.py +5 -0
- label_studio_sdk/export_storage/s3/client.py +820 -0
- label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
- label_studio_sdk/export_storage/s3/types/s3create_response.py +74 -0
- label_studio_sdk/export_storage/s3/types/s3update_response.py +74 -0
- label_studio_sdk/export_storage/types/__init__.py +5 -0
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +30 -0
- label_studio_sdk/files/__init__.py +2 -0
- label_studio_sdk/files/client.py +556 -0
- label_studio_sdk/import_storage/__init__.py +28 -0
- label_studio_sdk/import_storage/azure/__init__.py +5 -0
- label_studio_sdk/import_storage/azure/client.py +812 -0
- label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +72 -0
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +72 -0
- label_studio_sdk/import_storage/client.py +107 -0
- label_studio_sdk/import_storage/gcs/__init__.py +5 -0
- label_studio_sdk/import_storage/gcs/client.py +812 -0
- label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +72 -0
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +72 -0
- label_studio_sdk/import_storage/local/__init__.py +5 -0
- label_studio_sdk/import_storage/local/client.py +690 -0
- label_studio_sdk/import_storage/local/types/__init__.py +6 -0
- label_studio_sdk/import_storage/local/types/local_create_response.py +47 -0
- label_studio_sdk/import_storage/local/types/local_update_response.py +47 -0
- label_studio_sdk/import_storage/redis/__init__.py +5 -0
- label_studio_sdk/import_storage/redis/client.py +768 -0
- label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +62 -0
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +62 -0
- label_studio_sdk/import_storage/s3/__init__.py +5 -0
- label_studio_sdk/import_storage/s3/client.py +912 -0
- label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
- label_studio_sdk/import_storage/s3/types/s3create_response.py +99 -0
- label_studio_sdk/import_storage/s3/types/s3update_response.py +99 -0
- label_studio_sdk/import_storage/types/__init__.py +5 -0
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +30 -0
- label_studio_sdk/ml/__init__.py +19 -0
- label_studio_sdk/ml/client.py +981 -0
- label_studio_sdk/ml/types/__init__.py +17 -0
- label_studio_sdk/ml/types/ml_create_request_auth_method.py +5 -0
- label_studio_sdk/ml/types/ml_create_response.py +78 -0
- label_studio_sdk/ml/types/ml_create_response_auth_method.py +5 -0
- label_studio_sdk/ml/types/ml_update_request_auth_method.py +5 -0
- label_studio_sdk/ml/types/ml_update_response.py +78 -0
- label_studio_sdk/ml/types/ml_update_response_auth_method.py +5 -0
- label_studio_sdk/predictions/__init__.py +2 -0
- label_studio_sdk/predictions/client.py +638 -0
- label_studio_sdk/projects/__init__.py +6 -0
- label_studio_sdk/projects/client.py +1053 -0
- label_studio_sdk/projects/exports/__init__.py +2 -0
- label_studio_sdk/projects/exports/client.py +930 -0
- label_studio_sdk/projects/types/__init__.py +7 -0
- label_studio_sdk/projects/types/projects_create_response.py +96 -0
- label_studio_sdk/projects/types/projects_import_tasks_response.py +71 -0
- label_studio_sdk/projects/types/projects_list_response.py +33 -0
- label_studio_sdk/py.typed +0 -0
- label_studio_sdk/tasks/__init__.py +5 -0
- label_studio_sdk/tasks/client.py +811 -0
- label_studio_sdk/tasks/types/__init__.py +6 -0
- label_studio_sdk/tasks/types/tasks_list_request_fields.py +5 -0
- label_studio_sdk/tasks/types/tasks_list_response.py +48 -0
- label_studio_sdk/types/__init__.py +115 -0
- label_studio_sdk/types/annotation.py +116 -0
- label_studio_sdk/types/annotation_filter_options.py +42 -0
- label_studio_sdk/types/annotation_last_action.py +19 -0
- label_studio_sdk/types/azure_blob_export_storage.py +112 -0
- label_studio_sdk/types/azure_blob_export_storage_status.py +7 -0
- label_studio_sdk/types/azure_blob_import_storage.py +113 -0
- label_studio_sdk/types/azure_blob_import_storage_status.py +7 -0
- label_studio_sdk/types/base_task.py +113 -0
- label_studio_sdk/types/base_user.py +42 -0
- label_studio_sdk/types/converted_format.py +36 -0
- label_studio_sdk/types/converted_format_status.py +5 -0
- label_studio_sdk/types/export.py +48 -0
- label_studio_sdk/types/export_convert.py +32 -0
- label_studio_sdk/types/export_create.py +54 -0
- label_studio_sdk/types/export_create_status.py +5 -0
- label_studio_sdk/types/export_status.py +5 -0
- label_studio_sdk/types/file_upload.py +30 -0
- label_studio_sdk/types/filter.py +53 -0
- label_studio_sdk/types/filter_group.py +35 -0
- label_studio_sdk/types/gcs_export_storage.py +112 -0
- label_studio_sdk/types/gcs_export_storage_status.py +7 -0
- label_studio_sdk/types/gcs_import_storage.py +113 -0
- label_studio_sdk/types/gcs_import_storage_status.py +7 -0
- label_studio_sdk/types/local_files_export_storage.py +97 -0
- label_studio_sdk/types/local_files_export_storage_status.py +7 -0
- label_studio_sdk/types/local_files_import_storage.py +92 -0
- label_studio_sdk/types/local_files_import_storage_status.py +7 -0
- label_studio_sdk/types/ml_backend.py +89 -0
- label_studio_sdk/types/ml_backend_auth_method.py +5 -0
- label_studio_sdk/types/ml_backend_state.py +5 -0
- label_studio_sdk/types/prediction.py +78 -0
- label_studio_sdk/types/project.py +198 -0
- label_studio_sdk/types/project_import.py +63 -0
- label_studio_sdk/types/project_import_status.py +5 -0
- label_studio_sdk/types/project_label_config.py +32 -0
- label_studio_sdk/types/project_sampling.py +7 -0
- label_studio_sdk/types/project_skip_queue.py +5 -0
- label_studio_sdk/types/redis_export_storage.py +117 -0
- label_studio_sdk/types/redis_export_storage_status.py +7 -0
- label_studio_sdk/types/redis_import_storage.py +112 -0
- label_studio_sdk/types/redis_import_storage_status.py +7 -0
- label_studio_sdk/types/s3export_storage.py +134 -0
- label_studio_sdk/types/s3export_storage_status.py +7 -0
- label_studio_sdk/types/s3import_storage.py +140 -0
- label_studio_sdk/types/s3import_storage_status.py +7 -0
- label_studio_sdk/types/serialization_option.py +36 -0
- label_studio_sdk/types/serialization_options.py +45 -0
- label_studio_sdk/types/task.py +157 -0
- label_studio_sdk/types/task_filter_options.py +49 -0
- label_studio_sdk/types/user_simple.py +37 -0
- label_studio_sdk/types/view.py +55 -0
- label_studio_sdk/types/webhook.py +67 -0
- label_studio_sdk/types/webhook_actions_item.py +21 -0
- label_studio_sdk/types/webhook_serializer_for_update.py +67 -0
- label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +21 -0
- label_studio_sdk/users/__init__.py +5 -0
- label_studio_sdk/users/client.py +830 -0
- label_studio_sdk/users/types/__init__.py +6 -0
- label_studio_sdk/users/types/users_get_token_response.py +36 -0
- label_studio_sdk/users/types/users_reset_token_response.py +36 -0
- label_studio_sdk/version.py +4 -0
- label_studio_sdk/views/__init__.py +31 -0
- label_studio_sdk/views/client.py +564 -0
- label_studio_sdk/views/types/__init__.py +29 -0
- label_studio_sdk/views/types/views_create_request_data.py +43 -0
- label_studio_sdk/views/types/views_create_request_data_filters.py +43 -0
- label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +5 -0
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +47 -0
- label_studio_sdk/views/types/views_create_request_data_ordering_item.py +38 -0
- label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +5 -0
- label_studio_sdk/views/types/views_update_request_data.py +43 -0
- label_studio_sdk/views/types/views_update_request_data_filters.py +43 -0
- label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +5 -0
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +47 -0
- label_studio_sdk/views/types/views_update_request_data_ordering_item.py +38 -0
- label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +5 -0
- label_studio_sdk/webhooks/__init__.py +5 -0
- label_studio_sdk/webhooks/client.py +636 -0
- label_studio_sdk/webhooks/types/__init__.py +5 -0
- label_studio_sdk/webhooks/types/webhooks_update_request_actions_item.py +21 -0
- label_studio_sdk-1.0.0.dist-info/METADATA +307 -0
- label_studio_sdk-1.0.0.dist-info/RECORD +239 -0
- {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-1.0.0.dist-info}/WHEEL +1 -2
- docs/__init__.py +0 -3
- label_studio_sdk-0.0.32.dist-info/LICENSE +0 -201
- label_studio_sdk-0.0.32.dist-info/METADATA +0 -22
- label_studio_sdk-0.0.32.dist-info/RECORD +0 -15
- label_studio_sdk-0.0.32.dist-info/top_level.txt +0 -3
- tests/test_client.py +0 -26
- {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
3
|
+
"title": "LabelConfig",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"$": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"@name": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"@toName": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"@value": {
|
|
15
|
+
"anyOf": [
|
|
16
|
+
{"type": "string"},
|
|
17
|
+
{"type": "boolean"},
|
|
18
|
+
{"type": "number"}
|
|
19
|
+
]},
|
|
20
|
+
"@valueList": {
|
|
21
|
+
"anyOf": [
|
|
22
|
+
{"type": "string"}
|
|
23
|
+
]},
|
|
24
|
+
"tag_with_value": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"required": [
|
|
27
|
+
"@value"
|
|
28
|
+
],
|
|
29
|
+
"properties": {
|
|
30
|
+
"@value": {
|
|
31
|
+
"$ref": "#/definitions/@value"
|
|
32
|
+
},
|
|
33
|
+
"$": {
|
|
34
|
+
"$ref": "#/definitions/$"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"tag_with_value_required_name": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"oneOf": [
|
|
41
|
+
{
|
|
42
|
+
"required": [
|
|
43
|
+
"@name",
|
|
44
|
+
"@value"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"required": [
|
|
49
|
+
"@name",
|
|
50
|
+
"@valueList"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"properties": {
|
|
55
|
+
"@value": {
|
|
56
|
+
"$ref": "#/definitions/@value"
|
|
57
|
+
},
|
|
58
|
+
"$": {
|
|
59
|
+
"$ref": "#/definitions/$"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"tags_with_value": {
|
|
64
|
+
"anyOf": [{
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {"$ref": "#/definitions/tag_with_value"}
|
|
67
|
+
}, {"$ref": "#/definitions/tag_with_value"}]
|
|
68
|
+
},
|
|
69
|
+
"tags_with_value_or_object": {
|
|
70
|
+
"anyOf": [{
|
|
71
|
+
"type": "array",
|
|
72
|
+
"items": {"$ref": "#/definitions/tag_with_value"}
|
|
73
|
+
}, {
|
|
74
|
+
"type": "object"
|
|
75
|
+
}, {"$ref": "#/definitions/tag_with_value"}]
|
|
76
|
+
},
|
|
77
|
+
"tags_with_value_required_name": {
|
|
78
|
+
"anyOf": [{
|
|
79
|
+
"type": "array",
|
|
80
|
+
"items": {"$ref": "#/definitions/tag_with_value_required_name"}
|
|
81
|
+
}, {"$ref": "#/definitions/tag_with_value_required_name"}]
|
|
82
|
+
},
|
|
83
|
+
"View": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": true,
|
|
86
|
+
"properties": {
|
|
87
|
+
"Labels": {"$ref": "#/definitions/MaybeMultipleLabels"},
|
|
88
|
+
"Choices": {"$ref": "#/definitions/MaybeMultipleChoices"},
|
|
89
|
+
"Label": {"$ref": "#/definitions/MaybeMultipleLabel"},
|
|
90
|
+
"Choice": {"$ref": "#/definitions/MaybeMultipleChoice"},
|
|
91
|
+
"Image": {"$ref": "#/definitions/tags_with_value_required_name"},
|
|
92
|
+
"Text": {"$ref": "#/definitions/tags_with_value_required_name"},
|
|
93
|
+
"HyperText": {"$ref": "#/definitions/tags_with_value_required_name"},
|
|
94
|
+
"View": {"$ref": "#/definitions/MaybeMultipleView"},
|
|
95
|
+
"TextArea": {"$ref": "#/definitions/MaybeMultipleTextAreas"}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"MaybeMultipleView": {
|
|
99
|
+
"anyOf": [{
|
|
100
|
+
"type": "array",
|
|
101
|
+
"items": {"$ref": "#/definitions/View"}
|
|
102
|
+
}, {"$ref": "#/definitions/View"}]
|
|
103
|
+
},
|
|
104
|
+
"Choice": {
|
|
105
|
+
"$ref": "#/definitions/tag_with_value"
|
|
106
|
+
},
|
|
107
|
+
"MaybeMultipleChoice": {
|
|
108
|
+
"anyOf": [{
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": {"$ref": "#/definitions/Choice"}
|
|
111
|
+
}, {"$ref": "#/definitions/Choice"}]
|
|
112
|
+
},
|
|
113
|
+
"Label": {
|
|
114
|
+
"$ref": "#/definitions/tag_with_value"
|
|
115
|
+
},
|
|
116
|
+
"MaybeMultipleLabel": {
|
|
117
|
+
"anyOf": [{
|
|
118
|
+
"type": "array",
|
|
119
|
+
"items": {"$ref": "#/definitions/Label"}
|
|
120
|
+
}, {"$ref": "#/definitions/Label"}]
|
|
121
|
+
},
|
|
122
|
+
"Choices": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"anyOf": [
|
|
125
|
+
{"required": ["@name", "@toName", "Choice"]},
|
|
126
|
+
{"required": ["@name", "@toName", "@value"]},
|
|
127
|
+
{"required": ["@name", "@toName", "View"]}
|
|
128
|
+
],
|
|
129
|
+
"properties": {
|
|
130
|
+
"@name": {
|
|
131
|
+
"$ref": "#/definitions/@name"
|
|
132
|
+
},
|
|
133
|
+
"@toName": {
|
|
134
|
+
"$ref": "#/definitions/@toName"
|
|
135
|
+
},
|
|
136
|
+
"@value": {
|
|
137
|
+
"$ref": "#/definitions/@value"
|
|
138
|
+
},
|
|
139
|
+
"$": {
|
|
140
|
+
"$ref": "#/definitions/$"
|
|
141
|
+
},
|
|
142
|
+
"Choice": {
|
|
143
|
+
"type": "array",
|
|
144
|
+
"items": {"$ref": "#/definitions/Choice"}
|
|
145
|
+
},
|
|
146
|
+
"View": {"$ref": "#/definitions/MaybeMultipleView"}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"MaybeMultipleChoices": {
|
|
150
|
+
"anyOf": [{
|
|
151
|
+
"type": "array",
|
|
152
|
+
"items": {"$ref": "#/definitions/Choices"}
|
|
153
|
+
}, {"$ref": "#/definitions/Choices"}]
|
|
154
|
+
},
|
|
155
|
+
"Labels": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"anyOf": [
|
|
158
|
+
{"required": ["@name", "@toName", "Label"]},
|
|
159
|
+
{"required": ["@name", "@toName", "@value"]},
|
|
160
|
+
{"required": ["@name", "@toName", "View"]}
|
|
161
|
+
],
|
|
162
|
+
"properties": {
|
|
163
|
+
"@name": {
|
|
164
|
+
"$ref": "#/definitions/@name"
|
|
165
|
+
},
|
|
166
|
+
"@toName": {
|
|
167
|
+
"$ref": "#/definitions/@toName"
|
|
168
|
+
},
|
|
169
|
+
"@value": {
|
|
170
|
+
"$ref": "#/definitions/@value"
|
|
171
|
+
},
|
|
172
|
+
"$": {
|
|
173
|
+
"$ref": "#/definitions/$"
|
|
174
|
+
},
|
|
175
|
+
"Label": {"$ref": "#/definitions/MaybeMultipleLabel"},
|
|
176
|
+
"View": {"$ref": "#/definitions/MaybeMultipleView"}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"MaybeMultipleLabels": {
|
|
180
|
+
"anyOf": [{
|
|
181
|
+
"type": "array",
|
|
182
|
+
"items": {"$ref": "#/definitions/Labels"}
|
|
183
|
+
}, {"$ref": "#/definitions/Labels"}]
|
|
184
|
+
},
|
|
185
|
+
"TextArea": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"anyOf": [
|
|
188
|
+
{"required": ["@name", "@toName"]}
|
|
189
|
+
],
|
|
190
|
+
"properties": {
|
|
191
|
+
"@name": {
|
|
192
|
+
"$ref": "#/definitions/@name"
|
|
193
|
+
},
|
|
194
|
+
"@toName": {
|
|
195
|
+
"$ref": "#/definitions/@toName"
|
|
196
|
+
},
|
|
197
|
+
"$": {
|
|
198
|
+
"$ref": "#/definitions/$"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"MaybeMultipleTextAreas": {
|
|
203
|
+
"anyOf": [{
|
|
204
|
+
"type": "array",
|
|
205
|
+
"items": {"$ref": "#/definitions/TextArea"}
|
|
206
|
+
}, {"$ref": "#/definitions/TextArea"}]
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
},
|
|
210
|
+
"type": "object",
|
|
211
|
+
"properties": {
|
|
212
|
+
"View": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"additionalProperties": true,
|
|
215
|
+
"properties": {
|
|
216
|
+
"Choices": {"$ref": "#/definitions/MaybeMultipleChoices"},
|
|
217
|
+
"Labels": {"$ref": "#/definitions/MaybeMultipleLabels"},
|
|
218
|
+
"View": {"$ref": "#/definitions/MaybeMultipleView"},
|
|
219
|
+
"Image": {"$ref": "#/definitions/tags_with_value_required_name"},
|
|
220
|
+
"Text": {"$ref": "#/definitions/tags_with_value_required_name"},
|
|
221
|
+
"HyperText": {"$ref": "#/definitions/tags_with_value_required_name"},
|
|
222
|
+
"TextArea": {"$ref": "#/definitions/MaybeMultipleTextAreas"}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from pydantic import BaseModel
|
|
3
2
|
from enum import Enum
|
|
4
3
|
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
5
7
|
from .client import Client
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
class UserRole(Enum):
|
|
9
|
-
ANNOTATOR =
|
|
10
|
-
REVIEWER =
|
|
11
|
-
MANAGER =
|
|
12
|
-
ADMINISTRATOR =
|
|
13
|
-
OWNER =
|
|
14
|
-
NOT_ACTIVATED =
|
|
15
|
-
DISABLED =
|
|
11
|
+
ANNOTATOR = "AN"
|
|
12
|
+
REVIEWER = "RE"
|
|
13
|
+
MANAGER = "MA"
|
|
14
|
+
ADMINISTRATOR = "AD"
|
|
15
|
+
OWNER = "OW"
|
|
16
|
+
NOT_ACTIVATED = "NO"
|
|
17
|
+
DISABLED = "DI"
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
class OrgMembership(BaseModel):
|
|
@@ -30,8 +32,8 @@ class User(BaseModel):
|
|
|
30
32
|
last_activity: datetime
|
|
31
33
|
initials: str
|
|
32
34
|
phone: str
|
|
33
|
-
active_organization: Optional[int]
|
|
34
|
-
org_membership: Optional[List[OrgMembership]]
|
|
35
|
+
active_organization: Optional[int] = None
|
|
36
|
+
org_membership: Optional[List[OrgMembership]] = Field(default_factory=list)
|
|
35
37
|
client: Client
|
|
36
38
|
|
|
37
39
|
class Config:
|
|
@@ -46,9 +48,9 @@ class User(BaseModel):
|
|
|
46
48
|
User role
|
|
47
49
|
"""
|
|
48
50
|
response = self.client.make_request(
|
|
49
|
-
|
|
50
|
-
f
|
|
51
|
-
json={
|
|
51
|
+
"PATCH",
|
|
52
|
+
f"/api/organizations/{self.active_organization}/memberships",
|
|
53
|
+
json={"user_id": self.id, "role": role.value},
|
|
52
54
|
)
|
|
53
55
|
for membership in self.org_membership:
|
|
54
56
|
if membership.organization_id == self.active_organization:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
""" .. include::../docs/utils.md
|
|
2
2
|
"""
|
|
3
|
+
|
|
3
4
|
import logging
|
|
4
5
|
|
|
5
6
|
from lxml import etree
|
|
@@ -7,9 +8,9 @@ from collections import defaultdict
|
|
|
7
8
|
|
|
8
9
|
logger = logging.getLogger(__name__)
|
|
9
10
|
|
|
10
|
-
_LABEL_TAGS = {
|
|
11
|
+
_LABEL_TAGS = {"Label", "Choice"}
|
|
11
12
|
_NOT_CONTROL_TAGS = {
|
|
12
|
-
|
|
13
|
+
"Filter",
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
|
|
@@ -49,12 +50,12 @@ def parse_config(config_string):
|
|
|
49
50
|
return {}
|
|
50
51
|
|
|
51
52
|
def _is_input_tag(tag):
|
|
52
|
-
return tag.attrib.get(
|
|
53
|
+
return tag.attrib.get("name") and tag.attrib.get("value")
|
|
53
54
|
|
|
54
55
|
def _is_output_tag(tag):
|
|
55
56
|
return (
|
|
56
|
-
tag.attrib.get(
|
|
57
|
-
and tag.attrib.get(
|
|
57
|
+
tag.attrib.get("name")
|
|
58
|
+
and tag.attrib.get("toName")
|
|
58
59
|
and tag.tag not in _NOT_CONTROL_TAGS
|
|
59
60
|
)
|
|
60
61
|
|
|
@@ -65,7 +66,7 @@ def parse_config(config_string):
|
|
|
65
66
|
parent = parent.getparent()
|
|
66
67
|
if parent is None:
|
|
67
68
|
return
|
|
68
|
-
name = parent.attrib.get(
|
|
69
|
+
name = parent.attrib.get("name")
|
|
69
70
|
if name in outputs:
|
|
70
71
|
return name
|
|
71
72
|
|
|
@@ -74,55 +75,55 @@ def parse_config(config_string):
|
|
|
74
75
|
inputs, outputs, labels = {}, {}, defaultdict(dict)
|
|
75
76
|
for tag in xml_tree.iter():
|
|
76
77
|
if _is_output_tag(tag):
|
|
77
|
-
tag_info = {
|
|
78
|
+
tag_info = {"type": tag.tag, "to_name": tag.attrib["toName"].split(",")}
|
|
78
79
|
# Grab conditionals if any
|
|
79
80
|
conditionals = {}
|
|
80
|
-
if tag.attrib.get(
|
|
81
|
-
if tag.attrib.get(
|
|
82
|
-
conditionals = {
|
|
83
|
-
elif tag.attrib.get(
|
|
81
|
+
if tag.attrib.get("perRegion") == "true":
|
|
82
|
+
if tag.attrib.get("whenTagName"):
|
|
83
|
+
conditionals = {"type": "tag", "name": tag.attrib["whenTagName"]}
|
|
84
|
+
elif tag.attrib.get("whenLabelValue"):
|
|
84
85
|
conditionals = {
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
"type": "label",
|
|
87
|
+
"name": tag.attrib["whenLabelValue"],
|
|
87
88
|
}
|
|
88
|
-
elif tag.attrib.get(
|
|
89
|
+
elif tag.attrib.get("whenChoiceValue"):
|
|
89
90
|
conditionals = {
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
"type": "choice",
|
|
92
|
+
"name": tag.attrib["whenChoiceValue"],
|
|
92
93
|
}
|
|
93
94
|
if conditionals:
|
|
94
|
-
tag_info[
|
|
95
|
-
outputs[tag.attrib[
|
|
95
|
+
tag_info["conditionals"] = conditionals
|
|
96
|
+
outputs[tag.attrib["name"]] = tag_info
|
|
96
97
|
elif _is_input_tag(tag):
|
|
97
|
-
inputs[tag.attrib[
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
inputs[tag.attrib["name"]] = {
|
|
99
|
+
"type": tag.tag,
|
|
100
|
+
"value": tag.attrib["value"].lstrip("$"),
|
|
100
101
|
}
|
|
101
102
|
if tag.tag not in _LABEL_TAGS:
|
|
102
103
|
continue
|
|
103
104
|
parent_name = _get_parent_output_tag_name(tag, outputs)
|
|
104
105
|
if parent_name is not None:
|
|
105
|
-
actual_value = tag.attrib.get(
|
|
106
|
+
actual_value = tag.attrib.get("alias") or tag.attrib.get("value")
|
|
106
107
|
if not actual_value:
|
|
107
108
|
logger.debug(
|
|
108
109
|
'Inspecting tag {tag_name}... found no "value" or "alias" attributes.'.format(
|
|
109
|
-
tag_name=etree.tostring(tag, encoding=
|
|
110
|
+
tag_name=etree.tostring(tag, encoding="unicode").strip()[:50]
|
|
110
111
|
)
|
|
111
112
|
)
|
|
112
113
|
else:
|
|
113
114
|
labels[parent_name][actual_value] = dict(tag.attrib)
|
|
114
115
|
for output_tag, tag_info in outputs.items():
|
|
115
|
-
tag_info[
|
|
116
|
-
for input_tag_name in tag_info[
|
|
116
|
+
tag_info["inputs"] = []
|
|
117
|
+
for input_tag_name in tag_info["to_name"]:
|
|
117
118
|
if input_tag_name not in inputs:
|
|
118
119
|
logger.warning(
|
|
119
|
-
f
|
|
120
|
-
|
|
120
|
+
f"to_name={input_tag_name} is specified for output tag name={output_tag}, "
|
|
121
|
+
"but we can't find it among input tags"
|
|
121
122
|
)
|
|
122
123
|
continue
|
|
123
|
-
tag_info[
|
|
124
|
-
tag_info[
|
|
125
|
-
tag_info[
|
|
124
|
+
tag_info["inputs"].append(inputs[input_tag_name])
|
|
125
|
+
tag_info["labels"] = list(labels[output_tag])
|
|
126
|
+
tag_info["labels_attrs"] = labels[output_tag]
|
|
126
127
|
return outputs
|
|
127
128
|
|
|
128
129
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from pydantic import BaseModel
|
|
2
|
-
|
|
3
|
-
from .users import User
|
|
4
|
+
|
|
4
5
|
from .client import Client
|
|
6
|
+
from .users import User
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
class Workspace(BaseModel):
|
|
8
10
|
id: int
|
|
9
11
|
title: str
|
|
10
|
-
description: Optional[str]
|
|
12
|
+
description: Optional[str] = ''
|
|
11
13
|
color: str
|
|
12
14
|
is_personal: bool
|
|
13
15
|
created_by: int
|
|
@@ -25,9 +27,9 @@ class Workspace(BaseModel):
|
|
|
25
27
|
User
|
|
26
28
|
"""
|
|
27
29
|
response = self.client.make_request(
|
|
28
|
-
|
|
29
|
-
f
|
|
30
|
-
json={
|
|
30
|
+
"POST",
|
|
31
|
+
f"/api/workspaces/{self.id}/memberships",
|
|
32
|
+
json={"workspace": self.id, "user": user.id},
|
|
31
33
|
)
|
|
32
34
|
return response.json()
|
|
33
35
|
|
|
@@ -40,9 +42,9 @@ class Workspace(BaseModel):
|
|
|
40
42
|
User
|
|
41
43
|
"""
|
|
42
44
|
response = self.client.make_request(
|
|
43
|
-
|
|
44
|
-
f
|
|
45
|
-
json={
|
|
45
|
+
"DELETE",
|
|
46
|
+
f"/api/workspaces/{self.id}/memberships",
|
|
47
|
+
json={"workspace": self.id, "user": user.id},
|
|
46
48
|
)
|
|
47
49
|
if response.status_code != 204:
|
|
48
50
|
raise ValueError(str(response.content))
|
|
@@ -59,11 +61,11 @@ class Workspace(BaseModel):
|
|
|
59
61
|
|
|
60
62
|
final_results = []
|
|
61
63
|
response = self.client.make_request(
|
|
62
|
-
|
|
64
|
+
"GET", f"/api/workspaces/{self.id}/projects"
|
|
63
65
|
)
|
|
64
66
|
projects = response.json()
|
|
65
67
|
for project_data in projects:
|
|
66
|
-
project_id = project_data[
|
|
68
|
+
project_id = project_data["id"]
|
|
67
69
|
final_results.append(
|
|
68
70
|
Project.get_from_id(
|
|
69
71
|
client=self.client,
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.request_options import RequestOptions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ActionsClient:
|
|
12
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
13
|
+
self._client_wrapper = client_wrapper
|
|
14
|
+
|
|
15
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
16
|
+
"""
|
|
17
|
+
Retrieve all the registered actions with descriptions that data manager can use.
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
request_options : typing.Optional[RequestOptions]
|
|
22
|
+
Request-specific configuration.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
None
|
|
27
|
+
|
|
28
|
+
Examples
|
|
29
|
+
--------
|
|
30
|
+
from label_studio_sdk.client import LabelStudio
|
|
31
|
+
|
|
32
|
+
client = LabelStudio(
|
|
33
|
+
api_key="YOUR_API_KEY",
|
|
34
|
+
)
|
|
35
|
+
client.actions.list()
|
|
36
|
+
"""
|
|
37
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
38
|
+
"api/dm/actions/", method="GET", request_options=request_options
|
|
39
|
+
)
|
|
40
|
+
if 200 <= _response.status_code < 300:
|
|
41
|
+
return
|
|
42
|
+
try:
|
|
43
|
+
_response_json = _response.json()
|
|
44
|
+
except JSONDecodeError:
|
|
45
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
46
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
47
|
+
|
|
48
|
+
def create(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
49
|
+
"""
|
|
50
|
+
Perform an action with the selected items from a specific view.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
request_options : typing.Optional[RequestOptions]
|
|
55
|
+
Request-specific configuration.
|
|
56
|
+
|
|
57
|
+
Returns
|
|
58
|
+
-------
|
|
59
|
+
None
|
|
60
|
+
|
|
61
|
+
Examples
|
|
62
|
+
--------
|
|
63
|
+
from label_studio_sdk.client import LabelStudio
|
|
64
|
+
|
|
65
|
+
client = LabelStudio(
|
|
66
|
+
api_key="YOUR_API_KEY",
|
|
67
|
+
)
|
|
68
|
+
client.actions.create()
|
|
69
|
+
"""
|
|
70
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
71
|
+
"api/dm/actions/", method="POST", request_options=request_options
|
|
72
|
+
)
|
|
73
|
+
if 200 <= _response.status_code < 300:
|
|
74
|
+
return
|
|
75
|
+
try:
|
|
76
|
+
_response_json = _response.json()
|
|
77
|
+
except JSONDecodeError:
|
|
78
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
79
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class AsyncActionsClient:
|
|
83
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
84
|
+
self._client_wrapper = client_wrapper
|
|
85
|
+
|
|
86
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Retrieve all the registered actions with descriptions that data manager can use.
|
|
89
|
+
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
request_options : typing.Optional[RequestOptions]
|
|
93
|
+
Request-specific configuration.
|
|
94
|
+
|
|
95
|
+
Returns
|
|
96
|
+
-------
|
|
97
|
+
None
|
|
98
|
+
|
|
99
|
+
Examples
|
|
100
|
+
--------
|
|
101
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
102
|
+
|
|
103
|
+
client = AsyncLabelStudio(
|
|
104
|
+
api_key="YOUR_API_KEY",
|
|
105
|
+
)
|
|
106
|
+
await client.actions.list()
|
|
107
|
+
"""
|
|
108
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
109
|
+
"api/dm/actions/", method="GET", request_options=request_options
|
|
110
|
+
)
|
|
111
|
+
if 200 <= _response.status_code < 300:
|
|
112
|
+
return
|
|
113
|
+
try:
|
|
114
|
+
_response_json = _response.json()
|
|
115
|
+
except JSONDecodeError:
|
|
116
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
117
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
118
|
+
|
|
119
|
+
async def create(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
120
|
+
"""
|
|
121
|
+
Perform an action with the selected items from a specific view.
|
|
122
|
+
|
|
123
|
+
Parameters
|
|
124
|
+
----------
|
|
125
|
+
request_options : typing.Optional[RequestOptions]
|
|
126
|
+
Request-specific configuration.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
None
|
|
131
|
+
|
|
132
|
+
Examples
|
|
133
|
+
--------
|
|
134
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
135
|
+
|
|
136
|
+
client = AsyncLabelStudio(
|
|
137
|
+
api_key="YOUR_API_KEY",
|
|
138
|
+
)
|
|
139
|
+
await client.actions.create()
|
|
140
|
+
"""
|
|
141
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
142
|
+
"api/dm/actions/", method="POST", request_options=request_options
|
|
143
|
+
)
|
|
144
|
+
if 200 <= _response.status_code < 300:
|
|
145
|
+
return
|
|
146
|
+
try:
|
|
147
|
+
_response_json = _response.json()
|
|
148
|
+
except JSONDecodeError:
|
|
149
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
150
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|