rapidata 2.1.4__py3-none-any.whl → 2.2.1__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.

Files changed (35) hide show
  1. rapidata/api_client/__init__.py +7 -0
  2. rapidata/api_client/models/__init__.py +7 -0
  3. rapidata/api_client/models/add_validation_rapid_model_payload.py +30 -16
  4. rapidata/api_client/models/add_validation_rapid_model_truth.py +30 -16
  5. rapidata/api_client/models/query_validation_rapids_result.py +29 -2
  6. rapidata/api_client/models/query_validation_rapids_result_payload.py +252 -0
  7. rapidata/api_client/models/query_validation_rapids_result_truth.py +258 -0
  8. rapidata/api_client/models/rapid_answer_result.py +31 -17
  9. rapidata/api_client/models/rapid_result_model_result.py +31 -17
  10. rapidata/api_client/models/scrub_payload.py +96 -0
  11. rapidata/api_client/models/scrub_range.py +89 -0
  12. rapidata/api_client/models/scrub_rapid_blueprint.py +96 -0
  13. rapidata/api_client/models/scrub_result.py +98 -0
  14. rapidata/api_client/models/scrub_truth.py +104 -0
  15. rapidata/api_client/models/simple_workflow_config_model_blueprint.py +30 -16
  16. rapidata/api_client/models/simple_workflow_model_blueprint.py +30 -16
  17. rapidata/api_client/models/validation_import_post_request_blueprint.py +30 -16
  18. rapidata/api_client_README.md +7 -0
  19. rapidata/rapidata_client/assets/_media_asset.py +45 -0
  20. rapidata/rapidata_client/order/_rapidata_dataset.py +4 -1
  21. rapidata/rapidata_client/order/rapidata_order_manager.py +50 -1
  22. rapidata/rapidata_client/selection/rapidata_selections.py +4 -2
  23. rapidata/rapidata_client/validation/_validation_rapid_parts.py +5 -0
  24. rapidata/rapidata_client/validation/_validation_set_builder.py +107 -7
  25. rapidata/rapidata_client/validation/rapidata_validation_set.py +4 -0
  26. rapidata/rapidata_client/validation/rapids/rapids.py +34 -0
  27. rapidata/rapidata_client/validation/rapids/rapids_manager.py +29 -1
  28. rapidata/rapidata_client/validation/validation_set_manager.py +60 -10
  29. rapidata/rapidata_client/workflow/__init__.py +1 -0
  30. rapidata/rapidata_client/workflow/_select_words_workflow.py +2 -2
  31. rapidata/rapidata_client/workflow/_timestamp_workflow.py +34 -0
  32. {rapidata-2.1.4.dist-info → rapidata-2.2.1.dist-info}/METADATA +2 -1
  33. {rapidata-2.1.4.dist-info → rapidata-2.2.1.dist-info}/RECORD +35 -27
  34. {rapidata-2.1.4.dist-info → rapidata-2.2.1.dist-info}/WHEEL +1 -1
  35. {rapidata-2.1.4.dist-info → rapidata-2.2.1.dist-info}/LICENSE +0 -0
