label-studio-sdk 1.0.7__py3-none-any.whl → 1.0.10__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 +26 -7
- label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +13 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +86 -0
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/_legacy/schema/label_config_schema.json +42 -11
- label_studio_sdk/actions/client.py +91 -40
- label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +278 -104
- label_studio_sdk/annotations/types/__init__.py +2 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
- label_studio_sdk/base_client.py +46 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +66 -18
- label_studio_sdk/converter/imports/yolo.py +1 -1
- label_studio_sdk/converter/utils.py +3 -2
- label_studio_sdk/core/__init__.py +21 -4
- label_studio_sdk/core/client_wrapper.py +9 -10
- label_studio_sdk/core/file.py +37 -8
- label_studio_sdk/core/http_client.py +52 -28
- label_studio_sdk/core/jsonable_encoder.py +33 -31
- label_studio_sdk/core/pagination.py +5 -4
- label_studio_sdk/core/pydantic_utilities.py +272 -4
- label_studio_sdk/core/query_encoder.py +38 -13
- label_studio_sdk/core/request_options.py +3 -0
- label_studio_sdk/core/serialization.py +272 -0
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/export_storage/azure/client.py +228 -58
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
- label_studio_sdk/export_storage/client.py +48 -18
- label_studio_sdk/export_storage/gcs/client.py +228 -58
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
- label_studio_sdk/export_storage/local/client.py +222 -56
- label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/export_storage/redis/client.py +228 -58
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/export_storage/s3/client.py +228 -58
- label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
- label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
- label_studio_sdk/export_storage/s3s/client.py +187 -43
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
- label_studio_sdk/files/client.py +172 -56
- label_studio_sdk/import_storage/azure/client.py +223 -53
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
- label_studio_sdk/import_storage/client.py +48 -18
- label_studio_sdk/import_storage/gcs/client.py +223 -53
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
- label_studio_sdk/import_storage/local/client.py +223 -53
- label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/import_storage/redis/client.py +223 -53
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/import_storage/s3/client.py +223 -53
- label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
- label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
- label_studio_sdk/import_storage/s3s/client.py +222 -52
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
- label_studio_sdk/label_interface/control_tags.py +205 -10
- label_studio_sdk/label_interface/interface.py +80 -6
- label_studio_sdk/label_interface/region.py +1 -10
- label_studio_sdk/ml/client.py +280 -78
- label_studio_sdk/ml/types/ml_create_response.py +21 -31
- label_studio_sdk/ml/types/ml_update_response.py +21 -31
- label_studio_sdk/model_providers/client.py +656 -21
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +3 -0
- label_studio_sdk/projects/client.py +309 -115
- label_studio_sdk/projects/client_ext.py +16 -0
- label_studio_sdk/projects/exports/__init__.py +3 -0
- label_studio_sdk/projects/exports/client.py +447 -296
- label_studio_sdk/projects/exports/client_ext.py +134 -0
- label_studio_sdk/projects/exports/types/__init__.py +6 -0
- label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
- label_studio_sdk/projects/types/projects_create_response.py +29 -34
- label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
- label_studio_sdk/projects/types/projects_list_response.py +11 -21
- label_studio_sdk/projects/types/projects_update_response.py +24 -34
- label_studio_sdk/prompts/client.py +309 -92
- label_studio_sdk/prompts/indicators/client.py +67 -23
- label_studio_sdk/prompts/runs/client.py +95 -40
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
- label_studio_sdk/prompts/versions/client.py +389 -75
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- label_studio_sdk/types/__init__.py +16 -6
- label_studio_sdk/types/annotation.py +29 -38
- label_studio_sdk/types/annotation_filter_options.py +14 -24
- label_studio_sdk/types/annotations_dm_field.py +30 -39
- label_studio_sdk/types/azure_blob_export_storage.py +28 -37
- label_studio_sdk/types/azure_blob_import_storage.py +28 -37
- label_studio_sdk/types/base_task.py +30 -39
- label_studio_sdk/types/base_task_updated_by.py +3 -1
- label_studio_sdk/types/base_user.py +14 -21
- label_studio_sdk/types/comment.py +12 -21
- label_studio_sdk/types/comment_created_by.py +1 -1
- label_studio_sdk/types/converted_format.py +12 -22
- label_studio_sdk/types/data_manager_task_serializer.py +31 -40
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
- label_studio_sdk/types/export.py +17 -26
- label_studio_sdk/types/export_format.py +25 -0
- label_studio_sdk/types/export_snapshot.py +45 -0
- label_studio_sdk/types/export_snapshot_status.py +5 -0
- label_studio_sdk/types/file_upload.py +11 -21
- label_studio_sdk/types/filter.py +16 -26
- label_studio_sdk/types/filter_group.py +12 -22
- label_studio_sdk/types/gcs_export_storage.py +28 -37
- label_studio_sdk/types/gcs_import_storage.py +28 -37
- label_studio_sdk/types/inference_run.py +14 -23
- label_studio_sdk/types/inference_run_cost_estimate.py +47 -0
- label_studio_sdk/types/inference_run_created_by.py +1 -1
- label_studio_sdk/types/inference_run_organization.py +1 -1
- label_studio_sdk/types/key_indicator_value.py +12 -22
- label_studio_sdk/types/key_indicators.py +0 -1
- label_studio_sdk/types/key_indicators_item.py +15 -25
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
- label_studio_sdk/types/local_files_export_storage.py +25 -34
- label_studio_sdk/types/local_files_import_storage.py +24 -33
- label_studio_sdk/types/ml_backend.py +23 -32
- label_studio_sdk/types/model_provider_connection.py +47 -26
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +5 -0
- label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
- label_studio_sdk/types/model_provider_connection_organization.py +1 -1
- label_studio_sdk/types/model_provider_connection_provider.py +3 -1
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +48 -55
- label_studio_sdk/types/project_import.py +21 -30
- label_studio_sdk/types/project_label_config.py +12 -22
- label_studio_sdk/types/prompt.py +24 -32
- label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
- label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
- label_studio_sdk/types/prompt_created_by.py +1 -1
- label_studio_sdk/types/prompt_organization.py +1 -1
- label_studio_sdk/types/prompt_version.py +13 -22
- label_studio_sdk/types/prompt_version_created_by.py +1 -1
- label_studio_sdk/types/prompt_version_organization.py +1 -1
- label_studio_sdk/types/prompt_version_provider.py +3 -1
- label_studio_sdk/types/redis_export_storage.py +29 -38
- label_studio_sdk/types/redis_import_storage.py +28 -37
- label_studio_sdk/types/refined_prompt_response.py +19 -29
- label_studio_sdk/types/s3export_storage.py +36 -43
- label_studio_sdk/types/s3import_storage.py +37 -44
- label_studio_sdk/types/s3s_export_storage.py +26 -33
- label_studio_sdk/types/s3s_import_storage.py +35 -42
- label_studio_sdk/types/serialization_option.py +12 -22
- label_studio_sdk/types/serialization_options.py +18 -28
- label_studio_sdk/types/task.py +46 -48
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +5 -0
- label_studio_sdk/types/task_filter_options.py +15 -25
- label_studio_sdk/types/user_simple.py +11 -21
- label_studio_sdk/types/view.py +16 -26
- label_studio_sdk/types/webhook.py +19 -28
- label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
- label_studio_sdk/types/workspace.py +22 -31
- label_studio_sdk/users/client.py +257 -63
- label_studio_sdk/users/types/users_get_token_response.py +12 -22
- label_studio_sdk/users/types/users_reset_token_response.py +12 -22
- label_studio_sdk/version.py +0 -1
- label_studio_sdk/versions/__init__.py +5 -0
- label_studio_sdk/versions/client.py +112 -0
- label_studio_sdk/versions/types/__init__.py +6 -0
- label_studio_sdk/versions/types/versions_get_response.py +73 -0
- label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
- label_studio_sdk/views/client.py +219 -52
- label_studio_sdk/views/types/views_create_request_data.py +13 -23
- label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/views/types/views_update_request_data.py +13 -23
- label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/webhooks/client.py +191 -61
- label_studio_sdk/workspaces/client.py +164 -41
- label_studio_sdk/workspaces/members/client.py +109 -31
- label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +9 -5
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +203 -186
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
- label_studio_sdk/types/export_convert.py +0 -32
- label_studio_sdk/types/export_create.py +0 -54
- label_studio_sdk/types/export_create_status.py +0 -5
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import time
|
|
3
|
+
import asyncio
|
|
4
|
+
import typing
|
|
5
|
+
import pandas as pd
|
|
6
|
+
from .client import ExportsClient, AsyncExportsClient
|
|
7
|
+
from io import BytesIO
|
|
8
|
+
from label_studio_sdk.versions.client import VersionsClient, AsyncVersionsClient
|
|
9
|
+
from label_studio_sdk.core.api_error import ApiError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExportTimeoutError(ApiError):
|
|
13
|
+
|
|
14
|
+
def __init__(self, export_snapshot):
|
|
15
|
+
super().__init__(
|
|
16
|
+
status_code=500,
|
|
17
|
+
body=(
|
|
18
|
+
f"Export job timed out after {timeout} seconds: "
|
|
19
|
+
f"unable to retrieve export job {export_snapshot.id}. "
|
|
20
|
+
f"Current status: {export_snapshot.status}. "
|
|
21
|
+
f"Try manually checking the running job with "
|
|
22
|
+
f"`ls.projects.exports.get(project_id={project_id}, export_pk={export_snapshot.id})`."
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _bytestream_to_fileobj(bytestream: typing.Iterable[bytes]) -> typing.BinaryIO:
|
|
28
|
+
buffer = BytesIO()
|
|
29
|
+
for chunk in bytestream:
|
|
30
|
+
buffer.write(chunk)
|
|
31
|
+
buffer.seek(0)
|
|
32
|
+
return buffer
|
|
33
|
+
|
|
34
|
+
def _bytestream_to_binary(bytestream: typing.Iterable[bytes]) -> bytes:
|
|
35
|
+
fileobj = _bytestream_to_fileobj(bytestream)
|
|
36
|
+
return fileobj.getvalue()
|
|
37
|
+
|
|
38
|
+
def _bytestream_to_json(bytestream: typing.Iterable[bytes]) -> dict:
|
|
39
|
+
fileobj = _bytestream_to_fileobj(bytestream)
|
|
40
|
+
return json.load(fileobj)
|
|
41
|
+
|
|
42
|
+
def _bytestream_to_pandas(bytestream: typing.Iterable[bytes]) -> pd.DataFrame:
|
|
43
|
+
fileobj = _bytestream_to_fileobj(bytestream)
|
|
44
|
+
return pd.read_csv(fileobj)
|
|
45
|
+
|
|
46
|
+
class ExportsClientExt(ExportsClient):
|
|
47
|
+
|
|
48
|
+
def _get_bytestream(
|
|
49
|
+
self,
|
|
50
|
+
project_id: int,
|
|
51
|
+
export_type: str,
|
|
52
|
+
timeout: int = 60,
|
|
53
|
+
create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
54
|
+
convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
55
|
+
download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
56
|
+
):
|
|
57
|
+
version = VersionsClient(client_wrapper=self._client_wrapper).get()
|
|
58
|
+
|
|
59
|
+
if version.edition == "Enterprise":
|
|
60
|
+
# Enterprise edition exports are async, so we need to wait for the export job to complete
|
|
61
|
+
export_snapshot = self.create(project_id, **(create_kwargs or {}))
|
|
62
|
+
if export_type != "JSON":
|
|
63
|
+
self.convert(project_id, export_pk=export_snapshot.id, export_type=export_type, **(convert_kwargs or {}))
|
|
64
|
+
start_time = time.time()
|
|
65
|
+
while export_snapshot.status != "completed":
|
|
66
|
+
export_snapshot = self.get(project_id, export_pk=export_snapshot.id)
|
|
67
|
+
if time.time() - start_time > timeout:
|
|
68
|
+
raise ExportTimeoutError(export_snapshot)
|
|
69
|
+
time.sleep(1)
|
|
70
|
+
bytestream = self.download(project_id, export_pk=export_snapshot.id, export_type=export_type, request_options={'chunk_size': 1024}, **(download_kwargs or {}))
|
|
71
|
+
else:
|
|
72
|
+
# Community edition exports are sync, so we can download the file immediately
|
|
73
|
+
bytestream = self.download_sync(project_id, export_type=export_type, download_all_tasks=True, download_resources=True)
|
|
74
|
+
return bytestream
|
|
75
|
+
|
|
76
|
+
def as_file(self, project_id: int, export_type: str = "JSON", timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
77
|
+
bytestream = self._get_bytestream(project_id, export_type, timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
78
|
+
return _bytestream_to_fileobj(bytestream)
|
|
79
|
+
|
|
80
|
+
def as_binary(self, project_id: int, export_type: str = "JSON", timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
81
|
+
bytestream = self._get_bytestream(project_id, export_type, timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
82
|
+
return _bytestream_to_binary(bytestream)
|
|
83
|
+
|
|
84
|
+
def as_json(self, project_id: int, timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
85
|
+
bytestream = self._get_bytestream(project_id, "JSON", timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
86
|
+
return _bytestream_to_json(bytestream)
|
|
87
|
+
|
|
88
|
+
def as_pandas(self, project_id: int, timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
89
|
+
bytestream = self._get_bytestream(project_id, "CSV", timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
90
|
+
return _bytestream_to_pandas(bytestream)
|
|
91
|
+
|
|
92
|
+
class AsyncExportsClientExt(AsyncExportsClient):
|
|
93
|
+
|
|
94
|
+
async def _get_bytestream(
|
|
95
|
+
self,
|
|
96
|
+
project_id: int,
|
|
97
|
+
export_type: str,
|
|
98
|
+
timeout: int = 60,
|
|
99
|
+
create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
100
|
+
convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
101
|
+
download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
102
|
+
):
|
|
103
|
+
version = await AsyncVersionsClient(client_wrapper=self._client_wrapper).get()
|
|
104
|
+
if version.edition == "Enterprise":
|
|
105
|
+
# Enterprise edition exports are async, so we need to wait for the export job to complete
|
|
106
|
+
export_snapshot = await self.create(project_id, **(create_kwargs or {}))
|
|
107
|
+
if export_type != "JSON":
|
|
108
|
+
await self.convert(project_id, export_pk=export_snapshot.id, export_type=export_type, **(convert_kwargs or {}))
|
|
109
|
+
start_time = time.time()
|
|
110
|
+
while export_snapshot.status != "completed":
|
|
111
|
+
export_snapshot = await self.get(project_id, export_pk=export_snapshot.id)
|
|
112
|
+
if time.time() - start_time > timeout:
|
|
113
|
+
raise ExportTimeoutError(export_snapshot)
|
|
114
|
+
await asyncio.sleep(1)
|
|
115
|
+
bytestream = await self.download(project_id, export_pk=export_snapshot.id, export_type=export_type, request_options={'chunk_size': 1024}, **(download_kwargs or {}))
|
|
116
|
+
else:
|
|
117
|
+
bytestream = await self.download_sync(project_id, export_type=export_type, download_all_tasks=True, download_resources=True)
|
|
118
|
+
return bytestream
|
|
119
|
+
|
|
120
|
+
async def as_file(self, project_id: int, export_type: str = "JSON", timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
121
|
+
bytestream = await self._get_bytestream(project_id, export_type, timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
122
|
+
return _bytestream_to_fileobj(bytestream)
|
|
123
|
+
|
|
124
|
+
async def as_binary(self, project_id: int, export_type: str = "JSON", timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
125
|
+
bytestream = await self._get_bytestream(project_id, export_type, timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
126
|
+
return _bytestream_to_binary(bytestream)
|
|
127
|
+
|
|
128
|
+
async def as_json(self, project_id: int, timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
129
|
+
bytestream = await self._get_bytestream(project_id, "JSON", timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
130
|
+
return _bytestream_to_json(bytestream)
|
|
131
|
+
|
|
132
|
+
async def as_pandas(self, project_id: int, timeout: int = 60, create_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, convert_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None, download_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None):
|
|
133
|
+
bytestream = await self._get_bytestream(project_id, "CSV", timeout, create_kwargs, convert_kwargs, download_kwargs)
|
|
134
|
+
return _bytestream_to_pandas(bytestream)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .exports_convert_response import ExportsConvertResponse
|
|
4
|
+
from .exports_list_formats_response_item import ExportsListFormatsResponseItem
|
|
5
|
+
|
|
6
|
+
__all__ = ["ExportsConvertResponse", "ExportsListFormatsResponseItem"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ....core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from ....types.export_format import ExportFormat
|
|
6
|
+
import pydantic
|
|
7
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ExportsConvertResponse(UniversalBaseModel):
|
|
11
|
+
export_type: typing.Optional[ExportFormat] = None
|
|
12
|
+
converted_format: typing.Optional[int] = pydantic.Field(default=None)
|
|
13
|
+
"""
|
|
14
|
+
ID of the converted format
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
if IS_PYDANTIC_V2:
|
|
18
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
19
|
+
else:
|
|
20
|
+
|
|
21
|
+
class Config:
|
|
22
|
+
frozen = True
|
|
23
|
+
smart_union = True
|
|
24
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ....core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from ....types.export_format import ExportFormat
|
|
6
|
+
import pydantic
|
|
7
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ExportsListFormatsResponseItem(UniversalBaseModel):
|
|
11
|
+
name: typing.Optional[ExportFormat] = None
|
|
12
|
+
title: typing.Optional[str] = pydantic.Field(default=None)
|
|
13
|
+
"""
|
|
14
|
+
Export format title
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
description: typing.Optional[str] = pydantic.Field(default=None)
|
|
18
|
+
"""
|
|
19
|
+
Export format description
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
link: typing.Optional[str] = pydantic.Field(default=None)
|
|
23
|
+
"""
|
|
24
|
+
Export format documentation link
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
28
|
+
"""
|
|
29
|
+
Export format tags
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
disabled: typing.Optional[bool] = pydantic.Field(default=None)
|
|
33
|
+
"""
|
|
34
|
+
If true, the export format is not supported by the project.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
if IS_PYDANTIC_V2:
|
|
38
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
39
|
+
else:
|
|
40
|
+
|
|
41
|
+
class Config:
|
|
42
|
+
frozen = True
|
|
43
|
+
smart_union = True
|
|
44
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,96 +1,91 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
class ProjectsCreateResponse(pydantic_v1.BaseModel):
|
|
9
|
+
class ProjectsCreateResponse(UniversalBaseModel):
|
|
11
10
|
"""
|
|
12
11
|
Project
|
|
13
12
|
"""
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
id: typing.Optional[int] = pydantic.Field(default=None)
|
|
15
|
+
"""
|
|
16
|
+
Project ID
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
title: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
20
|
"""
|
|
17
21
|
Project title
|
|
18
22
|
"""
|
|
19
23
|
|
|
20
|
-
description: typing.Optional[str] =
|
|
24
|
+
description: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
25
|
"""
|
|
22
26
|
Project description
|
|
23
27
|
"""
|
|
24
28
|
|
|
25
|
-
label_config: typing.Optional[str] =
|
|
29
|
+
label_config: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
30
|
"""
|
|
27
31
|
Label config in XML format
|
|
28
32
|
"""
|
|
29
33
|
|
|
30
|
-
expert_instruction: typing.Optional[str] =
|
|
34
|
+
expert_instruction: typing.Optional[str] = pydantic.Field(default=None)
|
|
31
35
|
"""
|
|
32
36
|
Labeling instructions to show to the user
|
|
33
37
|
"""
|
|
34
38
|
|
|
35
|
-
show_instruction: typing.Optional[bool] =
|
|
39
|
+
show_instruction: typing.Optional[bool] = pydantic.Field(default=None)
|
|
36
40
|
"""
|
|
37
41
|
Show labeling instructions
|
|
38
42
|
"""
|
|
39
43
|
|
|
40
|
-
show_skip_button: typing.Optional[bool] =
|
|
44
|
+
show_skip_button: typing.Optional[bool] = pydantic.Field(default=None)
|
|
41
45
|
"""
|
|
42
46
|
Show skip button
|
|
43
47
|
"""
|
|
44
48
|
|
|
45
|
-
enable_empty_annotation: typing.Optional[bool] =
|
|
49
|
+
enable_empty_annotation: typing.Optional[bool] = pydantic.Field(default=None)
|
|
46
50
|
"""
|
|
47
51
|
Allow empty annotations
|
|
48
52
|
"""
|
|
49
53
|
|
|
50
|
-
show_annotation_history: typing.Optional[bool] =
|
|
54
|
+
show_annotation_history: typing.Optional[bool] = pydantic.Field(default=None)
|
|
51
55
|
"""
|
|
52
56
|
Show annotation history
|
|
53
57
|
"""
|
|
54
58
|
|
|
55
|
-
reveal_preannotations_interactively: typing.Optional[bool] =
|
|
59
|
+
reveal_preannotations_interactively: typing.Optional[bool] = pydantic.Field(default=None)
|
|
56
60
|
"""
|
|
57
61
|
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
58
62
|
"""
|
|
59
63
|
|
|
60
|
-
show_collab_predictions: typing.Optional[bool] =
|
|
64
|
+
show_collab_predictions: typing.Optional[bool] = pydantic.Field(default=None)
|
|
61
65
|
"""
|
|
62
66
|
Show predictions to annotators
|
|
63
67
|
"""
|
|
64
68
|
|
|
65
|
-
maximum_annotations: typing.Optional[int] =
|
|
69
|
+
maximum_annotations: typing.Optional[int] = pydantic.Field(default=None)
|
|
66
70
|
"""
|
|
67
71
|
Maximum annotations per task
|
|
68
72
|
"""
|
|
69
73
|
|
|
70
|
-
color: typing.Optional[str] =
|
|
74
|
+
color: typing.Optional[str] = pydantic.Field(default=None)
|
|
71
75
|
"""
|
|
72
76
|
Project color in HEX format
|
|
73
77
|
"""
|
|
74
78
|
|
|
75
|
-
control_weights: typing.Optional[typing.Dict[str, typing.Any]] =
|
|
79
|
+
control_weights: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
76
80
|
"""
|
|
77
81
|
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
82
|
"""
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
)
|
|
84
|
+
if IS_PYDANTIC_V2:
|
|
85
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
86
|
+
else:
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
88
|
+
class Config:
|
|
89
|
+
frozen = True
|
|
90
|
+
smart_union = True
|
|
91
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,71 +1,61 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
class ProjectsImportTasksResponse(pydantic_v1.BaseModel):
|
|
9
|
+
class ProjectsImportTasksResponse(UniversalBaseModel):
|
|
11
10
|
"""
|
|
12
11
|
Task creation response
|
|
13
12
|
"""
|
|
14
13
|
|
|
15
|
-
task_count: typing.Optional[int] =
|
|
14
|
+
task_count: typing.Optional[int] = pydantic.Field(default=None)
|
|
16
15
|
"""
|
|
17
16
|
Number of tasks added
|
|
18
17
|
"""
|
|
19
18
|
|
|
20
|
-
annotation_count: typing.Optional[int] =
|
|
19
|
+
annotation_count: typing.Optional[int] = pydantic.Field(default=None)
|
|
21
20
|
"""
|
|
22
21
|
Number of annotations added
|
|
23
22
|
"""
|
|
24
23
|
|
|
25
|
-
predictions_count: typing.Optional[int] =
|
|
24
|
+
predictions_count: typing.Optional[int] = pydantic.Field(default=None)
|
|
26
25
|
"""
|
|
27
26
|
Number of predictions added
|
|
28
27
|
"""
|
|
29
28
|
|
|
30
|
-
duration: typing.Optional[float] =
|
|
29
|
+
duration: typing.Optional[float] = pydantic.Field(default=None)
|
|
31
30
|
"""
|
|
32
31
|
Time in seconds to create
|
|
33
32
|
"""
|
|
34
33
|
|
|
35
|
-
file_upload_ids: typing.Optional[typing.List[int]] =
|
|
34
|
+
file_upload_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
|
|
36
35
|
"""
|
|
37
36
|
Database IDs of uploaded files
|
|
38
37
|
"""
|
|
39
38
|
|
|
40
|
-
could_be_tasks_list: typing.Optional[bool] =
|
|
39
|
+
could_be_tasks_list: typing.Optional[bool] = pydantic.Field(default=None)
|
|
41
40
|
"""
|
|
42
41
|
Whether uploaded files can contain lists of tasks, like CSV/TSV files
|
|
43
42
|
"""
|
|
44
43
|
|
|
45
|
-
found_formats: typing.Optional[typing.List[str]] =
|
|
44
|
+
found_formats: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
46
45
|
"""
|
|
47
46
|
The list of found file formats
|
|
48
47
|
"""
|
|
49
48
|
|
|
50
|
-
data_columns: typing.Optional[typing.List[str]] =
|
|
49
|
+
data_columns: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
51
50
|
"""
|
|
52
51
|
The list of found data columns
|
|
53
52
|
"""
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
60
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
61
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
62
|
-
|
|
63
|
-
return deep_union_pydantic_dicts(
|
|
64
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
65
|
-
)
|
|
54
|
+
if IS_PYDANTIC_V2:
|
|
55
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
56
|
+
else:
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
58
|
+
class Config:
|
|
59
|
+
frozen = True
|
|
60
|
+
smart_union = True
|
|
61
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
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
5
|
from ...types.project import Project
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import pydantic
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
class ProjectsListResponse(
|
|
10
|
+
class ProjectsListResponse(UniversalBaseModel):
|
|
12
11
|
count: int
|
|
13
12
|
next: typing.Optional[str] = None
|
|
14
13
|
previous: typing.Optional[str] = None
|
|
15
14
|
results: typing.List[Project]
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
22
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
23
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
24
|
-
|
|
25
|
-
return deep_union_pydantic_dicts(
|
|
26
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
27
|
-
)
|
|
16
|
+
if IS_PYDANTIC_V2:
|
|
17
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
18
|
+
else:
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
20
|
+
class Config:
|
|
21
|
+
frozen = True
|
|
22
|
+
smart_union = True
|
|
23
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,96 +1,86 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
class ProjectsUpdateResponse(pydantic_v1.BaseModel):
|
|
9
|
+
class ProjectsUpdateResponse(UniversalBaseModel):
|
|
11
10
|
"""
|
|
12
11
|
Project
|
|
13
12
|
"""
|
|
14
13
|
|
|
15
|
-
title: typing.Optional[str] =
|
|
14
|
+
title: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
15
|
"""
|
|
17
16
|
Project title
|
|
18
17
|
"""
|
|
19
18
|
|
|
20
|
-
description: typing.Optional[str] =
|
|
19
|
+
description: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
20
|
"""
|
|
22
21
|
Project description
|
|
23
22
|
"""
|
|
24
23
|
|
|
25
|
-
label_config: typing.Optional[str] =
|
|
24
|
+
label_config: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
25
|
"""
|
|
27
26
|
Label config in XML format
|
|
28
27
|
"""
|
|
29
28
|
|
|
30
|
-
expert_instruction: typing.Optional[str] =
|
|
29
|
+
expert_instruction: typing.Optional[str] = pydantic.Field(default=None)
|
|
31
30
|
"""
|
|
32
31
|
Labeling instructions to show to the user
|
|
33
32
|
"""
|
|
34
33
|
|
|
35
|
-
show_instruction: typing.Optional[bool] =
|
|
34
|
+
show_instruction: typing.Optional[bool] = pydantic.Field(default=None)
|
|
36
35
|
"""
|
|
37
36
|
Show labeling instructions
|
|
38
37
|
"""
|
|
39
38
|
|
|
40
|
-
show_skip_button: typing.Optional[bool] =
|
|
39
|
+
show_skip_button: typing.Optional[bool] = pydantic.Field(default=None)
|
|
41
40
|
"""
|
|
42
41
|
Show skip button
|
|
43
42
|
"""
|
|
44
43
|
|
|
45
|
-
enable_empty_annotation: typing.Optional[bool] =
|
|
44
|
+
enable_empty_annotation: typing.Optional[bool] = pydantic.Field(default=None)
|
|
46
45
|
"""
|
|
47
46
|
Allow empty annotations
|
|
48
47
|
"""
|
|
49
48
|
|
|
50
|
-
show_annotation_history: typing.Optional[bool] =
|
|
49
|
+
show_annotation_history: typing.Optional[bool] = pydantic.Field(default=None)
|
|
51
50
|
"""
|
|
52
51
|
Show annotation history
|
|
53
52
|
"""
|
|
54
53
|
|
|
55
|
-
reveal_preannotations_interactively: typing.Optional[bool] =
|
|
54
|
+
reveal_preannotations_interactively: typing.Optional[bool] = pydantic.Field(default=None)
|
|
56
55
|
"""
|
|
57
56
|
Reveal preannotations interactively. If set to True, predictions will be shown to the user only after selecting the area of interest
|
|
58
57
|
"""
|
|
59
58
|
|
|
60
|
-
show_collab_predictions: typing.Optional[bool] =
|
|
59
|
+
show_collab_predictions: typing.Optional[bool] = pydantic.Field(default=None)
|
|
61
60
|
"""
|
|
62
61
|
Show predictions to annotators
|
|
63
62
|
"""
|
|
64
63
|
|
|
65
|
-
maximum_annotations: typing.Optional[int] =
|
|
64
|
+
maximum_annotations: typing.Optional[int] = pydantic.Field(default=None)
|
|
66
65
|
"""
|
|
67
66
|
Maximum annotations per task
|
|
68
67
|
"""
|
|
69
68
|
|
|
70
|
-
color: typing.Optional[str] =
|
|
69
|
+
color: typing.Optional[str] = pydantic.Field(default=None)
|
|
71
70
|
"""
|
|
72
71
|
Project color in HEX format
|
|
73
72
|
"""
|
|
74
73
|
|
|
75
|
-
control_weights: typing.Optional[typing.Dict[str, typing.Any]] =
|
|
74
|
+
control_weights: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
76
75
|
"""
|
|
77
76
|
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
77
|
"""
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
)
|
|
79
|
+
if IS_PYDANTIC_V2:
|
|
80
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
81
|
+
else:
|
|
91
82
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
83
|
+
class Config:
|
|
84
|
+
frozen = True
|
|
85
|
+
smart_union = True
|
|
86
|
+
extra = pydantic.Extra.allow
|