label-studio-sdk 2.0.1__py3-none-any.whl → 2.0.2__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.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +4 -0
- label_studio_sdk/actions/client.py +13 -13
- label_studio_sdk/actions/types/actions_list_response_item.py +3 -3
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +2 -2
- label_studio_sdk/annotations/client.py +441 -441
- label_studio_sdk/comments/client.py +176 -176
- label_studio_sdk/export_storage/azure/client.py +274 -274
- label_studio_sdk/export_storage/gcs/client.py +263 -263
- label_studio_sdk/export_storage/local/client.py +206 -206
- label_studio_sdk/export_storage/redis/client.py +287 -287
- label_studio_sdk/export_storage/s3/client.py +347 -347
- label_studio_sdk/export_storage/s3s/client.py +678 -678
- label_studio_sdk/import_storage/azure/client.py +357 -357
- label_studio_sdk/import_storage/gcs/client.py +357 -357
- label_studio_sdk/import_storage/local/client.py +206 -206
- label_studio_sdk/import_storage/redis/client.py +309 -309
- label_studio_sdk/import_storage/s3/client.py +452 -452
- label_studio_sdk/import_storage/s3s/client.py +735 -735
- label_studio_sdk/jwt_settings/client.py +10 -10
- label_studio_sdk/ml/client.py +118 -118
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +1 -1
- label_studio_sdk/model_providers/client.py +181 -181
- label_studio_sdk/organizations/members/client.py +8 -8
- label_studio_sdk/predictions/client.py +60 -60
- label_studio_sdk/projects/__init__.py +30 -1
- label_studio_sdk/projects/assignments/__init__.py +33 -0
- label_studio_sdk/projects/assignments/client.py +764 -0
- label_studio_sdk/projects/assignments/types/__init__.py +35 -0
- label_studio_sdk/projects/assignments/types/assignments_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters.py +33 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_conjunction.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item.py +44 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_value.py +7 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items.py +9 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_excluded.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_included.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_response.py +22 -0
- label_studio_sdk/projects/assignments/types/assignments_update_request_type.py +5 -0
- label_studio_sdk/projects/client.py +441 -425
- label_studio_sdk/projects/exports/client.py +55 -55
- label_studio_sdk/projects/exports/types/exports_convert_response.py +1 -1
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +5 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +12 -12
- label_studio_sdk/prompts/client.py +211 -211
- label_studio_sdk/prompts/runs/client.py +33 -33
- label_studio_sdk/prompts/versions/client.py +72 -72
- label_studio_sdk/tasks/client.py +174 -174
- label_studio_sdk/types/__init__.py +4 -0
- label_studio_sdk/types/all_roles_project_list.py +94 -94
- label_studio_sdk/types/annotation.py +35 -35
- label_studio_sdk/types/annotation_request.py +27 -27
- label_studio_sdk/types/azure_blob_export_storage.py +29 -29
- label_studio_sdk/types/azure_blob_import_storage.py +33 -33
- label_studio_sdk/types/batch_failed_predictions.py +1 -1
- label_studio_sdk/types/billing_checks.py +14 -14
- label_studio_sdk/types/billing_flags.py +16 -16
- label_studio_sdk/types/blueprint_list.py +7 -8
- label_studio_sdk/types/child_filter.py +11 -10
- label_studio_sdk/types/comment.py +15 -15
- label_studio_sdk/types/comment_request.py +7 -8
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +17 -18
- label_studio_sdk/types/converted_format.py +1 -1
- label_studio_sdk/types/converted_format_request.py +1 -1
- label_studio_sdk/types/export.py +8 -8
- label_studio_sdk/types/file_upload.py +3 -2
- label_studio_sdk/types/filter.py +10 -9
- label_studio_sdk/types/filter_group.py +4 -3
- label_studio_sdk/types/gcs_export_storage.py +23 -23
- label_studio_sdk/types/gcs_import_storage.py +27 -27
- label_studio_sdk/types/import_api_request.py +26 -26
- label_studio_sdk/types/inference_run_cost_estimate.py +10 -10
- label_studio_sdk/types/local_files_export_storage.py +23 -23
- label_studio_sdk/types/local_files_import_storage.py +26 -26
- label_studio_sdk/types/lse_annotation_filter_options.py +10 -10
- label_studio_sdk/types/lse_annotation_filter_options_request.py +10 -10
- label_studio_sdk/types/lse_export_create.py +12 -12
- label_studio_sdk/types/lse_fields.py +14 -14
- label_studio_sdk/types/lse_organization.py +17 -17
- label_studio_sdk/types/lse_organization_member_list.py +1 -1
- label_studio_sdk/types/lse_project_create.py +72 -72
- label_studio_sdk/types/lse_project_update.py +89 -89
- label_studio_sdk/types/lse_s3export_storage.py +46 -46
- label_studio_sdk/types/lse_s3export_storage_request.py +43 -43
- label_studio_sdk/types/lse_s3import_storage.py +53 -53
- label_studio_sdk/types/lse_s3import_storage_request.py +49 -49
- label_studio_sdk/types/lse_task.py +49 -49
- label_studio_sdk/types/lse_task_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_filter_options.py +14 -14
- label_studio_sdk/types/lse_task_filter_options_request.py +14 -14
- label_studio_sdk/types/lse_task_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +12 -12
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +49 -49
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +5 -5
- label_studio_sdk/types/lse_user.py +13 -13
- label_studio_sdk/types/lse_user_api.py +11 -11
- label_studio_sdk/types/lse_user_organization_member_list.py +13 -13
- label_studio_sdk/types/lseapi_token_create.py +1 -1
- label_studio_sdk/types/lseapi_token_list.py +1 -1
- label_studio_sdk/types/lsejwt_settings.py +5 -5
- label_studio_sdk/types/ml_backend.py +27 -28
- label_studio_sdk/types/model_interface.py +12 -12
- label_studio_sdk/types/model_interface_request.py +7 -8
- label_studio_sdk/types/model_interface_serializer_get.py +13 -13
- label_studio_sdk/types/model_provider_connection.py +34 -34
- label_studio_sdk/types/model_provider_connection_request.py +15 -14
- label_studio_sdk/types/model_run.py +12 -12
- label_studio_sdk/types/organization_billing.py +1 -1
- label_studio_sdk/types/organization_id.py +2 -2
- label_studio_sdk/types/organization_invite.py +1 -1
- label_studio_sdk/types/organization_member.py +8 -9
- label_studio_sdk/types/organization_membership.py +2 -1
- label_studio_sdk/types/pause.py +23 -23
- label_studio_sdk/types/prediction.py +21 -21
- label_studio_sdk/types/prediction_request.py +16 -16
- label_studio_sdk/types/project.py +72 -72
- label_studio_sdk/types/project_import.py +21 -21
- label_studio_sdk/types/redis_export_storage.py +34 -34
- label_studio_sdk/types/redis_import_storage.py +37 -37
- label_studio_sdk/types/refined_prompt_response.py +11 -11
- label_studio_sdk/types/review_settings.py +29 -30
- label_studio_sdk/types/review_settings_request.py +29 -30
- label_studio_sdk/types/s3export_storage.py +45 -45
- label_studio_sdk/types/s3import_storage.py +44 -44
- label_studio_sdk/types/selected_items_request.py +1 -1
- label_studio_sdk/types/serialization_options.py +10 -10
- label_studio_sdk/types/serialization_options_request.py +10 -10
- label_studio_sdk/types/task_assignment.py +43 -0
- label_studio_sdk/types/third_party_model_version.py +11 -11
- label_studio_sdk/types/third_party_model_version_request.py +6 -7
- label_studio_sdk/types/type_enum.py +5 -0
- label_studio_sdk/types/user_simple.py +3 -3
- label_studio_sdk/types/user_simple_request.py +1 -1
- label_studio_sdk/types/version_response.py +19 -20
- label_studio_sdk/types/view.py +8 -8
- label_studio_sdk/types/webhook.py +16 -16
- label_studio_sdk/types/webhook_serializer_for_update.py +16 -16
- label_studio_sdk/types/workspace.py +10 -11
- label_studio_sdk/users/client.py +160 -160
- label_studio_sdk/views/client.py +164 -164
- label_studio_sdk/webhooks/client.py +183 -183
- label_studio_sdk/webhooks/types/webhooks_info_response.py +32 -32
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +1 -1
- label_studio_sdk/workspaces/client.py +40 -40
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.2.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.2.dist-info}/RECORD +167 -149
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.2.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.2.dist-info}/WHEEL +0 -0
|
@@ -79,11 +79,11 @@ class LocalClient:
|
|
|
79
79
|
def create(
|
|
80
80
|
self,
|
|
81
81
|
*,
|
|
82
|
-
title: typing.Optional[str] = OMIT,
|
|
83
82
|
description: typing.Optional[str] = OMIT,
|
|
84
|
-
project: typing.Optional[int] = OMIT,
|
|
85
83
|
path: typing.Optional[str] = OMIT,
|
|
84
|
+
project: typing.Optional[int] = OMIT,
|
|
86
85
|
regex_filter: typing.Optional[str] = OMIT,
|
|
86
|
+
title: typing.Optional[str] = OMIT,
|
|
87
87
|
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
88
88
|
request_options: typing.Optional[RequestOptions] = None,
|
|
89
89
|
) -> LocalFilesImportStorage:
|
|
@@ -92,21 +92,21 @@ class LocalClient:
|
|
|
92
92
|
|
|
93
93
|
Parameters
|
|
94
94
|
----------
|
|
95
|
-
title : typing.Optional[str]
|
|
96
|
-
Storage title
|
|
97
|
-
|
|
98
95
|
description : typing.Optional[str]
|
|
99
96
|
Storage description
|
|
100
97
|
|
|
101
|
-
project : typing.Optional[int]
|
|
102
|
-
Project ID
|
|
103
|
-
|
|
104
98
|
path : typing.Optional[str]
|
|
105
99
|
Path to local directory
|
|
106
100
|
|
|
101
|
+
project : typing.Optional[int]
|
|
102
|
+
Project ID
|
|
103
|
+
|
|
107
104
|
regex_filter : typing.Optional[str]
|
|
108
105
|
Regex for filtering objects
|
|
109
106
|
|
|
107
|
+
title : typing.Optional[str]
|
|
108
|
+
Storage title
|
|
109
|
+
|
|
110
110
|
use_blob_urls : typing.Optional[bool]
|
|
111
111
|
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
112
112
|
|
|
@@ -131,11 +131,11 @@ class LocalClient:
|
|
|
131
131
|
"api/storages/localfiles/",
|
|
132
132
|
method="POST",
|
|
133
133
|
json={
|
|
134
|
-
"title": title,
|
|
135
134
|
"description": description,
|
|
136
|
-
"project": project,
|
|
137
135
|
"path": path,
|
|
136
|
+
"project": project,
|
|
138
137
|
"regex_filter": regex_filter,
|
|
138
|
+
"title": title,
|
|
139
139
|
"use_blob_urls": use_blob_urls,
|
|
140
140
|
},
|
|
141
141
|
headers={
|
|
@@ -158,6 +158,86 @@ class LocalClient:
|
|
|
158
158
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
159
159
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
160
160
|
|
|
161
|
+
def validate(
|
|
162
|
+
self,
|
|
163
|
+
*,
|
|
164
|
+
description: typing.Optional[str] = OMIT,
|
|
165
|
+
id: typing.Optional[int] = OMIT,
|
|
166
|
+
path: typing.Optional[str] = OMIT,
|
|
167
|
+
project: typing.Optional[int] = OMIT,
|
|
168
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
169
|
+
title: typing.Optional[str] = OMIT,
|
|
170
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
171
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
172
|
+
) -> None:
|
|
173
|
+
"""
|
|
174
|
+
Validate a specific local file import storage connection.
|
|
175
|
+
|
|
176
|
+
Parameters
|
|
177
|
+
----------
|
|
178
|
+
description : typing.Optional[str]
|
|
179
|
+
Storage description
|
|
180
|
+
|
|
181
|
+
id : typing.Optional[int]
|
|
182
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
183
|
+
|
|
184
|
+
path : typing.Optional[str]
|
|
185
|
+
Path to local directory
|
|
186
|
+
|
|
187
|
+
project : typing.Optional[int]
|
|
188
|
+
Project ID
|
|
189
|
+
|
|
190
|
+
regex_filter : typing.Optional[str]
|
|
191
|
+
Regex for filtering objects
|
|
192
|
+
|
|
193
|
+
title : typing.Optional[str]
|
|
194
|
+
Storage title
|
|
195
|
+
|
|
196
|
+
use_blob_urls : typing.Optional[bool]
|
|
197
|
+
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
198
|
+
|
|
199
|
+
request_options : typing.Optional[RequestOptions]
|
|
200
|
+
Request-specific configuration.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
None
|
|
205
|
+
|
|
206
|
+
Examples
|
|
207
|
+
--------
|
|
208
|
+
from label_studio_sdk import LabelStudio
|
|
209
|
+
|
|
210
|
+
client = LabelStudio(
|
|
211
|
+
api_key="YOUR_API_KEY",
|
|
212
|
+
)
|
|
213
|
+
client.import_storage.local.validate()
|
|
214
|
+
"""
|
|
215
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
216
|
+
"api/storages/localfiles/validate",
|
|
217
|
+
method="POST",
|
|
218
|
+
json={
|
|
219
|
+
"description": description,
|
|
220
|
+
"id": id,
|
|
221
|
+
"path": path,
|
|
222
|
+
"project": project,
|
|
223
|
+
"regex_filter": regex_filter,
|
|
224
|
+
"title": title,
|
|
225
|
+
"use_blob_urls": use_blob_urls,
|
|
226
|
+
},
|
|
227
|
+
headers={
|
|
228
|
+
"content-type": "application/json",
|
|
229
|
+
},
|
|
230
|
+
request_options=request_options,
|
|
231
|
+
omit=OMIT,
|
|
232
|
+
)
|
|
233
|
+
try:
|
|
234
|
+
if 200 <= _response.status_code < 300:
|
|
235
|
+
return
|
|
236
|
+
_response_json = _response.json()
|
|
237
|
+
except JSONDecodeError:
|
|
238
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
239
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
240
|
+
|
|
161
241
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LocalFilesImportStorage:
|
|
162
242
|
"""
|
|
163
243
|
Get a specific local file import storage connection.
|
|
@@ -247,11 +327,11 @@ class LocalClient:
|
|
|
247
327
|
self,
|
|
248
328
|
id: int,
|
|
249
329
|
*,
|
|
250
|
-
title: typing.Optional[str] = OMIT,
|
|
251
330
|
description: typing.Optional[str] = OMIT,
|
|
252
|
-
project: typing.Optional[int] = OMIT,
|
|
253
331
|
path: typing.Optional[str] = OMIT,
|
|
332
|
+
project: typing.Optional[int] = OMIT,
|
|
254
333
|
regex_filter: typing.Optional[str] = OMIT,
|
|
334
|
+
title: typing.Optional[str] = OMIT,
|
|
255
335
|
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
256
336
|
request_options: typing.Optional[RequestOptions] = None,
|
|
257
337
|
) -> LocalFilesImportStorage:
|
|
@@ -262,21 +342,21 @@ class LocalClient:
|
|
|
262
342
|
----------
|
|
263
343
|
id : int
|
|
264
344
|
|
|
265
|
-
title : typing.Optional[str]
|
|
266
|
-
Storage title
|
|
267
|
-
|
|
268
345
|
description : typing.Optional[str]
|
|
269
346
|
Storage description
|
|
270
347
|
|
|
271
|
-
project : typing.Optional[int]
|
|
272
|
-
Project ID
|
|
273
|
-
|
|
274
348
|
path : typing.Optional[str]
|
|
275
349
|
Path to local directory
|
|
276
350
|
|
|
351
|
+
project : typing.Optional[int]
|
|
352
|
+
Project ID
|
|
353
|
+
|
|
277
354
|
regex_filter : typing.Optional[str]
|
|
278
355
|
Regex for filtering objects
|
|
279
356
|
|
|
357
|
+
title : typing.Optional[str]
|
|
358
|
+
Storage title
|
|
359
|
+
|
|
280
360
|
use_blob_urls : typing.Optional[bool]
|
|
281
361
|
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
282
362
|
|
|
@@ -303,11 +383,11 @@ class LocalClient:
|
|
|
303
383
|
f"api/storages/localfiles/{jsonable_encoder(id)}",
|
|
304
384
|
method="PATCH",
|
|
305
385
|
json={
|
|
306
|
-
"title": title,
|
|
307
386
|
"description": description,
|
|
308
|
-
"project": project,
|
|
309
387
|
"path": path,
|
|
388
|
+
"project": project,
|
|
310
389
|
"regex_filter": regex_filter,
|
|
390
|
+
"title": title,
|
|
311
391
|
"use_blob_urls": use_blob_urls,
|
|
312
392
|
},
|
|
313
393
|
headers={
|
|
@@ -377,115 +457,117 @@ class LocalClient:
|
|
|
377
457
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
378
458
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
379
459
|
|
|
380
|
-
|
|
460
|
+
|
|
461
|
+
class AsyncLocalClient:
|
|
462
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
463
|
+
self._client_wrapper = client_wrapper
|
|
464
|
+
|
|
465
|
+
async def list(
|
|
381
466
|
self,
|
|
382
467
|
*,
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
description: typing.Optional[str] = OMIT,
|
|
386
|
-
project: typing.Optional[int] = OMIT,
|
|
387
|
-
path: typing.Optional[str] = OMIT,
|
|
388
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
389
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
468
|
+
ordering: typing.Optional[str] = None,
|
|
469
|
+
project: typing.Optional[int] = None,
|
|
390
470
|
request_options: typing.Optional[RequestOptions] = None,
|
|
391
|
-
) ->
|
|
471
|
+
) -> typing.List[LocalFilesImportStorage]:
|
|
392
472
|
"""
|
|
393
|
-
|
|
473
|
+
Get a list of all local file import storage connections.
|
|
394
474
|
|
|
395
475
|
Parameters
|
|
396
476
|
----------
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
title : typing.Optional[str]
|
|
401
|
-
Storage title
|
|
402
|
-
|
|
403
|
-
description : typing.Optional[str]
|
|
404
|
-
Storage description
|
|
477
|
+
ordering : typing.Optional[str]
|
|
478
|
+
Which field to use when ordering the results.
|
|
405
479
|
|
|
406
480
|
project : typing.Optional[int]
|
|
407
481
|
Project ID
|
|
408
482
|
|
|
409
|
-
path : typing.Optional[str]
|
|
410
|
-
Path to local directory
|
|
411
|
-
|
|
412
|
-
regex_filter : typing.Optional[str]
|
|
413
|
-
Regex for filtering objects
|
|
414
|
-
|
|
415
|
-
use_blob_urls : typing.Optional[bool]
|
|
416
|
-
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
417
|
-
|
|
418
483
|
request_options : typing.Optional[RequestOptions]
|
|
419
484
|
Request-specific configuration.
|
|
420
485
|
|
|
421
486
|
Returns
|
|
422
487
|
-------
|
|
423
|
-
|
|
488
|
+
typing.List[LocalFilesImportStorage]
|
|
489
|
+
|
|
424
490
|
|
|
425
491
|
Examples
|
|
426
492
|
--------
|
|
427
|
-
|
|
493
|
+
import asyncio
|
|
428
494
|
|
|
429
|
-
|
|
495
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
496
|
+
|
|
497
|
+
client = AsyncLabelStudio(
|
|
430
498
|
api_key="YOUR_API_KEY",
|
|
431
499
|
)
|
|
432
|
-
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
async def main() -> None:
|
|
503
|
+
await client.import_storage.local.list()
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
asyncio.run(main())
|
|
433
507
|
"""
|
|
434
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
435
|
-
"api/storages/localfiles/
|
|
436
|
-
method="
|
|
437
|
-
|
|
438
|
-
"
|
|
439
|
-
"title": title,
|
|
440
|
-
"description": description,
|
|
508
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
509
|
+
"api/storages/localfiles/",
|
|
510
|
+
method="GET",
|
|
511
|
+
params={
|
|
512
|
+
"ordering": ordering,
|
|
441
513
|
"project": project,
|
|
442
|
-
"path": path,
|
|
443
|
-
"regex_filter": regex_filter,
|
|
444
|
-
"use_blob_urls": use_blob_urls,
|
|
445
|
-
},
|
|
446
|
-
headers={
|
|
447
|
-
"content-type": "application/json",
|
|
448
514
|
},
|
|
449
515
|
request_options=request_options,
|
|
450
|
-
omit=OMIT,
|
|
451
516
|
)
|
|
452
517
|
try:
|
|
453
518
|
if 200 <= _response.status_code < 300:
|
|
454
|
-
return
|
|
519
|
+
return typing.cast(
|
|
520
|
+
typing.List[LocalFilesImportStorage],
|
|
521
|
+
construct_type(
|
|
522
|
+
type_=typing.List[LocalFilesImportStorage], # type: ignore
|
|
523
|
+
object_=_response.json(),
|
|
524
|
+
),
|
|
525
|
+
)
|
|
455
526
|
_response_json = _response.json()
|
|
456
527
|
except JSONDecodeError:
|
|
457
528
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
458
529
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
459
530
|
|
|
460
|
-
|
|
461
|
-
class AsyncLocalClient:
|
|
462
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
463
|
-
self._client_wrapper = client_wrapper
|
|
464
|
-
|
|
465
|
-
async def list(
|
|
531
|
+
async def create(
|
|
466
532
|
self,
|
|
467
533
|
*,
|
|
468
|
-
|
|
469
|
-
|
|
534
|
+
description: typing.Optional[str] = OMIT,
|
|
535
|
+
path: typing.Optional[str] = OMIT,
|
|
536
|
+
project: typing.Optional[int] = OMIT,
|
|
537
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
538
|
+
title: typing.Optional[str] = OMIT,
|
|
539
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
470
540
|
request_options: typing.Optional[RequestOptions] = None,
|
|
471
|
-
) ->
|
|
541
|
+
) -> LocalFilesImportStorage:
|
|
472
542
|
"""
|
|
473
|
-
|
|
543
|
+
Create a new local file import storage connection.
|
|
474
544
|
|
|
475
545
|
Parameters
|
|
476
546
|
----------
|
|
477
|
-
|
|
478
|
-
|
|
547
|
+
description : typing.Optional[str]
|
|
548
|
+
Storage description
|
|
549
|
+
|
|
550
|
+
path : typing.Optional[str]
|
|
551
|
+
Path to local directory
|
|
479
552
|
|
|
480
553
|
project : typing.Optional[int]
|
|
481
554
|
Project ID
|
|
482
555
|
|
|
556
|
+
regex_filter : typing.Optional[str]
|
|
557
|
+
Regex for filtering objects
|
|
558
|
+
|
|
559
|
+
title : typing.Optional[str]
|
|
560
|
+
Storage title
|
|
561
|
+
|
|
562
|
+
use_blob_urls : typing.Optional[bool]
|
|
563
|
+
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
564
|
+
|
|
483
565
|
request_options : typing.Optional[RequestOptions]
|
|
484
566
|
Request-specific configuration.
|
|
485
567
|
|
|
486
568
|
Returns
|
|
487
569
|
-------
|
|
488
|
-
|
|
570
|
+
LocalFilesImportStorage
|
|
489
571
|
|
|
490
572
|
|
|
491
573
|
Examples
|
|
@@ -500,26 +582,34 @@ class AsyncLocalClient:
|
|
|
500
582
|
|
|
501
583
|
|
|
502
584
|
async def main() -> None:
|
|
503
|
-
await client.import_storage.local.
|
|
585
|
+
await client.import_storage.local.create()
|
|
504
586
|
|
|
505
587
|
|
|
506
588
|
asyncio.run(main())
|
|
507
589
|
"""
|
|
508
590
|
_response = await self._client_wrapper.httpx_client.request(
|
|
509
591
|
"api/storages/localfiles/",
|
|
510
|
-
method="
|
|
511
|
-
|
|
512
|
-
"
|
|
592
|
+
method="POST",
|
|
593
|
+
json={
|
|
594
|
+
"description": description,
|
|
595
|
+
"path": path,
|
|
513
596
|
"project": project,
|
|
597
|
+
"regex_filter": regex_filter,
|
|
598
|
+
"title": title,
|
|
599
|
+
"use_blob_urls": use_blob_urls,
|
|
600
|
+
},
|
|
601
|
+
headers={
|
|
602
|
+
"content-type": "application/json",
|
|
514
603
|
},
|
|
515
604
|
request_options=request_options,
|
|
605
|
+
omit=OMIT,
|
|
516
606
|
)
|
|
517
607
|
try:
|
|
518
608
|
if 200 <= _response.status_code < 300:
|
|
519
609
|
return typing.cast(
|
|
520
|
-
|
|
610
|
+
LocalFilesImportStorage,
|
|
521
611
|
construct_type(
|
|
522
|
-
type_=
|
|
612
|
+
type_=LocalFilesImportStorage, # type: ignore
|
|
523
613
|
object_=_response.json(),
|
|
524
614
|
),
|
|
525
615
|
)
|
|
@@ -528,37 +618,41 @@ class AsyncLocalClient:
|
|
|
528
618
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
529
619
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
530
620
|
|
|
531
|
-
async def
|
|
621
|
+
async def validate(
|
|
532
622
|
self,
|
|
533
623
|
*,
|
|
534
|
-
title: typing.Optional[str] = OMIT,
|
|
535
624
|
description: typing.Optional[str] = OMIT,
|
|
536
|
-
|
|
625
|
+
id: typing.Optional[int] = OMIT,
|
|
537
626
|
path: typing.Optional[str] = OMIT,
|
|
627
|
+
project: typing.Optional[int] = OMIT,
|
|
538
628
|
regex_filter: typing.Optional[str] = OMIT,
|
|
629
|
+
title: typing.Optional[str] = OMIT,
|
|
539
630
|
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
540
631
|
request_options: typing.Optional[RequestOptions] = None,
|
|
541
|
-
) ->
|
|
632
|
+
) -> None:
|
|
542
633
|
"""
|
|
543
|
-
|
|
634
|
+
Validate a specific local file import storage connection.
|
|
544
635
|
|
|
545
636
|
Parameters
|
|
546
637
|
----------
|
|
547
|
-
title : typing.Optional[str]
|
|
548
|
-
Storage title
|
|
549
|
-
|
|
550
638
|
description : typing.Optional[str]
|
|
551
639
|
Storage description
|
|
552
640
|
|
|
553
|
-
|
|
554
|
-
|
|
641
|
+
id : typing.Optional[int]
|
|
642
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
555
643
|
|
|
556
644
|
path : typing.Optional[str]
|
|
557
645
|
Path to local directory
|
|
558
646
|
|
|
647
|
+
project : typing.Optional[int]
|
|
648
|
+
Project ID
|
|
649
|
+
|
|
559
650
|
regex_filter : typing.Optional[str]
|
|
560
651
|
Regex for filtering objects
|
|
561
652
|
|
|
653
|
+
title : typing.Optional[str]
|
|
654
|
+
Storage title
|
|
655
|
+
|
|
562
656
|
use_blob_urls : typing.Optional[bool]
|
|
563
657
|
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
564
658
|
|
|
@@ -567,8 +661,7 @@ class AsyncLocalClient:
|
|
|
567
661
|
|
|
568
662
|
Returns
|
|
569
663
|
-------
|
|
570
|
-
|
|
571
|
-
|
|
664
|
+
None
|
|
572
665
|
|
|
573
666
|
Examples
|
|
574
667
|
--------
|
|
@@ -582,20 +675,21 @@ class AsyncLocalClient:
|
|
|
582
675
|
|
|
583
676
|
|
|
584
677
|
async def main() -> None:
|
|
585
|
-
await client.import_storage.local.
|
|
678
|
+
await client.import_storage.local.validate()
|
|
586
679
|
|
|
587
680
|
|
|
588
681
|
asyncio.run(main())
|
|
589
682
|
"""
|
|
590
683
|
_response = await self._client_wrapper.httpx_client.request(
|
|
591
|
-
"api/storages/localfiles/",
|
|
684
|
+
"api/storages/localfiles/validate",
|
|
592
685
|
method="POST",
|
|
593
686
|
json={
|
|
594
|
-
"title": title,
|
|
595
687
|
"description": description,
|
|
596
|
-
"
|
|
688
|
+
"id": id,
|
|
597
689
|
"path": path,
|
|
690
|
+
"project": project,
|
|
598
691
|
"regex_filter": regex_filter,
|
|
692
|
+
"title": title,
|
|
599
693
|
"use_blob_urls": use_blob_urls,
|
|
600
694
|
},
|
|
601
695
|
headers={
|
|
@@ -606,13 +700,7 @@ class AsyncLocalClient:
|
|
|
606
700
|
)
|
|
607
701
|
try:
|
|
608
702
|
if 200 <= _response.status_code < 300:
|
|
609
|
-
return
|
|
610
|
-
LocalFilesImportStorage,
|
|
611
|
-
construct_type(
|
|
612
|
-
type_=LocalFilesImportStorage, # type: ignore
|
|
613
|
-
object_=_response.json(),
|
|
614
|
-
),
|
|
615
|
-
)
|
|
703
|
+
return
|
|
616
704
|
_response_json = _response.json()
|
|
617
705
|
except JSONDecodeError:
|
|
618
706
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -723,11 +811,11 @@ class AsyncLocalClient:
|
|
|
723
811
|
self,
|
|
724
812
|
id: int,
|
|
725
813
|
*,
|
|
726
|
-
title: typing.Optional[str] = OMIT,
|
|
727
814
|
description: typing.Optional[str] = OMIT,
|
|
728
|
-
project: typing.Optional[int] = OMIT,
|
|
729
815
|
path: typing.Optional[str] = OMIT,
|
|
816
|
+
project: typing.Optional[int] = OMIT,
|
|
730
817
|
regex_filter: typing.Optional[str] = OMIT,
|
|
818
|
+
title: typing.Optional[str] = OMIT,
|
|
731
819
|
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
732
820
|
request_options: typing.Optional[RequestOptions] = None,
|
|
733
821
|
) -> LocalFilesImportStorage:
|
|
@@ -738,21 +826,21 @@ class AsyncLocalClient:
|
|
|
738
826
|
----------
|
|
739
827
|
id : int
|
|
740
828
|
|
|
741
|
-
title : typing.Optional[str]
|
|
742
|
-
Storage title
|
|
743
|
-
|
|
744
829
|
description : typing.Optional[str]
|
|
745
830
|
Storage description
|
|
746
831
|
|
|
747
|
-
project : typing.Optional[int]
|
|
748
|
-
Project ID
|
|
749
|
-
|
|
750
832
|
path : typing.Optional[str]
|
|
751
833
|
Path to local directory
|
|
752
834
|
|
|
835
|
+
project : typing.Optional[int]
|
|
836
|
+
Project ID
|
|
837
|
+
|
|
753
838
|
regex_filter : typing.Optional[str]
|
|
754
839
|
Regex for filtering objects
|
|
755
840
|
|
|
841
|
+
title : typing.Optional[str]
|
|
842
|
+
Storage title
|
|
843
|
+
|
|
756
844
|
use_blob_urls : typing.Optional[bool]
|
|
757
845
|
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
758
846
|
|
|
@@ -787,11 +875,11 @@ class AsyncLocalClient:
|
|
|
787
875
|
f"api/storages/localfiles/{jsonable_encoder(id)}",
|
|
788
876
|
method="PATCH",
|
|
789
877
|
json={
|
|
790
|
-
"title": title,
|
|
791
878
|
"description": description,
|
|
792
|
-
"project": project,
|
|
793
879
|
"path": path,
|
|
880
|
+
"project": project,
|
|
794
881
|
"regex_filter": regex_filter,
|
|
882
|
+
"title": title,
|
|
795
883
|
"use_blob_urls": use_blob_urls,
|
|
796
884
|
},
|
|
797
885
|
headers={
|
|
@@ -870,91 +958,3 @@ class AsyncLocalClient:
|
|
|
870
958
|
except JSONDecodeError:
|
|
871
959
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
872
960
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
873
|
-
|
|
874
|
-
async def validate(
|
|
875
|
-
self,
|
|
876
|
-
*,
|
|
877
|
-
id: typing.Optional[int] = OMIT,
|
|
878
|
-
title: typing.Optional[str] = OMIT,
|
|
879
|
-
description: typing.Optional[str] = OMIT,
|
|
880
|
-
project: typing.Optional[int] = OMIT,
|
|
881
|
-
path: typing.Optional[str] = OMIT,
|
|
882
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
883
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
884
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
885
|
-
) -> None:
|
|
886
|
-
"""
|
|
887
|
-
Validate a specific local file import storage connection.
|
|
888
|
-
|
|
889
|
-
Parameters
|
|
890
|
-
----------
|
|
891
|
-
id : typing.Optional[int]
|
|
892
|
-
Storage ID. If set, storage with specified ID will be updated
|
|
893
|
-
|
|
894
|
-
title : typing.Optional[str]
|
|
895
|
-
Storage title
|
|
896
|
-
|
|
897
|
-
description : typing.Optional[str]
|
|
898
|
-
Storage description
|
|
899
|
-
|
|
900
|
-
project : typing.Optional[int]
|
|
901
|
-
Project ID
|
|
902
|
-
|
|
903
|
-
path : typing.Optional[str]
|
|
904
|
-
Path to local directory
|
|
905
|
-
|
|
906
|
-
regex_filter : typing.Optional[str]
|
|
907
|
-
Regex for filtering objects
|
|
908
|
-
|
|
909
|
-
use_blob_urls : typing.Optional[bool]
|
|
910
|
-
Interpret objects as BLOBs and generate URLs. For example, if your directory contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
911
|
-
|
|
912
|
-
request_options : typing.Optional[RequestOptions]
|
|
913
|
-
Request-specific configuration.
|
|
914
|
-
|
|
915
|
-
Returns
|
|
916
|
-
-------
|
|
917
|
-
None
|
|
918
|
-
|
|
919
|
-
Examples
|
|
920
|
-
--------
|
|
921
|
-
import asyncio
|
|
922
|
-
|
|
923
|
-
from label_studio_sdk import AsyncLabelStudio
|
|
924
|
-
|
|
925
|
-
client = AsyncLabelStudio(
|
|
926
|
-
api_key="YOUR_API_KEY",
|
|
927
|
-
)
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
async def main() -> None:
|
|
931
|
-
await client.import_storage.local.validate()
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
asyncio.run(main())
|
|
935
|
-
"""
|
|
936
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
937
|
-
"api/storages/localfiles/validate",
|
|
938
|
-
method="POST",
|
|
939
|
-
json={
|
|
940
|
-
"id": id,
|
|
941
|
-
"title": title,
|
|
942
|
-
"description": description,
|
|
943
|
-
"project": project,
|
|
944
|
-
"path": path,
|
|
945
|
-
"regex_filter": regex_filter,
|
|
946
|
-
"use_blob_urls": use_blob_urls,
|
|
947
|
-
},
|
|
948
|
-
headers={
|
|
949
|
-
"content-type": "application/json",
|
|
950
|
-
},
|
|
951
|
-
request_options=request_options,
|
|
952
|
-
omit=OMIT,
|
|
953
|
-
)
|
|
954
|
-
try:
|
|
955
|
-
if 200 <= _response.status_code < 300:
|
|
956
|
-
return
|
|
957
|
-
_response_json = _response.json()
|
|
958
|
-
except JSONDecodeError:
|
|
959
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
960
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|