@@ -0,0 +1,258 @@
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_truth import AttachCategoryTruth
21
+ from rapidata.api_client.models.bounding_box_truth import BoundingBoxTruth
22
+ from rapidata.api_client.models.compare_truth import CompareTruth
23
+ from rapidata.api_client.models.empty_validation_truth import EmptyValidationTruth
24
+ from rapidata.api_client.models.line_truth import LineTruth
25
+ from rapidata.api_client.models.locate_box_truth import LocateBoxTruth
26
+ from rapidata.api_client.models.named_entity_truth import NamedEntityTruth
27
+ from rapidata.api_client.models.polygon_truth import PolygonTruth
28
+ from rapidata.api_client.models.scrub_truth import ScrubTruth
29
+ from rapidata.api_client.models.transcription_truth import TranscriptionTruth
30
+ from pydantic import StrictStr, Field
31
+ from typing import Union, List, Set, Optional, Dict
32
+ from typing_extensions import Literal, Self
33
+
34
+ QUERYVALIDATIONRAPIDSRESULTTRUTH_ONE_OF_SCHEMAS = ["AttachCategoryTruth", "BoundingBoxTruth", "CompareTruth", "EmptyValidationTruth", "LineTruth", "LocateBoxTruth", "NamedEntityTruth", "PolygonTruth", "ScrubTruth", "TranscriptionTruth"]
35
+
36
+ class QueryValidationRapidsResultTruth(BaseModel):
37
+ """
38
+ QueryValidationRapidsResultTruth
39
+ """
40
+ # data type: TranscriptionTruth
41
+ oneof_schema_1_validator: Optional[TranscriptionTruth] = None
42
+ # data type: ScrubTruth
43
+ oneof_schema_2_validator: Optional[ScrubTruth] = None
44
+ # data type: PolygonTruth
45
+ oneof_schema_3_validator: Optional[PolygonTruth] = None
46
+ # data type: NamedEntityTruth
47
+ oneof_schema_4_validator: Optional[NamedEntityTruth] = None
48
+ # data type: LocateBoxTruth
49
+ oneof_schema_5_validator: Optional[LocateBoxTruth] = None
50
+ # data type: LineTruth
51
+ oneof_schema_6_validator: Optional[LineTruth] = None
52
+ # data type: EmptyValidationTruth
53
+ oneof_schema_7_validator: Optional[EmptyValidationTruth] = None
54
+ # data type: CompareTruth
55
+ oneof_schema_8_validator: Optional[CompareTruth] = None
56
+ # data type: AttachCategoryTruth
57
+ oneof_schema_9_validator: Optional[AttachCategoryTruth] = None
58
+ # data type: BoundingBoxTruth
59
+ oneof_schema_10_validator: Optional[BoundingBoxTruth] = None
60
+ actual_instance: Optional[Union[AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth]] = None
61
+ one_of_schemas: Set[str] = { "AttachCategoryTruth", "BoundingBoxTruth", "CompareTruth", "EmptyValidationTruth", "LineTruth", "LocateBoxTruth", "NamedEntityTruth", "PolygonTruth", "ScrubTruth", "TranscriptionTruth" }
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
+ if v is None:
85
+ return v
86
+
87
+ instance = QueryValidationRapidsResultTruth.model_construct()
88
+ error_messages = []
89
+ match = 0
90
+ # validate data type: TranscriptionTruth
91
+ if not isinstance(v, TranscriptionTruth):
92
+ error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionTruth`")
93
+ else:
94
+ match += 1
95
+ # validate data type: ScrubTruth
96
+ if not isinstance(v, ScrubTruth):
97
+ error_messages.append(f"Error! Input type `{type(v)}` is not `ScrubTruth`")
98
+ else:
99
+ match += 1
100
+ # validate data type: PolygonTruth
101
+ if not isinstance(v, PolygonTruth):
102
+ error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonTruth`")
103
+ else:
104
+ match += 1
105
+ # validate data type: NamedEntityTruth
106
+ if not isinstance(v, NamedEntityTruth):
107
+ error_messages.append(f"Error! Input type `{type(v)}` is not `NamedEntityTruth`")
108
+ else:
109
+ match += 1
110
+ # validate data type: LocateBoxTruth
111
+ if not isinstance(v, LocateBoxTruth):
112
+ error_messages.append(f"Error! Input type `{type(v)}` is not `LocateBoxTruth`")
113
+ else:
114
+ match += 1
115
+ # validate data type: LineTruth
116
+ if not isinstance(v, LineTruth):
117
+ error_messages.append(f"Error! Input type `{type(v)}` is not `LineTruth`")
118
+ else:
119
+ match += 1
120
+ # validate data type: EmptyValidationTruth
121
+ if not isinstance(v, EmptyValidationTruth):
122
+ error_messages.append(f"Error! Input type `{type(v)}` is not `EmptyValidationTruth`")
123
+ else:
124
+ match += 1
125
+ # validate data type: CompareTruth
126
+ if not isinstance(v, CompareTruth):
127
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CompareTruth`")
128
+ else:
129
+ match += 1
130
+ # validate data type: AttachCategoryTruth
131
+ if not isinstance(v, AttachCategoryTruth):
132
+ error_messages.append(f"Error! Input type `{type(v)}` is not `AttachCategoryTruth`")
133
+ else:
134
+ match += 1
135
+ # validate data type: BoundingBoxTruth
136
+ if not isinstance(v, BoundingBoxTruth):
137
+ error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxTruth`")
138
+ else:
139
+ match += 1
140
+ if match > 1:
141
+ # more than 1 match
142
+ raise ValueError("Multiple matches found when setting `actual_instance` in QueryValidationRapidsResultTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
143
+ elif match == 0:
144
+ # no match
145
+ raise ValueError("No match found when setting `actual_instance` in QueryValidationRapidsResultTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
146
+ else:
147
+ return v
148
+
149
+ @classmethod
150
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
151
+ return cls.from_json(json.dumps(obj))
152
+
153
+ @classmethod
154
+ def from_json(cls, json_str: Optional[str]) -> Self:
155
+ """Returns the object represented by the json string"""
156
+ instance = cls.model_construct()
157
+ if json_str is None:
158
+ return instance
159
+
160
+ error_messages = []
161
+ match = 0
162
+
163
+ # deserialize data into TranscriptionTruth
164
+ try:
165
+ instance.actual_instance = TranscriptionTruth.from_json(json_str)
166
+ match += 1
167
+ except (ValidationError, ValueError) as e:
168
+ error_messages.append(str(e))
169
+ # deserialize data into ScrubTruth
170
+ try:
171
+ instance.actual_instance = ScrubTruth.from_json(json_str)
172
+ match += 1
173
+ except (ValidationError, ValueError) as e:
174
+ error_messages.append(str(e))
175
+ # deserialize data into PolygonTruth
176
+ try:
177
+ instance.actual_instance = PolygonTruth.from_json(json_str)
178
+ match += 1
179
+ except (ValidationError, ValueError) as e:
180
+ error_messages.append(str(e))
181
+ # deserialize data into NamedEntityTruth
182
+ try:
183
+ instance.actual_instance = NamedEntityTruth.from_json(json_str)
184
+ match += 1
185
+ except (ValidationError, ValueError) as e:
186
+ error_messages.append(str(e))
187
+ # deserialize data into LocateBoxTruth
188
+ try:
189
+ instance.actual_instance = LocateBoxTruth.from_json(json_str)
190
+ match += 1
191
+ except (ValidationError, ValueError) as e:
192
+ error_messages.append(str(e))
193
+ # deserialize data into LineTruth
194
+ try:
195
+ instance.actual_instance = LineTruth.from_json(json_str)
196
+ match += 1
197
+ except (ValidationError, ValueError) as e:
198
+ error_messages.append(str(e))
199
+ # deserialize data into EmptyValidationTruth
200
+ try:
201
+ instance.actual_instance = EmptyValidationTruth.from_json(json_str)
202
+ match += 1
203
+ except (ValidationError, ValueError) as e:
204
+ error_messages.append(str(e))
205
+ # deserialize data into CompareTruth
206
+ try:
207
+ instance.actual_instance = CompareTruth.from_json(json_str)
208
+ match += 1
209
+ except (ValidationError, ValueError) as e:
210
+ error_messages.append(str(e))
211
+ # deserialize data into AttachCategoryTruth
212
+ try:
213
+ instance.actual_instance = AttachCategoryTruth.from_json(json_str)
214
+ match += 1
215
+ except (ValidationError, ValueError) as e:
216
+ error_messages.append(str(e))
217
+ # deserialize data into BoundingBoxTruth
218
+ try:
219
+ instance.actual_instance = BoundingBoxTruth.from_json(json_str)
220
+ match += 1
221
+ except (ValidationError, ValueError) as e:
222
+ error_messages.append(str(e))
223
+
224
+ if match > 1:
225
+ # more than 1 match
226
+ raise ValueError("Multiple matches found when deserializing the JSON string into QueryValidationRapidsResultTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
227
+ elif match == 0:
228
+ # no match
229
+ raise ValueError("No match found when deserializing the JSON string into QueryValidationRapidsResultTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
230
+ else:
231
+ return instance
232
+
233
+ def to_json(self) -> str:
234
+ """Returns the JSON representation of the actual instance"""
235
+ if self.actual_instance is None:
236
+ return "null"
237
+
238
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
239
+ return self.actual_instance.to_json()
240
+ else:
241
+ return json.dumps(self.actual_instance)
242
+
243
+ def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth]]:
244
+ """Returns the dict representation of the actual instance"""
245
+ if self.actual_instance is None:
246
+ return None
247
+
248
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
249
+ return self.actual_instance.to_dict()
250
+ else:
251
+ # primitive type
252
+ return self.actual_instance
253
+
254
+ def to_str(self) -> str:
255
+ """Returns the string representation of the actual instance"""
256
+ return pprint.pformat(self.model_dump())
257
+
258
+
@@ -25,13 +25,14 @@ from rapidata.api_client.models.line_result import LineResult
25
25
  from rapidata.api_client.models.locate_result import LocateResult
26
26
  from rapidata.api_client.models.named_entity_result import NamedEntityResult
27
27
  from rapidata.api_client.models.polygon_result import PolygonResult
28
+ from rapidata.api_client.models.scrub_result import ScrubResult
28
29
  from rapidata.api_client.models.skip_result import SkipResult
29
30
  from rapidata.api_client.models.transcription_result import TranscriptionResult
30
31
  from pydantic import StrictStr, Field
31
32
  from typing import Union, List, Set, Optional, Dict
32
33
  from typing_extensions import Literal, Self
33
34
 
34
- RAPIDANSWERRESULT_ONE_OF_SCHEMAS = ["AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "SkipResult", "TranscriptionResult"]
35
+ RAPIDANSWERRESULT_ONE_OF_SCHEMAS = ["AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "ScrubResult", "SkipResult", "TranscriptionResult"]
35
36
 
36
37
  class RapidAnswerResult(BaseModel):
37
38
  """
@@ -39,26 +40,28 @@ class RapidAnswerResult(BaseModel):
39
40
  """
40
41
  # data type: TranscriptionResult
41
42
  oneof_schema_1_validator: Optional[TranscriptionResult] = None
43
+ # data type: ScrubResult
44
+ oneof_schema_2_validator: Optional[ScrubResult] = None
42
45
  # data type: PolygonResult
43
- oneof_schema_2_validator: Optional[PolygonResult] = None
46
+ oneof_schema_3_validator: Optional[PolygonResult] = None
44
47
  # data type: NamedEntityResult
45
- oneof_schema_3_validator: Optional[NamedEntityResult] = None
48
+ oneof_schema_4_validator: Optional[NamedEntityResult] = None
46
49
  # data type: LocateResult
47
- oneof_schema_4_validator: Optional[LocateResult] = None
50
+ oneof_schema_5_validator: Optional[LocateResult] = None
48
51
  # data type: LineResult
49
- oneof_schema_5_validator: Optional[LineResult] = None
52
+ oneof_schema_6_validator: Optional[LineResult] = None
50
53
  # data type: FreeTextResult
51
- oneof_schema_6_validator: Optional[FreeTextResult] = None
54
+ oneof_schema_7_validator: Optional[FreeTextResult] = None
52
55
  # data type: CompareResult
53
- oneof_schema_7_validator: Optional[CompareResult] = None
56
+ oneof_schema_8_validator: Optional[CompareResult] = None
54
57
  # data type: SkipResult
55
- oneof_schema_8_validator: Optional[SkipResult] = None
58
+ oneof_schema_9_validator: Optional[SkipResult] = None
56
59
  # data type: AttachCategoryResult
57
- oneof_schema_9_validator: Optional[AttachCategoryResult] = None
60
+ oneof_schema_10_validator: Optional[AttachCategoryResult] = None
58
61
  # data type: BoundingBoxResult
59
- oneof_schema_10_validator: Optional[BoundingBoxResult] = None
60
- actual_instance: Optional[Union[AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult]] = None
61
- one_of_schemas: Set[str] = { "AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "SkipResult", "TranscriptionResult" }
62
+ oneof_schema_11_validator: Optional[BoundingBoxResult] = None
63
+ actual_instance: Optional[Union[AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult]] = None
64
+ one_of_schemas: Set[str] = { "AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "ScrubResult", "SkipResult", "TranscriptionResult" }
62
65
 
63
66
  model_config = ConfigDict(
64
67
  validate_assignment=True,
@@ -89,6 +92,11 @@ class RapidAnswerResult(BaseModel):
89
92
  error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionResult`")
90
93
  else:
91
94
  match += 1
95
+ # validate data type: ScrubResult
96
+ if not isinstance(v, ScrubResult):
97
+ error_messages.append(f"Error! Input type `{type(v)}` is not `ScrubResult`")
98
+ else:
99
+ match += 1
92
100
  # validate data type: PolygonResult
93
101
  if not isinstance(v, PolygonResult):
94
102
  error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonResult`")
@@ -136,10 +144,10 @@ class RapidAnswerResult(BaseModel):
136
144
  match += 1
137
145
  if match > 1:
138
146
  # more than 1 match
139
- raise ValueError("Multiple matches found when setting `actual_instance` in RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
147
+ raise ValueError("Multiple matches found when setting `actual_instance` in RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
140
148
  elif match == 0:
141
149
  # no match
142
- raise ValueError("No match found when setting `actual_instance` in RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
150
+ raise ValueError("No match found when setting `actual_instance` in RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
143
151
  else:
144
152
  return v
145
153
 
@@ -160,6 +168,12 @@ class RapidAnswerResult(BaseModel):
160
168
  match += 1
161
169
  except (ValidationError, ValueError) as e:
162
170
  error_messages.append(str(e))
171
+ # deserialize data into ScrubResult
172
+ try:
173
+ instance.actual_instance = ScrubResult.from_json(json_str)
174
+ match += 1
175
+ except (ValidationError, ValueError) as e:
176
+ error_messages.append(str(e))
163
177
  # deserialize data into PolygonResult
164
178
  try:
165
179
  instance.actual_instance = PolygonResult.from_json(json_str)
@@ -217,10 +231,10 @@ class RapidAnswerResult(BaseModel):
217
231
 
218
232
  if match > 1:
219
233
  # more than 1 match
220
- raise ValueError("Multiple matches found when deserializing the JSON string into RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
234
+ raise ValueError("Multiple matches found when deserializing the JSON string into RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
221
235
  elif match == 0:
222
236
  # no match
223
- raise ValueError("No match found when deserializing the JSON string into RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
237
+ raise ValueError("No match found when deserializing the JSON string into RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
224
238
  else:
225
239
  return instance
226
240
 
@@ -234,7 +248,7 @@ class RapidAnswerResult(BaseModel):
234
248
  else:
235
249
  return json.dumps(self.actual_instance)
236
250
 
237
- def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult]]:
251
+ def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult]]:
238
252
  """Returns the dict representation of the actual instance"""
239
253
  if self.actual_instance is None:
240
254
  return None
@@ -25,13 +25,14 @@ from rapidata.api_client.models.line_result import LineResult
25
25
  from rapidata.api_client.models.locate_result import LocateResult
26
26
  from rapidata.api_client.models.named_entity_result import NamedEntityResult
27
27
  from rapidata.api_client.models.polygon_result import PolygonResult
28
+ from rapidata.api_client.models.scrub_result import ScrubResult
28
29
  from rapidata.api_client.models.skip_result import SkipResult
29
30
  from rapidata.api_client.models.transcription_result import TranscriptionResult
30
31
  from pydantic import StrictStr, Field
31
32
  from typing import Union, List, Set, Optional, Dict
32
33
  from typing_extensions import Literal, Self
33
34
 
34
- RAPIDRESULTMODELRESULT_ONE_OF_SCHEMAS = ["AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "SkipResult", "TranscriptionResult"]
35
+ RAPIDRESULTMODELRESULT_ONE_OF_SCHEMAS = ["AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "ScrubResult", "SkipResult", "TranscriptionResult"]
35
36
 
36
37
  class RapidResultModelResult(BaseModel):
37
38
  """
@@ -39,26 +40,28 @@ class RapidResultModelResult(BaseModel):
39
40
  """
40
41
  # data type: TranscriptionResult
41
42
  oneof_schema_1_validator: Optional[TranscriptionResult] = None
43
+ # data type: ScrubResult
44
+ oneof_schema_2_validator: Optional[ScrubResult] = None
42
45
  # data type: PolygonResult
43
- oneof_schema_2_validator: Optional[PolygonResult] = None
46
+ oneof_schema_3_validator: Optional[PolygonResult] = None
44
47
  # data type: NamedEntityResult
45
- oneof_schema_3_validator: Optional[NamedEntityResult] = None
48
+ oneof_schema_4_validator: Optional[NamedEntityResult] = None
46
49
  # data type: LocateResult
47
- oneof_schema_4_validator: Optional[LocateResult] = None
50
+ oneof_schema_5_validator: Optional[LocateResult] = None
48
51
  # data type: LineResult
49
- oneof_schema_5_validator: Optional[LineResult] = None
52
+ oneof_schema_6_validator: Optional[LineResult] = None
50
53
  # data type: FreeTextResult
51
- oneof_schema_6_validator: Optional[FreeTextResult] = None
54
+ oneof_schema_7_validator: Optional[FreeTextResult] = None
52
55
  # data type: CompareResult
53
- oneof_schema_7_validator: Optional[CompareResult] = None
56
+ oneof_schema_8_validator: Optional[CompareResult] = None
54
57
  # data type: SkipResult
55
- oneof_schema_8_validator: Optional[SkipResult] = None
58
+ oneof_schema_9_validator: Optional[SkipResult] = None
56
59
  # data type: AttachCategoryResult
57
- oneof_schema_9_validator: Optional[AttachCategoryResult] = None
60
+ oneof_schema_10_validator: Optional[AttachCategoryResult] = None
58
61
  # data type: BoundingBoxResult
59
- oneof_schema_10_validator: Optional[BoundingBoxResult] = None
60
- actual_instance: Optional[Union[AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult]] = None
61
- one_of_schemas: Set[str] = { "AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "SkipResult", "TranscriptionResult" }
62
+ oneof_schema_11_validator: Optional[BoundingBoxResult] = None
63
+ actual_instance: Optional[Union[AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult]] = None
64
+ one_of_schemas: Set[str] = { "AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "ScrubResult", "SkipResult", "TranscriptionResult" }
62
65
 
63
66
  model_config = ConfigDict(
64
67
  validate_assignment=True,
@@ -89,6 +92,11 @@ class RapidResultModelResult(BaseModel):
89
92
  error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionResult`")
90
93
  else:
91
94
  match += 1
95
+ # validate data type: ScrubResult
96
+ if not isinstance(v, ScrubResult):
97
+ error_messages.append(f"Error! Input type `{type(v)}` is not `ScrubResult`")
98
+ else:
99
+ match += 1
92
100
  # validate data type: PolygonResult
93
101
  if not isinstance(v, PolygonResult):
94
102
  error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonResult`")
@@ -136,10 +144,10 @@ class RapidResultModelResult(BaseModel):
136
144
  match += 1
137
145
  if match > 1:
138
146
  # more than 1 match
139
- raise ValueError("Multiple matches found when setting `actual_instance` in RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
147
+ raise ValueError("Multiple matches found when setting `actual_instance` in RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
140
148
  elif match == 0:
141
149
  # no match
142
- raise ValueError("No match found when setting `actual_instance` in RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
150
+ raise ValueError("No match found when setting `actual_instance` in RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
143
151
  else:
144
152
  return v
145
153
 
@@ -160,6 +168,12 @@ class RapidResultModelResult(BaseModel):
160
168
  match += 1
161
169
  except (ValidationError, ValueError) as e:
162
170
  error_messages.append(str(e))
171
+ # deserialize data into ScrubResult
172
+ try:
173
+ instance.actual_instance = ScrubResult.from_json(json_str)
174
+ match += 1
175
+ except (ValidationError, ValueError) as e:
176
+ error_messages.append(str(e))
163
177
  # deserialize data into PolygonResult
164
178
  try:
165
179
  instance.actual_instance = PolygonResult.from_json(json_str)
@@ -217,10 +231,10 @@ class RapidResultModelResult(BaseModel):
217
231
 
218
232
  if match > 1:
219
233
  # more than 1 match
220
- raise ValueError("Multiple matches found when deserializing the JSON string into RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
234
+ raise ValueError("Multiple matches found when deserializing the JSON string into RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
221
235
  elif match == 0:
222
236
  # no match
223
- raise ValueError("No match found when deserializing the JSON string into RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
237
+ raise ValueError("No match found when deserializing the JSON string into RapidResultModelResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
224
238
  else:
225
239
  return instance
226
240
 
@@ -234,7 +248,7 @@ class RapidResultModelResult(BaseModel):
234
248
  else:
235
249
  return json.dumps(self.actual_instance)
236
250
 
237
- def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult]]:
251
+ def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, ScrubResult, SkipResult, TranscriptionResult]]:
238
252
  """Returns the dict representation of the actual instance"""
239
253
  if self.actual_instance is None:
240
254
  return None
@@ -0,0 +1,96 @@
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 ScrubPayload(BaseModel):
26
+ """
27
+ ScrubPayload
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for ScrubPayload", alias="_t")
30
+ target: StrictStr
31
+ __properties: ClassVar[List[str]] = ["_t", "target"]
32
+
33
+ @field_validator('t')
34
+ def t_validate_enum(cls, value):
35
+ """Validates the enum"""
36
+ if value not in set(['ScrubPayload']):
37
+ raise ValueError("must be one of enum values ('ScrubPayload')")
38
+ return value
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of ScrubPayload from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of ScrubPayload from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'ScrubPayload',
92
+ "target": obj.get("target")
93
+ })
94
+ return _obj
95
+
96
+