rapidata 2.27.3__py3-none-any.whl → 2.27.4__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 rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +1 -1
- rapidata/api_client/__init__.py +10 -2
- rapidata/api_client/api/campaign_api.py +247 -0
- rapidata/api_client/api/datapoint_api.py +0 -267
- rapidata/api_client/api/dataset_api.py +24 -6
- rapidata/api_client/api/validation_set_api.py +431 -2
- rapidata/api_client/models/__init__.py +10 -2
- rapidata/api_client/models/ab_test_selection_a_inner.py +26 -12
- rapidata/api_client/models/boost_query_result.py +100 -0
- rapidata/api_client/models/boost_status.py +39 -0
- rapidata/api_client/models/compare_workflow_config_metadata_value.py +38 -10
- rapidata/api_client/models/datapoint_model_paged_result.py +105 -0
- rapidata/api_client/models/effort_capped_selection.py +115 -0
- rapidata/api_client/models/file_asset_model_metadata_value.py +39 -11
- rapidata/api_client/models/get_validation_rapids_result.py +3 -3
- rapidata/api_client/models/get_workflow_results_result.py +3 -3
- rapidata/api_client/models/rapid_model.py +3 -3
- rapidata/api_client/models/streams_metadata.py +102 -0
- rapidata/api_client/models/streams_metadata_model.py +100 -0
- rapidata/api_client/models/validation_set_validation_set_id_rapid_post_payload_parameter.py +252 -0
- rapidata/api_client/models/validation_set_validation_set_id_rapid_post_truth_parameter.py +280 -0
- rapidata/api_client/models/video_duration_metadata.py +98 -0
- rapidata/api_client/models/video_duration_metadata_model.py +96 -0
- rapidata/api_client_README.md +17 -7
- {rapidata-2.27.3.dist-info → rapidata-2.27.4.dist-info}/METADATA +2 -2
- {rapidata-2.27.3.dist-info → rapidata-2.27.4.dist-info}/RECORD +28 -18
- {rapidata-2.27.3.dist-info → rapidata-2.27.4.dist-info}/LICENSE +0 -0
- {rapidata-2.27.3.dist-info → rapidata-2.27.4.dist-info}/WHEEL +0 -0
|
@@ -26,14 +26,16 @@ from rapidata.api_client.models.location_metadata_model import LocationMetadataM
|
|
|
26
26
|
from rapidata.api_client.models.original_filename_metadata_model import OriginalFilenameMetadataModel
|
|
27
27
|
from rapidata.api_client.models.prompt_metadata_model import PromptMetadataModel
|
|
28
28
|
from rapidata.api_client.models.source_url_metadata_model import SourceUrlMetadataModel
|
|
29
|
+
from rapidata.api_client.models.streams_metadata_model import StreamsMetadataModel
|
|
29
30
|
from rapidata.api_client.models.text_metadata_model import TextMetadataModel
|
|
30
31
|
from rapidata.api_client.models.transcription_metadata_model import TranscriptionMetadataModel
|
|
31
32
|
from rapidata.api_client.models.translated_prompt_metadata_model import TranslatedPromptMetadataModel
|
|
33
|
+
from rapidata.api_client.models.video_duration_metadata_model import VideoDurationMetadataModel
|
|
32
34
|
from pydantic import StrictStr, Field
|
|
33
35
|
from typing import Union, List, Set, Optional, Dict
|
|
34
36
|
from typing_extensions import Literal, Self
|
|
35
37
|
|
|
36
|
-
FILEASSETMODELMETADATAVALUE_ONE_OF_SCHEMAS = ["AssetMetadataModel", "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel"]
|
|
38
|
+
FILEASSETMODELMETADATAVALUE_ONE_OF_SCHEMAS = ["AssetMetadataModel", "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "StreamsMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel", "VideoDurationMetadataModel"]
|
|
37
39
|
|
|
38
40
|
class FileAssetModelMetadataValue(BaseModel):
|
|
39
41
|
"""
|
|
@@ -57,14 +59,18 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
57
59
|
oneof_schema_8_validator: Optional[PromptMetadataModel] = None
|
|
58
60
|
# data type: SourceUrlMetadataModel
|
|
59
61
|
oneof_schema_9_validator: Optional[SourceUrlMetadataModel] = None
|
|
62
|
+
# data type: StreamsMetadataModel
|
|
63
|
+
oneof_schema_10_validator: Optional[StreamsMetadataModel] = None
|
|
60
64
|
# data type: TextMetadataModel
|
|
61
|
-
|
|
65
|
+
oneof_schema_11_validator: Optional[TextMetadataModel] = None
|
|
62
66
|
# data type: TranscriptionMetadataModel
|
|
63
|
-
|
|
67
|
+
oneof_schema_12_validator: Optional[TranscriptionMetadataModel] = None
|
|
64
68
|
# data type: TranslatedPromptMetadataModel
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
oneof_schema_13_validator: Optional[TranslatedPromptMetadataModel] = None
|
|
70
|
+
# data type: VideoDurationMetadataModel
|
|
71
|
+
oneof_schema_14_validator: Optional[VideoDurationMetadataModel] = None
|
|
72
|
+
actual_instance: Optional[Union[AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, StreamsMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel, VideoDurationMetadataModel]] = None
|
|
73
|
+
one_of_schemas: Set[str] = { "AssetMetadataModel", "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "StreamsMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel", "VideoDurationMetadataModel" }
|
|
68
74
|
|
|
69
75
|
model_config = ConfigDict(
|
|
70
76
|
validate_assignment=True,
|
|
@@ -135,6 +141,11 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
135
141
|
error_messages.append(f"Error! Input type `{type(v)}` is not `SourceUrlMetadataModel`")
|
|
136
142
|
else:
|
|
137
143
|
match += 1
|
|
144
|
+
# validate data type: StreamsMetadataModel
|
|
145
|
+
if not isinstance(v, StreamsMetadataModel):
|
|
146
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `StreamsMetadataModel`")
|
|
147
|
+
else:
|
|
148
|
+
match += 1
|
|
138
149
|
# validate data type: TextMetadataModel
|
|
139
150
|
if not isinstance(v, TextMetadataModel):
|
|
140
151
|
error_messages.append(f"Error! Input type `{type(v)}` is not `TextMetadataModel`")
|
|
@@ -150,12 +161,17 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
150
161
|
error_messages.append(f"Error! Input type `{type(v)}` is not `TranslatedPromptMetadataModel`")
|
|
151
162
|
else:
|
|
152
163
|
match += 1
|
|
164
|
+
# validate data type: VideoDurationMetadataModel
|
|
165
|
+
if not isinstance(v, VideoDurationMetadataModel):
|
|
166
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `VideoDurationMetadataModel`")
|
|
167
|
+
else:
|
|
168
|
+
match += 1
|
|
153
169
|
if match > 1:
|
|
154
170
|
# more than 1 match
|
|
155
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
171
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, StreamsMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel, VideoDurationMetadataModel. Details: " + ", ".join(error_messages))
|
|
156
172
|
elif match == 0:
|
|
157
173
|
# no match
|
|
158
|
-
raise ValueError("No match found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
174
|
+
raise ValueError("No match found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, StreamsMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel, VideoDurationMetadataModel. Details: " + ", ".join(error_messages))
|
|
159
175
|
else:
|
|
160
176
|
return v
|
|
161
177
|
|
|
@@ -224,6 +240,12 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
224
240
|
match += 1
|
|
225
241
|
except (ValidationError, ValueError) as e:
|
|
226
242
|
error_messages.append(str(e))
|
|
243
|
+
# deserialize data into StreamsMetadataModel
|
|
244
|
+
try:
|
|
245
|
+
instance.actual_instance = StreamsMetadataModel.from_json(json_str)
|
|
246
|
+
match += 1
|
|
247
|
+
except (ValidationError, ValueError) as e:
|
|
248
|
+
error_messages.append(str(e))
|
|
227
249
|
# deserialize data into TextMetadataModel
|
|
228
250
|
try:
|
|
229
251
|
instance.actual_instance = TextMetadataModel.from_json(json_str)
|
|
@@ -242,13 +264,19 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
242
264
|
match += 1
|
|
243
265
|
except (ValidationError, ValueError) as e:
|
|
244
266
|
error_messages.append(str(e))
|
|
267
|
+
# deserialize data into VideoDurationMetadataModel
|
|
268
|
+
try:
|
|
269
|
+
instance.actual_instance = VideoDurationMetadataModel.from_json(json_str)
|
|
270
|
+
match += 1
|
|
271
|
+
except (ValidationError, ValueError) as e:
|
|
272
|
+
error_messages.append(str(e))
|
|
245
273
|
|
|
246
274
|
if match > 1:
|
|
247
275
|
# more than 1 match
|
|
248
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
276
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, StreamsMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel, VideoDurationMetadataModel. Details: " + ", ".join(error_messages))
|
|
249
277
|
elif match == 0:
|
|
250
278
|
# no match
|
|
251
|
-
raise ValueError("No match found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
279
|
+
raise ValueError("No match found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, StreamsMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel, VideoDurationMetadataModel. Details: " + ", ".join(error_messages))
|
|
252
280
|
else:
|
|
253
281
|
return instance
|
|
254
282
|
|
|
@@ -262,7 +290,7 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
262
290
|
else:
|
|
263
291
|
return json.dumps(self.actual_instance)
|
|
264
292
|
|
|
265
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel]]:
|
|
293
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, StreamsMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel, VideoDurationMetadataModel]]:
|
|
266
294
|
"""Returns the dict representation of the actual instance"""
|
|
267
295
|
if self.actual_instance is None:
|
|
268
296
|
return None
|
|
@@ -21,8 +21,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, Stric
|
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
22
|
from rapidata.api_client.models.file_asset_model_metadata_value import FileAssetModelMetadataValue
|
|
23
23
|
from rapidata.api_client.models.get_validation_rapids_result_asset import GetValidationRapidsResultAsset
|
|
24
|
-
from rapidata.api_client.models.get_validation_rapids_result_payload import GetValidationRapidsResultPayload
|
|
25
24
|
from rapidata.api_client.models.get_validation_rapids_result_truth import GetValidationRapidsResultTruth
|
|
25
|
+
from rapidata.api_client.models.validation_set_validation_set_id_rapid_post_payload_parameter import ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
26
26
|
from typing import Optional, Set
|
|
27
27
|
from typing_extensions import Self
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@ class GetValidationRapidsResult(BaseModel):
|
|
|
34
34
|
type: StrictStr
|
|
35
35
|
asset: Optional[GetValidationRapidsResultAsset] = None
|
|
36
36
|
truth: Optional[GetValidationRapidsResultTruth] = None
|
|
37
|
-
payload:
|
|
37
|
+
payload: ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
38
38
|
metadata: Dict[str, FileAssetModelMetadataValue]
|
|
39
39
|
correct_validation_count: StrictInt = Field(alias="correctValidationCount")
|
|
40
40
|
invalid_validation_count: StrictInt = Field(alias="invalidValidationCount")
|
|
@@ -141,7 +141,7 @@ class GetValidationRapidsResult(BaseModel):
|
|
|
141
141
|
"type": obj.get("type"),
|
|
142
142
|
"asset": GetValidationRapidsResultAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
143
143
|
"truth": GetValidationRapidsResultTruth.from_dict(obj["truth"]) if obj.get("truth") is not None else None,
|
|
144
|
-
"payload":
|
|
144
|
+
"payload": ValidationSetValidationSetIdRapidPostPayloadParameter.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
145
145
|
"metadata": dict(
|
|
146
146
|
(_k, FileAssetModelMetadataValue.from_dict(_v))
|
|
147
147
|
for _k, _v in obj["metadata"].items()
|
|
@@ -20,8 +20,8 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
22
|
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
23
|
-
from rapidata.api_client.models.get_validation_rapids_result_payload import GetValidationRapidsResultPayload
|
|
24
23
|
from rapidata.api_client.models.rapid_response import RapidResponse
|
|
24
|
+
from rapidata.api_client.models.validation_set_validation_set_id_rapid_post_payload_parameter import ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
25
25
|
from typing import Optional, Set
|
|
26
26
|
from typing_extensions import Self
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ class GetWorkflowResultsResult(BaseModel):
|
|
|
30
30
|
GetWorkflowResultsResult
|
|
31
31
|
""" # noqa: E501
|
|
32
32
|
rapid_id: StrictStr = Field(alias="rapidId")
|
|
33
|
-
payload:
|
|
33
|
+
payload: ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
34
34
|
asset: DatapointAsset
|
|
35
35
|
responses: List[RapidResponse]
|
|
36
36
|
state: StrictStr
|
|
@@ -108,7 +108,7 @@ class GetWorkflowResultsResult(BaseModel):
|
|
|
108
108
|
|
|
109
109
|
_obj = cls.model_validate({
|
|
110
110
|
"rapidId": obj.get("rapidId"),
|
|
111
|
-
"payload":
|
|
111
|
+
"payload": ValidationSetValidationSetIdRapidPostPayloadParameter.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
112
112
|
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
113
113
|
"responses": [RapidResponse.from_dict(_item) for _item in obj["responses"]] if obj.get("responses") is not None else None,
|
|
114
114
|
"state": obj.get("state")
|
|
@@ -22,9 +22,9 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, Stri
|
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
23
|
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
24
24
|
from rapidata.api_client.models.file_asset_model_metadata_value import FileAssetModelMetadataValue
|
|
25
|
-
from rapidata.api_client.models.get_validation_rapids_result_payload import GetValidationRapidsResultPayload
|
|
26
25
|
from rapidata.api_client.models.get_validation_rapids_result_truth import GetValidationRapidsResultTruth
|
|
27
26
|
from rapidata.api_client.models.rapid_model_referee import RapidModelReferee
|
|
27
|
+
from rapidata.api_client.models.validation_set_validation_set_id_rapid_post_payload_parameter import ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
28
28
|
from typing import Optional, Set
|
|
29
29
|
from typing_extensions import Self
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@ class RapidModel(BaseModel):
|
|
|
33
33
|
RapidModel
|
|
34
34
|
""" # noqa: E501
|
|
35
35
|
id: StrictStr
|
|
36
|
-
payload:
|
|
36
|
+
payload: ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
37
37
|
referee: RapidModelReferee
|
|
38
38
|
asset: DatapointAsset
|
|
39
39
|
metadata: Dict[str, FileAssetModelMetadataValue]
|
|
@@ -150,7 +150,7 @@ class RapidModel(BaseModel):
|
|
|
150
150
|
|
|
151
151
|
_obj = cls.model_validate({
|
|
152
152
|
"id": obj.get("id"),
|
|
153
|
-
"payload":
|
|
153
|
+
"payload": ValidationSetValidationSetIdRapidPostPayloadParameter.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
154
154
|
"referee": RapidModelReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
155
155
|
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
156
156
|
"metadata": dict(
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class StreamsMetadata(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
StreamsMetadata
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for StreamsMetadata", alias="_t")
|
|
30
|
+
has_audio: Optional[StrictBool] = Field(default=None, alias="hasAudio")
|
|
31
|
+
has_video: Optional[StrictBool] = Field(default=None, alias="hasVideo")
|
|
32
|
+
has_subtitles: Optional[StrictBool] = Field(default=None, alias="hasSubtitles")
|
|
33
|
+
visibilities: Optional[StrictStr] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["_t", "hasAudio", "hasVideo", "hasSubtitles", "visibilities"]
|
|
35
|
+
|
|
36
|
+
@field_validator('t')
|
|
37
|
+
def t_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['StreamsMetadata']):
|
|
40
|
+
raise ValueError("must be one of enum values ('StreamsMetadata')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of StreamsMetadata from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of StreamsMetadata from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'StreamsMetadata',
|
|
95
|
+
"hasAudio": obj.get("hasAudio"),
|
|
96
|
+
"hasVideo": obj.get("hasVideo"),
|
|
97
|
+
"hasSubtitles": obj.get("hasSubtitles"),
|
|
98
|
+
"visibilities": obj.get("visibilities")
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class StreamsMetadataModel(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
StreamsMetadataModel
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for StreamsMetadata", alias="_t")
|
|
30
|
+
has_video: StrictBool = Field(alias="hasVideo")
|
|
31
|
+
has_audio: StrictBool = Field(alias="hasAudio")
|
|
32
|
+
has_subtitles: StrictBool = Field(alias="hasSubtitles")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["_t", "hasVideo", "hasAudio", "hasSubtitles"]
|
|
34
|
+
|
|
35
|
+
@field_validator('t')
|
|
36
|
+
def t_validate_enum(cls, value):
|
|
37
|
+
"""Validates the enum"""
|
|
38
|
+
if value not in set(['StreamsMetadata']):
|
|
39
|
+
raise ValueError("must be one of enum values ('StreamsMetadata')")
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of StreamsMetadataModel from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of StreamsMetadataModel from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'StreamsMetadata',
|
|
94
|
+
"hasVideo": obj.get("hasVideo"),
|
|
95
|
+
"hasAudio": obj.get("hasAudio"),
|
|
96
|
+
"hasSubtitles": obj.get("hasSubtitles")
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.bounding_box_payload import BoundingBoxPayload
|
|
21
|
+
from rapidata.api_client.models.classify_payload import ClassifyPayload
|
|
22
|
+
from rapidata.api_client.models.compare_payload import ComparePayload
|
|
23
|
+
from rapidata.api_client.models.free_text_payload import FreeTextPayload
|
|
24
|
+
from rapidata.api_client.models.line_payload import LinePayload
|
|
25
|
+
from rapidata.api_client.models.locate_payload import LocatePayload
|
|
26
|
+
from rapidata.api_client.models.named_entity_payload import NamedEntityPayload
|
|
27
|
+
from rapidata.api_client.models.polygon_payload import PolygonPayload
|
|
28
|
+
from rapidata.api_client.models.scrub_payload import ScrubPayload
|
|
29
|
+
from rapidata.api_client.models.transcription_payload import TranscriptionPayload
|
|
30
|
+
from pydantic import StrictStr, Field
|
|
31
|
+
from typing import Union, List, Set, Optional, Dict
|
|
32
|
+
from typing_extensions import Literal, Self
|
|
33
|
+
|
|
34
|
+
VALIDATIONSETVALIDATIONSETIDRAPIDPOSTPAYLOADPARAMETER_ONE_OF_SCHEMAS = ["BoundingBoxPayload", "ClassifyPayload", "ComparePayload", "FreeTextPayload", "LinePayload", "LocatePayload", "NamedEntityPayload", "PolygonPayload", "ScrubPayload", "TranscriptionPayload"]
|
|
35
|
+
|
|
36
|
+
class ValidationSetValidationSetIdRapidPostPayloadParameter(BaseModel):
|
|
37
|
+
"""
|
|
38
|
+
ValidationSetValidationSetIdRapidPostPayloadParameter
|
|
39
|
+
"""
|
|
40
|
+
# data type: TranscriptionPayload
|
|
41
|
+
oneof_schema_1_validator: Optional[TranscriptionPayload] = None
|
|
42
|
+
# data type: ScrubPayload
|
|
43
|
+
oneof_schema_2_validator: Optional[ScrubPayload] = None
|
|
44
|
+
# data type: PolygonPayload
|
|
45
|
+
oneof_schema_3_validator: Optional[PolygonPayload] = None
|
|
46
|
+
# data type: NamedEntityPayload
|
|
47
|
+
oneof_schema_4_validator: Optional[NamedEntityPayload] = None
|
|
48
|
+
# data type: LocatePayload
|
|
49
|
+
oneof_schema_5_validator: Optional[LocatePayload] = None
|
|
50
|
+
# data type: LinePayload
|
|
51
|
+
oneof_schema_6_validator: Optional[LinePayload] = None
|
|
52
|
+
# data type: FreeTextPayload
|
|
53
|
+
oneof_schema_7_validator: Optional[FreeTextPayload] = None
|
|
54
|
+
# data type: ComparePayload
|
|
55
|
+
oneof_schema_8_validator: Optional[ComparePayload] = None
|
|
56
|
+
# data type: ClassifyPayload
|
|
57
|
+
oneof_schema_9_validator: Optional[ClassifyPayload] = None
|
|
58
|
+
# data type: BoundingBoxPayload
|
|
59
|
+
oneof_schema_10_validator: Optional[BoundingBoxPayload] = None
|
|
60
|
+
actual_instance: Optional[Union[BoundingBoxPayload, ClassifyPayload, ComparePayload, FreeTextPayload, LinePayload, LocatePayload, NamedEntityPayload, PolygonPayload, ScrubPayload, TranscriptionPayload]] = None
|
|
61
|
+
one_of_schemas: Set[str] = { "BoundingBoxPayload", "ClassifyPayload", "ComparePayload", "FreeTextPayload", "LinePayload", "LocatePayload", "NamedEntityPayload", "PolygonPayload", "ScrubPayload", "TranscriptionPayload" }
|
|
62
|
+
|
|
63
|
+
model_config = ConfigDict(
|
|
64
|
+
validate_assignment=True,
|
|
65
|
+
protected_namespaces=(),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
73
|
+
if args:
|
|
74
|
+
if len(args) > 1:
|
|
75
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
76
|
+
if kwargs:
|
|
77
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
78
|
+
super().__init__(actual_instance=args[0])
|
|
79
|
+
else:
|
|
80
|
+
super().__init__(**kwargs)
|
|
81
|
+
|
|
82
|
+
@field_validator('actual_instance')
|
|
83
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
84
|
+
instance = ValidationSetValidationSetIdRapidPostPayloadParameter.model_construct()
|
|
85
|
+
error_messages = []
|
|
86
|
+
match = 0
|
|
87
|
+
# validate data type: TranscriptionPayload
|
|
88
|
+
if not isinstance(v, TranscriptionPayload):
|
|
89
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionPayload`")
|
|
90
|
+
else:
|
|
91
|
+
match += 1
|
|
92
|
+
# validate data type: ScrubPayload
|
|
93
|
+
if not isinstance(v, ScrubPayload):
|
|
94
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ScrubPayload`")
|
|
95
|
+
else:
|
|
96
|
+
match += 1
|
|
97
|
+
# validate data type: PolygonPayload
|
|
98
|
+
if not isinstance(v, PolygonPayload):
|
|
99
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonPayload`")
|
|
100
|
+
else:
|
|
101
|
+
match += 1
|
|
102
|
+
# validate data type: NamedEntityPayload
|
|
103
|
+
if not isinstance(v, NamedEntityPayload):
|
|
104
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NamedEntityPayload`")
|
|
105
|
+
else:
|
|
106
|
+
match += 1
|
|
107
|
+
# validate data type: LocatePayload
|
|
108
|
+
if not isinstance(v, LocatePayload):
|
|
109
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LocatePayload`")
|
|
110
|
+
else:
|
|
111
|
+
match += 1
|
|
112
|
+
# validate data type: LinePayload
|
|
113
|
+
if not isinstance(v, LinePayload):
|
|
114
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LinePayload`")
|
|
115
|
+
else:
|
|
116
|
+
match += 1
|
|
117
|
+
# validate data type: FreeTextPayload
|
|
118
|
+
if not isinstance(v, FreeTextPayload):
|
|
119
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FreeTextPayload`")
|
|
120
|
+
else:
|
|
121
|
+
match += 1
|
|
122
|
+
# validate data type: ComparePayload
|
|
123
|
+
if not isinstance(v, ComparePayload):
|
|
124
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ComparePayload`")
|
|
125
|
+
else:
|
|
126
|
+
match += 1
|
|
127
|
+
# validate data type: ClassifyPayload
|
|
128
|
+
if not isinstance(v, ClassifyPayload):
|
|
129
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ClassifyPayload`")
|
|
130
|
+
else:
|
|
131
|
+
match += 1
|
|
132
|
+
# validate data type: BoundingBoxPayload
|
|
133
|
+
if not isinstance(v, BoundingBoxPayload):
|
|
134
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxPayload`")
|
|
135
|
+
else:
|
|
136
|
+
match += 1
|
|
137
|
+
if match > 1:
|
|
138
|
+
# more than 1 match
|
|
139
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in ValidationSetValidationSetIdRapidPostPayloadParameter with oneOf schemas: BoundingBoxPayload, ClassifyPayload, ComparePayload, FreeTextPayload, LinePayload, LocatePayload, NamedEntityPayload, PolygonPayload, ScrubPayload, TranscriptionPayload. Details: " + ", ".join(error_messages))
|
|
140
|
+
elif match == 0:
|
|
141
|
+
# no match
|
|
142
|
+
raise ValueError("No match found when setting `actual_instance` in ValidationSetValidationSetIdRapidPostPayloadParameter with oneOf schemas: BoundingBoxPayload, ClassifyPayload, ComparePayload, FreeTextPayload, LinePayload, LocatePayload, NamedEntityPayload, PolygonPayload, ScrubPayload, TranscriptionPayload. Details: " + ", ".join(error_messages))
|
|
143
|
+
else:
|
|
144
|
+
return v
|
|
145
|
+
|
|
146
|
+
@classmethod
|
|
147
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
148
|
+
return cls.from_json(json.dumps(obj))
|
|
149
|
+
|
|
150
|
+
@classmethod
|
|
151
|
+
def from_json(cls, json_str: str) -> Self:
|
|
152
|
+
"""Returns the object represented by the json string"""
|
|
153
|
+
instance = cls.model_construct()
|
|
154
|
+
error_messages = []
|
|
155
|
+
match = 0
|
|
156
|
+
|
|
157
|
+
# deserialize data into TranscriptionPayload
|
|
158
|
+
try:
|
|
159
|
+
instance.actual_instance = TranscriptionPayload.from_json(json_str)
|
|
160
|
+
match += 1
|
|
161
|
+
except (ValidationError, ValueError) as e:
|
|
162
|
+
error_messages.append(str(e))
|
|
163
|
+
# deserialize data into ScrubPayload
|
|
164
|
+
try:
|
|
165
|
+
instance.actual_instance = ScrubPayload.from_json(json_str)
|
|
166
|
+
match += 1
|
|
167
|
+
except (ValidationError, ValueError) as e:
|
|
168
|
+
error_messages.append(str(e))
|
|
169
|
+
# deserialize data into PolygonPayload
|
|
170
|
+
try:
|
|
171
|
+
instance.actual_instance = PolygonPayload.from_json(json_str)
|
|
172
|
+
match += 1
|
|
173
|
+
except (ValidationError, ValueError) as e:
|
|
174
|
+
error_messages.append(str(e))
|
|
175
|
+
# deserialize data into NamedEntityPayload
|
|
176
|
+
try:
|
|
177
|
+
instance.actual_instance = NamedEntityPayload.from_json(json_str)
|
|
178
|
+
match += 1
|
|
179
|
+
except (ValidationError, ValueError) as e:
|
|
180
|
+
error_messages.append(str(e))
|
|
181
|
+
# deserialize data into LocatePayload
|
|
182
|
+
try:
|
|
183
|
+
instance.actual_instance = LocatePayload.from_json(json_str)
|
|
184
|
+
match += 1
|
|
185
|
+
except (ValidationError, ValueError) as e:
|
|
186
|
+
error_messages.append(str(e))
|
|
187
|
+
# deserialize data into LinePayload
|
|
188
|
+
try:
|
|
189
|
+
instance.actual_instance = LinePayload.from_json(json_str)
|
|
190
|
+
match += 1
|
|
191
|
+
except (ValidationError, ValueError) as e:
|
|
192
|
+
error_messages.append(str(e))
|
|
193
|
+
# deserialize data into FreeTextPayload
|
|
194
|
+
try:
|
|
195
|
+
instance.actual_instance = FreeTextPayload.from_json(json_str)
|
|
196
|
+
match += 1
|
|
197
|
+
except (ValidationError, ValueError) as e:
|
|
198
|
+
error_messages.append(str(e))
|
|
199
|
+
# deserialize data into ComparePayload
|
|
200
|
+
try:
|
|
201
|
+
instance.actual_instance = ComparePayload.from_json(json_str)
|
|
202
|
+
match += 1
|
|
203
|
+
except (ValidationError, ValueError) as e:
|
|
204
|
+
error_messages.append(str(e))
|
|
205
|
+
# deserialize data into ClassifyPayload
|
|
206
|
+
try:
|
|
207
|
+
instance.actual_instance = ClassifyPayload.from_json(json_str)
|
|
208
|
+
match += 1
|
|
209
|
+
except (ValidationError, ValueError) as e:
|
|
210
|
+
error_messages.append(str(e))
|
|
211
|
+
# deserialize data into BoundingBoxPayload
|
|
212
|
+
try:
|
|
213
|
+
instance.actual_instance = BoundingBoxPayload.from_json(json_str)
|
|
214
|
+
match += 1
|
|
215
|
+
except (ValidationError, ValueError) as e:
|
|
216
|
+
error_messages.append(str(e))
|
|
217
|
+
|
|
218
|
+
if match > 1:
|
|
219
|
+
# more than 1 match
|
|
220
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into ValidationSetValidationSetIdRapidPostPayloadParameter with oneOf schemas: BoundingBoxPayload, ClassifyPayload, ComparePayload, FreeTextPayload, LinePayload, LocatePayload, NamedEntityPayload, PolygonPayload, ScrubPayload, TranscriptionPayload. Details: " + ", ".join(error_messages))
|
|
221
|
+
elif match == 0:
|
|
222
|
+
# no match
|
|
223
|
+
raise ValueError("No match found when deserializing the JSON string into ValidationSetValidationSetIdRapidPostPayloadParameter with oneOf schemas: BoundingBoxPayload, ClassifyPayload, ComparePayload, FreeTextPayload, LinePayload, LocatePayload, NamedEntityPayload, PolygonPayload, ScrubPayload, TranscriptionPayload. Details: " + ", ".join(error_messages))
|
|
224
|
+
else:
|
|
225
|
+
return instance
|
|
226
|
+
|
|
227
|
+
def to_json(self) -> str:
|
|
228
|
+
"""Returns the JSON representation of the actual instance"""
|
|
229
|
+
if self.actual_instance is None:
|
|
230
|
+
return "null"
|
|
231
|
+
|
|
232
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
233
|
+
return self.actual_instance.to_json()
|
|
234
|
+
else:
|
|
235
|
+
return json.dumps(self.actual_instance)
|
|
236
|
+
|
|
237
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], BoundingBoxPayload, ClassifyPayload, ComparePayload, FreeTextPayload, LinePayload, LocatePayload, NamedEntityPayload, PolygonPayload, ScrubPayload, TranscriptionPayload]]:
|
|
238
|
+
"""Returns the dict representation of the actual instance"""
|
|
239
|
+
if self.actual_instance is None:
|
|
240
|
+
return None
|
|
241
|
+
|
|
242
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
243
|
+
return self.actual_instance.to_dict()
|
|
244
|
+
else:
|
|
245
|
+
# primitive type
|
|
246
|
+
return self.actual_instance
|
|
247
|
+
|
|
248
|
+
def to_str(self) -> str:
|
|
249
|
+
"""Returns the string representation of the actual instance"""
|
|
250
|
+
return pprint.pformat(self.model_dump())
|
|
251
|
+
|
|
252
|
+
|