rapidata 1.2.0__py3-none-any.whl → 1.2.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 rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +4 -0
- rapidata/api_client/__init__.py +25 -5
- rapidata/api_client/api/dataset_api.py +388 -388
- rapidata/api_client/api/workflow_api.py +18 -1064
- rapidata/api_client/models/__init__.py +25 -5
- rapidata/api_client/models/add_validation_text_rapid_model.py +3 -3
- rapidata/api_client/models/classification_metadata_model.py +98 -0
- rapidata/api_client/models/compare_workflow_config.py +3 -3
- rapidata/api_client/models/compare_workflow_config_model.py +3 -3
- rapidata/api_client/models/compare_workflow_model1.py +4 -18
- rapidata/api_client/models/compare_workflow_model1_referee.py +154 -0
- rapidata/api_client/models/completed_rapid_model.py +3 -3
- rapidata/api_client/models/completed_rapid_model_asset.py +170 -0
- rapidata/api_client/models/count_metadata_model.py +98 -0
- rapidata/api_client/models/demographic_metadata_model.py +100 -0
- rapidata/api_client/models/file_asset_model.py +3 -3
- rapidata/api_client/models/file_asset_model1.py +108 -0
- rapidata/api_client/models/file_asset_model1_metadata_inner.py +252 -0
- rapidata/api_client/models/file_asset_model2.py +108 -0
- rapidata/api_client/models/file_asset_model_metadata_inner.py +252 -0
- rapidata/api_client/models/image_dimension_metadata_model.py +100 -0
- rapidata/api_client/models/in_progress_rapid_model.py +3 -3
- rapidata/api_client/models/location_metadata_model.py +100 -0
- rapidata/api_client/models/multi_asset_model.py +3 -3
- rapidata/api_client/models/multi_asset_model1.py +118 -0
- rapidata/api_client/models/multi_asset_model1_assets_inner.py +170 -0
- rapidata/api_client/models/multi_asset_model2.py +118 -0
- rapidata/api_client/models/not_started_rapid_model.py +3 -3
- rapidata/api_client/models/null_asset_model.py +3 -3
- rapidata/api_client/models/null_asset_model1.py +106 -0
- rapidata/api_client/models/null_asset_model2.py +106 -0
- rapidata/api_client/models/original_filename_metadata_model.py +98 -0
- rapidata/api_client/models/prompt_metadata_model.py +98 -0
- rapidata/api_client/models/query_validation_rapids_result_asset.py +40 -40
- rapidata/api_client/models/ranked_datapoint_model.py +3 -3
- rapidata/api_client/models/simple_workflow_config.py +6 -6
- rapidata/api_client/models/simple_workflow_config_model.py +3 -3
- rapidata/api_client/models/simple_workflow_model1.py +7 -21
- rapidata/api_client/models/simple_workflow_model1_blueprint.py +238 -0
- rapidata/api_client/models/text_asset_model.py +3 -3
- rapidata/api_client/models/text_asset_model1.py +108 -0
- rapidata/api_client/models/text_asset_model2.py +108 -0
- rapidata/api_client/models/text_metadata_model.py +98 -0
- rapidata/api_client/models/transcription_metadata_model.py +98 -0
- rapidata/api_client/models/translated_prompt_metadata_model.py +102 -0
- rapidata/api_client/models/translated_string.py +93 -0
- rapidata/api_client_README.md +26 -10
- rapidata/rapidata_client/__init__.py +10 -0
- rapidata/rapidata_client/assets/media_asset.py +1 -1
- rapidata/rapidata_client/assets/multi_asset.py +12 -3
- rapidata/rapidata_client/dataset/rapidata_dataset.py +43 -9
- rapidata/rapidata_client/dataset/rapidata_validation_set.py +26 -6
- rapidata/rapidata_client/dataset/validation_set_builder.py +1 -1
- rapidata/rapidata_client/filter/__init__.py +7 -0
- rapidata/rapidata_client/filter/age_filter.py +16 -0
- rapidata/rapidata_client/filter/base_filter.py +9 -0
- rapidata/rapidata_client/filter/campaign_filter.py +17 -0
- rapidata/rapidata_client/filter/country_filter.py +16 -0
- rapidata/rapidata_client/filter/gender_filter.py +16 -0
- rapidata/rapidata_client/filter/language_filter.py +18 -0
- rapidata/rapidata_client/filter/user_score_filter.py +19 -0
- rapidata/rapidata_client/order/rapidata_order_builder.py +141 -44
- rapidata/rapidata_client/selection/demographic_selection.py +3 -2
- {rapidata-1.2.0.dist-info → rapidata-1.2.2.dist-info}/METADATA +1 -1
- {rapidata-1.2.0.dist-info → rapidata-1.2.2.dist-info}/RECORD +67 -34
- {rapidata-1.2.0.dist-info → rapidata-1.2.2.dist-info}/LICENSE +0 -0
- {rapidata-1.2.0.dist-info → rapidata-1.2.2.dist-info}/WHEEL +0 -0
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
23
23
|
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
24
24
|
from rapidata.api_client.models.simple_workflow_config_model_blueprint import SimpleWorkflowConfigModelBlueprint
|
|
25
25
|
from typing import Optional, Set
|
|
@@ -30,7 +30,7 @@ class SimpleWorkflowConfigModel(BaseModel):
|
|
|
30
30
|
The configuration for a simple workflow. A simple workflow creates a rapid for each datapoint in its dataset. It is considered complete when all rapids have been completed.
|
|
31
31
|
""" # noqa: E501
|
|
32
32
|
t: StrictStr = Field(description="Discriminator value for SimpleWorkflowConfig", alias="_t")
|
|
33
|
-
referee:
|
|
33
|
+
referee: CompareWorkflowModel1Referee
|
|
34
34
|
blueprint: SimpleWorkflowConfigModelBlueprint
|
|
35
35
|
target_country_codes: List[StrictStr] = Field(description="A list of country codes that this workflow is targeting.", alias="targetCountryCodes")
|
|
36
36
|
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
|
|
@@ -120,7 +120,7 @@ class SimpleWorkflowConfigModel(BaseModel):
|
|
|
120
120
|
|
|
121
121
|
_obj = cls.model_validate({
|
|
122
122
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'SimpleWorkflowConfig',
|
|
123
|
-
"referee":
|
|
123
|
+
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
124
124
|
"blueprint": SimpleWorkflowConfigModelBlueprint.from_dict(obj["blueprint"]) if obj.get("blueprint") is not None else None,
|
|
125
125
|
"targetCountryCodes": obj.get("targetCountryCodes"),
|
|
126
126
|
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
@@ -19,9 +19,8 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
23
|
-
from rapidata.api_client.models.
|
|
24
|
-
from rapidata.api_client.models.simple_workflow_config_blueprint import SimpleWorkflowConfigBlueprint
|
|
22
|
+
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
23
|
+
from rapidata.api_client.models.simple_workflow_model1_blueprint import SimpleWorkflowModel1Blueprint
|
|
25
24
|
from typing import Optional, Set
|
|
26
25
|
from typing_extensions import Self
|
|
27
26
|
|
|
@@ -32,15 +31,12 @@ class SimpleWorkflowModel1(BaseModel):
|
|
|
32
31
|
t: StrictStr = Field(description="Discriminator value for SimpleWorkflowModel", alias="_t")
|
|
33
32
|
id: StrictStr
|
|
34
33
|
dataset_id: Optional[StrictStr] = Field(alias="datasetId")
|
|
35
|
-
target_country_codes: List[StrictStr] = Field(alias="targetCountryCodes")
|
|
36
|
-
feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
|
|
37
34
|
state: StrictStr
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
referee: CompareWorkflowConfigReferee
|
|
35
|
+
blueprint: SimpleWorkflowModel1Blueprint
|
|
36
|
+
referee: CompareWorkflowModel1Referee
|
|
41
37
|
name: StrictStr
|
|
42
38
|
owner_mail: Optional[StrictStr] = Field(alias="ownerMail")
|
|
43
|
-
__properties: ClassVar[List[str]] = ["_t", "id", "datasetId", "
|
|
39
|
+
__properties: ClassVar[List[str]] = ["_t", "id", "datasetId", "state", "blueprint", "referee", "name", "ownerMail"]
|
|
44
40
|
|
|
45
41
|
@field_validator('t')
|
|
46
42
|
def t_validate_enum(cls, value):
|
|
@@ -88,13 +84,6 @@ class SimpleWorkflowModel1(BaseModel):
|
|
|
88
84
|
exclude=excluded_fields,
|
|
89
85
|
exclude_none=True,
|
|
90
86
|
)
|
|
91
|
-
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
|
|
92
|
-
_items = []
|
|
93
|
-
if self.feature_flags:
|
|
94
|
-
for _item_feature_flags in self.feature_flags:
|
|
95
|
-
if _item_feature_flags:
|
|
96
|
-
_items.append(_item_feature_flags.to_dict())
|
|
97
|
-
_dict['featureFlags'] = _items
|
|
98
87
|
# override the default output from pydantic by calling `to_dict()` of blueprint
|
|
99
88
|
if self.blueprint:
|
|
100
89
|
_dict['blueprint'] = self.blueprint.to_dict()
|
|
@@ -126,12 +115,9 @@ class SimpleWorkflowModel1(BaseModel):
|
|
|
126
115
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'SimpleWorkflowModel',
|
|
127
116
|
"id": obj.get("id"),
|
|
128
117
|
"datasetId": obj.get("datasetId"),
|
|
129
|
-
"targetCountryCodes": obj.get("targetCountryCodes"),
|
|
130
|
-
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
131
118
|
"state": obj.get("state"),
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"referee": CompareWorkflowConfigReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
119
|
+
"blueprint": SimpleWorkflowModel1Blueprint.from_dict(obj["blueprint"]) if obj.get("blueprint") is not None else None,
|
|
120
|
+
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
135
121
|
"name": obj.get("name"),
|
|
136
122
|
"ownerMail": obj.get("ownerMail")
|
|
137
123
|
})
|
|
@@ -0,0 +1,238 @@
|
|
|
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.attach_category_rapid_blueprint import AttachCategoryRapidBlueprint
|
|
21
|
+
from rapidata.api_client.models.bounding_box_rapid_blueprint import BoundingBoxRapidBlueprint
|
|
22
|
+
from rapidata.api_client.models.compare_rapid_blueprint import CompareRapidBlueprint
|
|
23
|
+
from rapidata.api_client.models.free_text_rapid_blueprint import FreeTextRapidBlueprint
|
|
24
|
+
from rapidata.api_client.models.line_rapid_blueprint import LineRapidBlueprint
|
|
25
|
+
from rapidata.api_client.models.locate_rapid_blueprint import LocateRapidBlueprint
|
|
26
|
+
from rapidata.api_client.models.named_entity_rapid_blueprint import NamedEntityRapidBlueprint
|
|
27
|
+
from rapidata.api_client.models.polygon_rapid_blueprint import PolygonRapidBlueprint
|
|
28
|
+
from rapidata.api_client.models.transcription_rapid_blueprint import TranscriptionRapidBlueprint
|
|
29
|
+
from pydantic import StrictStr, Field
|
|
30
|
+
from typing import Union, List, Set, Optional, Dict
|
|
31
|
+
from typing_extensions import Literal, Self
|
|
32
|
+
|
|
33
|
+
SIMPLEWORKFLOWMODEL1BLUEPRINT_ONE_OF_SCHEMAS = ["AttachCategoryRapidBlueprint", "BoundingBoxRapidBlueprint", "CompareRapidBlueprint", "FreeTextRapidBlueprint", "LineRapidBlueprint", "LocateRapidBlueprint", "NamedEntityRapidBlueprint", "PolygonRapidBlueprint", "TranscriptionRapidBlueprint"]
|
|
34
|
+
|
|
35
|
+
class SimpleWorkflowModel1Blueprint(BaseModel):
|
|
36
|
+
"""
|
|
37
|
+
SimpleWorkflowModel1Blueprint
|
|
38
|
+
"""
|
|
39
|
+
# data type: TranscriptionRapidBlueprint
|
|
40
|
+
oneof_schema_1_validator: Optional[TranscriptionRapidBlueprint] = None
|
|
41
|
+
# data type: PolygonRapidBlueprint
|
|
42
|
+
oneof_schema_2_validator: Optional[PolygonRapidBlueprint] = None
|
|
43
|
+
# data type: NamedEntityRapidBlueprint
|
|
44
|
+
oneof_schema_3_validator: Optional[NamedEntityRapidBlueprint] = None
|
|
45
|
+
# data type: LocateRapidBlueprint
|
|
46
|
+
oneof_schema_4_validator: Optional[LocateRapidBlueprint] = None
|
|
47
|
+
# data type: LineRapidBlueprint
|
|
48
|
+
oneof_schema_5_validator: Optional[LineRapidBlueprint] = None
|
|
49
|
+
# data type: FreeTextRapidBlueprint
|
|
50
|
+
oneof_schema_6_validator: Optional[FreeTextRapidBlueprint] = None
|
|
51
|
+
# data type: CompareRapidBlueprint
|
|
52
|
+
oneof_schema_7_validator: Optional[CompareRapidBlueprint] = None
|
|
53
|
+
# data type: AttachCategoryRapidBlueprint
|
|
54
|
+
oneof_schema_8_validator: Optional[AttachCategoryRapidBlueprint] = None
|
|
55
|
+
# data type: BoundingBoxRapidBlueprint
|
|
56
|
+
oneof_schema_9_validator: Optional[BoundingBoxRapidBlueprint] = None
|
|
57
|
+
actual_instance: Optional[Union[AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint]] = None
|
|
58
|
+
one_of_schemas: Set[str] = { "AttachCategoryRapidBlueprint", "BoundingBoxRapidBlueprint", "CompareRapidBlueprint", "FreeTextRapidBlueprint", "LineRapidBlueprint", "LocateRapidBlueprint", "NamedEntityRapidBlueprint", "PolygonRapidBlueprint", "TranscriptionRapidBlueprint" }
|
|
59
|
+
|
|
60
|
+
model_config = ConfigDict(
|
|
61
|
+
validate_assignment=True,
|
|
62
|
+
protected_namespaces=(),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
70
|
+
if args:
|
|
71
|
+
if len(args) > 1:
|
|
72
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
73
|
+
if kwargs:
|
|
74
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
75
|
+
super().__init__(actual_instance=args[0])
|
|
76
|
+
else:
|
|
77
|
+
super().__init__(**kwargs)
|
|
78
|
+
|
|
79
|
+
@field_validator('actual_instance')
|
|
80
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
81
|
+
instance = SimpleWorkflowModel1Blueprint.model_construct()
|
|
82
|
+
error_messages = []
|
|
83
|
+
match = 0
|
|
84
|
+
# validate data type: TranscriptionRapidBlueprint
|
|
85
|
+
if not isinstance(v, TranscriptionRapidBlueprint):
|
|
86
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionRapidBlueprint`")
|
|
87
|
+
else:
|
|
88
|
+
match += 1
|
|
89
|
+
# validate data type: PolygonRapidBlueprint
|
|
90
|
+
if not isinstance(v, PolygonRapidBlueprint):
|
|
91
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonRapidBlueprint`")
|
|
92
|
+
else:
|
|
93
|
+
match += 1
|
|
94
|
+
# validate data type: NamedEntityRapidBlueprint
|
|
95
|
+
if not isinstance(v, NamedEntityRapidBlueprint):
|
|
96
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NamedEntityRapidBlueprint`")
|
|
97
|
+
else:
|
|
98
|
+
match += 1
|
|
99
|
+
# validate data type: LocateRapidBlueprint
|
|
100
|
+
if not isinstance(v, LocateRapidBlueprint):
|
|
101
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LocateRapidBlueprint`")
|
|
102
|
+
else:
|
|
103
|
+
match += 1
|
|
104
|
+
# validate data type: LineRapidBlueprint
|
|
105
|
+
if not isinstance(v, LineRapidBlueprint):
|
|
106
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LineRapidBlueprint`")
|
|
107
|
+
else:
|
|
108
|
+
match += 1
|
|
109
|
+
# validate data type: FreeTextRapidBlueprint
|
|
110
|
+
if not isinstance(v, FreeTextRapidBlueprint):
|
|
111
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FreeTextRapidBlueprint`")
|
|
112
|
+
else:
|
|
113
|
+
match += 1
|
|
114
|
+
# validate data type: CompareRapidBlueprint
|
|
115
|
+
if not isinstance(v, CompareRapidBlueprint):
|
|
116
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CompareRapidBlueprint`")
|
|
117
|
+
else:
|
|
118
|
+
match += 1
|
|
119
|
+
# validate data type: AttachCategoryRapidBlueprint
|
|
120
|
+
if not isinstance(v, AttachCategoryRapidBlueprint):
|
|
121
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AttachCategoryRapidBlueprint`")
|
|
122
|
+
else:
|
|
123
|
+
match += 1
|
|
124
|
+
# validate data type: BoundingBoxRapidBlueprint
|
|
125
|
+
if not isinstance(v, BoundingBoxRapidBlueprint):
|
|
126
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxRapidBlueprint`")
|
|
127
|
+
else:
|
|
128
|
+
match += 1
|
|
129
|
+
if match > 1:
|
|
130
|
+
# more than 1 match
|
|
131
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in SimpleWorkflowModel1Blueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
|
|
132
|
+
elif match == 0:
|
|
133
|
+
# no match
|
|
134
|
+
raise ValueError("No match found when setting `actual_instance` in SimpleWorkflowModel1Blueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
|
|
135
|
+
else:
|
|
136
|
+
return v
|
|
137
|
+
|
|
138
|
+
@classmethod
|
|
139
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
140
|
+
return cls.from_json(json.dumps(obj))
|
|
141
|
+
|
|
142
|
+
@classmethod
|
|
143
|
+
def from_json(cls, json_str: str) -> Self:
|
|
144
|
+
"""Returns the object represented by the json string"""
|
|
145
|
+
instance = cls.model_construct()
|
|
146
|
+
error_messages = []
|
|
147
|
+
match = 0
|
|
148
|
+
|
|
149
|
+
# deserialize data into TranscriptionRapidBlueprint
|
|
150
|
+
try:
|
|
151
|
+
instance.actual_instance = TranscriptionRapidBlueprint.from_json(json_str)
|
|
152
|
+
match += 1
|
|
153
|
+
except (ValidationError, ValueError) as e:
|
|
154
|
+
error_messages.append(str(e))
|
|
155
|
+
# deserialize data into PolygonRapidBlueprint
|
|
156
|
+
try:
|
|
157
|
+
instance.actual_instance = PolygonRapidBlueprint.from_json(json_str)
|
|
158
|
+
match += 1
|
|
159
|
+
except (ValidationError, ValueError) as e:
|
|
160
|
+
error_messages.append(str(e))
|
|
161
|
+
# deserialize data into NamedEntityRapidBlueprint
|
|
162
|
+
try:
|
|
163
|
+
instance.actual_instance = NamedEntityRapidBlueprint.from_json(json_str)
|
|
164
|
+
match += 1
|
|
165
|
+
except (ValidationError, ValueError) as e:
|
|
166
|
+
error_messages.append(str(e))
|
|
167
|
+
# deserialize data into LocateRapidBlueprint
|
|
168
|
+
try:
|
|
169
|
+
instance.actual_instance = LocateRapidBlueprint.from_json(json_str)
|
|
170
|
+
match += 1
|
|
171
|
+
except (ValidationError, ValueError) as e:
|
|
172
|
+
error_messages.append(str(e))
|
|
173
|
+
# deserialize data into LineRapidBlueprint
|
|
174
|
+
try:
|
|
175
|
+
instance.actual_instance = LineRapidBlueprint.from_json(json_str)
|
|
176
|
+
match += 1
|
|
177
|
+
except (ValidationError, ValueError) as e:
|
|
178
|
+
error_messages.append(str(e))
|
|
179
|
+
# deserialize data into FreeTextRapidBlueprint
|
|
180
|
+
try:
|
|
181
|
+
instance.actual_instance = FreeTextRapidBlueprint.from_json(json_str)
|
|
182
|
+
match += 1
|
|
183
|
+
except (ValidationError, ValueError) as e:
|
|
184
|
+
error_messages.append(str(e))
|
|
185
|
+
# deserialize data into CompareRapidBlueprint
|
|
186
|
+
try:
|
|
187
|
+
instance.actual_instance = CompareRapidBlueprint.from_json(json_str)
|
|
188
|
+
match += 1
|
|
189
|
+
except (ValidationError, ValueError) as e:
|
|
190
|
+
error_messages.append(str(e))
|
|
191
|
+
# deserialize data into AttachCategoryRapidBlueprint
|
|
192
|
+
try:
|
|
193
|
+
instance.actual_instance = AttachCategoryRapidBlueprint.from_json(json_str)
|
|
194
|
+
match += 1
|
|
195
|
+
except (ValidationError, ValueError) as e:
|
|
196
|
+
error_messages.append(str(e))
|
|
197
|
+
# deserialize data into BoundingBoxRapidBlueprint
|
|
198
|
+
try:
|
|
199
|
+
instance.actual_instance = BoundingBoxRapidBlueprint.from_json(json_str)
|
|
200
|
+
match += 1
|
|
201
|
+
except (ValidationError, ValueError) as e:
|
|
202
|
+
error_messages.append(str(e))
|
|
203
|
+
|
|
204
|
+
if match > 1:
|
|
205
|
+
# more than 1 match
|
|
206
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into SimpleWorkflowModel1Blueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
|
|
207
|
+
elif match == 0:
|
|
208
|
+
# no match
|
|
209
|
+
raise ValueError("No match found when deserializing the JSON string into SimpleWorkflowModel1Blueprint with oneOf schemas: AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint. Details: " + ", ".join(error_messages))
|
|
210
|
+
else:
|
|
211
|
+
return instance
|
|
212
|
+
|
|
213
|
+
def to_json(self) -> str:
|
|
214
|
+
"""Returns the JSON representation of the actual instance"""
|
|
215
|
+
if self.actual_instance is None:
|
|
216
|
+
return "null"
|
|
217
|
+
|
|
218
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
219
|
+
return self.actual_instance.to_json()
|
|
220
|
+
else:
|
|
221
|
+
return json.dumps(self.actual_instance)
|
|
222
|
+
|
|
223
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryRapidBlueprint, BoundingBoxRapidBlueprint, CompareRapidBlueprint, FreeTextRapidBlueprint, LineRapidBlueprint, LocateRapidBlueprint, NamedEntityRapidBlueprint, PolygonRapidBlueprint, TranscriptionRapidBlueprint]]:
|
|
224
|
+
"""Returns the dict representation of the actual instance"""
|
|
225
|
+
if self.actual_instance is None:
|
|
226
|
+
return None
|
|
227
|
+
|
|
228
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
229
|
+
return self.actual_instance.to_dict()
|
|
230
|
+
else:
|
|
231
|
+
# primitive type
|
|
232
|
+
return self.actual_instance
|
|
233
|
+
|
|
234
|
+
def to_str(self) -> str:
|
|
235
|
+
"""Returns the string representation of the actual instance"""
|
|
236
|
+
return pprint.pformat(self.model_dump())
|
|
237
|
+
|
|
238
|
+
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.file_asset_model_metadata_inner import FileAssetModelMetadataInner
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ class TextAssetModel(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
t: StrictStr = Field(description="Discriminator value for TextAssetModel", alias="_t")
|
|
31
31
|
text: StrictStr
|
|
32
|
-
metadata: List[
|
|
32
|
+
metadata: List[FileAssetModelMetadataInner]
|
|
33
33
|
identifier: StrictStr
|
|
34
34
|
__properties: ClassVar[List[str]] = ["_t", "text", "metadata", "identifier"]
|
|
35
35
|
|
|
@@ -100,7 +100,7 @@ class TextAssetModel(BaseModel):
|
|
|
100
100
|
_obj = cls.model_validate({
|
|
101
101
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'TextAssetModel',
|
|
102
102
|
"text": obj.get("text"),
|
|
103
|
-
"metadata": [
|
|
103
|
+
"metadata": [FileAssetModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
104
104
|
"identifier": obj.get("identifier")
|
|
105
105
|
})
|
|
106
106
|
return _obj
|
|
@@ -0,0 +1,108 @@
|
|
|
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, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.file_asset_model1_metadata_inner import FileAssetModel1MetadataInner
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class TextAssetModel1(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
TextAssetModel1
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
t: StrictStr = Field(description="Discriminator value for TextAssetModel", alias="_t")
|
|
31
|
+
text: StrictStr
|
|
32
|
+
metadata: List[FileAssetModel1MetadataInner]
|
|
33
|
+
identifier: StrictStr
|
|
34
|
+
__properties: ClassVar[List[str]] = ["_t", "text", "metadata", "identifier"]
|
|
35
|
+
|
|
36
|
+
@field_validator('t')
|
|
37
|
+
def t_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['TextAssetModel']):
|
|
40
|
+
raise ValueError("must be one of enum values ('TextAssetModel')")
|
|
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 TextAssetModel1 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
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
83
|
+
_items = []
|
|
84
|
+
if self.metadata:
|
|
85
|
+
for _item_metadata in self.metadata:
|
|
86
|
+
if _item_metadata:
|
|
87
|
+
_items.append(_item_metadata.to_dict())
|
|
88
|
+
_dict['metadata'] = _items
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of TextAssetModel1 from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate({
|
|
101
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'TextAssetModel',
|
|
102
|
+
"text": obj.get("text"),
|
|
103
|
+
"metadata": [FileAssetModel1MetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
104
|
+
"identifier": obj.get("identifier")
|
|
105
|
+
})
|
|
106
|
+
return _obj
|
|
107
|
+
|
|
108
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
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, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.file_asset_model1_metadata_inner import FileAssetModel1MetadataInner
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class TextAssetModel2(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
TextAssetModel2
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
t: StrictStr = Field(description="Discriminator value for TextAssetModel", alias="_t")
|
|
31
|
+
text: StrictStr
|
|
32
|
+
metadata: List[FileAssetModel1MetadataInner]
|
|
33
|
+
identifier: StrictStr
|
|
34
|
+
__properties: ClassVar[List[str]] = ["_t", "text", "metadata", "identifier"]
|
|
35
|
+
|
|
36
|
+
@field_validator('t')
|
|
37
|
+
def t_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['TextAssetModel']):
|
|
40
|
+
raise ValueError("must be one of enum values ('TextAssetModel')")
|
|
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 TextAssetModel2 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
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
83
|
+
_items = []
|
|
84
|
+
if self.metadata:
|
|
85
|
+
for _item_metadata in self.metadata:
|
|
86
|
+
if _item_metadata:
|
|
87
|
+
_items.append(_item_metadata.to_dict())
|
|
88
|
+
_dict['metadata'] = _items
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of TextAssetModel2 from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate({
|
|
101
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'TextAssetModel',
|
|
102
|
+
"text": obj.get("text"),
|
|
103
|
+
"metadata": [FileAssetModel1MetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
104
|
+
"identifier": obj.get("identifier")
|
|
105
|
+
})
|
|
106
|
+
return _obj
|
|
107
|
+
|
|
108
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
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, 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 TextMetadataModel(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
TextMetadataModel
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for TextMetadata", alias="_t")
|
|
30
|
+
text: StrictStr
|
|
31
|
+
identifier: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "text", "identifier"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['TextMetadata']):
|
|
38
|
+
raise ValueError("must be one of enum values ('TextMetadata')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of TextMetadataModel from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of TextMetadataModel from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'TextMetadata',
|
|
93
|
+
"text": obj.get("text"),
|
|
94
|
+
"identifier": obj.get("identifier")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|