rapidata 1.10.1__py3-none-any.whl → 2.0.0__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 +21 -17
- rapidata/api_client/__init__.py +15 -5
- rapidata/api_client/api/coco_api.py +14 -29
- rapidata/api_client/api/dataset_api.py +6 -6
- rapidata/api_client/api/identity_api.py +3 -3
- rapidata/api_client/api/pipeline_api.py +1008 -95
- rapidata/api_client/api/rapid_api.py +6 -6
- rapidata/api_client/api/validation_api.py +12 -42
- rapidata/api_client/models/__init__.py +15 -5
- rapidata/api_client/models/add_campaign_model.py +1 -3
- rapidata/api_client/models/add_validation_text_rapid_model.py +1 -1
- rapidata/api_client/models/age_group.py +5 -4
- rapidata/api_client/models/base_error.py +1 -4
- rapidata/api_client/models/compare_workflow_config.py +9 -24
- rapidata/api_client/models/compare_workflow_config_model.py +9 -29
- rapidata/api_client/models/compare_workflow_config_model_pair_maker_config.py +140 -0
- rapidata/api_client/models/compare_workflow_config_pair_maker_config.py +140 -0
- rapidata/api_client/models/compare_workflow_model.py +7 -3
- rapidata/api_client/models/compare_workflow_model1.py +7 -3
- rapidata/api_client/models/compare_workflow_model1_pair_maker_information.py +140 -0
- rapidata/api_client/models/compare_workflow_model_pair_maker_config.py +140 -0
- rapidata/api_client/models/file_asset_model_metadata_inner.py +8 -22
- rapidata/api_client/models/get_classify_workflow_result_overview_result.py +144 -0
- rapidata/api_client/models/get_pipeline_by_id_result.py +13 -3
- rapidata/api_client/models/identity_read_bridge_token_get202_response.py +140 -0
- rapidata/api_client/models/not_available_yet_result.py +96 -0
- rapidata/api_client/models/online_pair_maker_config.py +98 -0
- rapidata/api_client/models/online_pair_maker_config_model.py +98 -0
- rapidata/api_client/models/online_pair_maker_information.py +100 -0
- rapidata/api_client/models/pipeline_id_workflow_put_request.py +140 -0
- rapidata/api_client/models/pre_arranged_pair_maker_config.py +100 -0
- rapidata/api_client/models/pre_arranged_pair_maker_config_model.py +96 -0
- rapidata/api_client/models/pre_arranged_pair_maker_information.py +102 -0
- rapidata/api_client/models/read_bridge_token_keys_result.py +11 -2
- rapidata/api_client/models/simple_workflow_config.py +7 -26
- rapidata/api_client/models/simple_workflow_config_model.py +4 -28
- rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +16 -16
- rapidata/api_client/models/simple_workflow_model1.py +3 -3
- rapidata/api_client/models/update_campaign_model.py +99 -0
- rapidata/api_client/models/validation_import_post_request_blueprint.py +1 -1
- rapidata/api_client_README.md +20 -7
- rapidata/rapidata_client/__init__.py +18 -9
- rapidata/rapidata_client/assets/__init__.py +5 -4
- rapidata/rapidata_client/assets/{media_asset.py → _media_asset.py} +32 -11
- rapidata/rapidata_client/assets/{multi_asset.py → _multi_asset.py} +1 -1
- rapidata/rapidata_client/assets/{text_asset.py → _text_asset.py} +1 -1
- rapidata/rapidata_client/assets/data_type_enum.py +7 -0
- rapidata/rapidata_client/filter/__init__.py +1 -1
- rapidata/rapidata_client/filter/_base_filter.py +10 -0
- rapidata/rapidata_client/filter/age_filter.py +12 -5
- rapidata/rapidata_client/filter/campaign_filter.py +12 -3
- rapidata/rapidata_client/filter/country_filter.py +10 -3
- rapidata/rapidata_client/filter/gender_filter.py +12 -5
- rapidata/rapidata_client/filter/language_filter.py +14 -3
- rapidata/rapidata_client/filter/models/age_group.py +26 -0
- rapidata/rapidata_client/filter/models/gender.py +19 -0
- rapidata/rapidata_client/filter/rapidata_filters.py +31 -0
- rapidata/rapidata_client/filter/user_score_filter.py +20 -4
- rapidata/rapidata_client/metadata/__init__.py +5 -5
- rapidata/rapidata_client/metadata/{base_metadata.py → _base_metadata.py} +2 -1
- rapidata/rapidata_client/metadata/{private_text_metadata.py → _private_text_metadata.py} +2 -2
- rapidata/rapidata_client/metadata/{prompt_metadata.py → _prompt_metadata.py} +3 -2
- rapidata/rapidata_client/metadata/{public_text_metadata.py → _public_text_metadata.py} +2 -2
- rapidata/rapidata_client/metadata/{select_words_metadata.py → _select_words_metadata.py} +3 -2
- rapidata/rapidata_client/{dataset/rapidata_dataset.py → order/_rapidata_dataset.py} +7 -8
- rapidata/rapidata_client/order/_rapidata_order_builder.py +365 -0
- rapidata/rapidata_client/order/rapidata_order.py +49 -31
- rapidata/rapidata_client/order/rapidata_order_manager.py +461 -0
- rapidata/rapidata_client/rapidata_client.py +12 -201
- rapidata/rapidata_client/referee/__init__.py +3 -3
- rapidata/rapidata_client/referee/{base_referee.py → _base_referee.py} +3 -3
- rapidata/rapidata_client/referee/{early_stopping_referee.py → _early_stopping_referee.py} +14 -11
- rapidata/rapidata_client/referee/{naive_referee.py → _naive_referee.py} +9 -9
- rapidata/rapidata_client/selection/__init__.py +1 -1
- rapidata/rapidata_client/{filter/base_filter.py → selection/_base_selection.py} +2 -2
- rapidata/rapidata_client/selection/capped_selection.py +15 -5
- rapidata/rapidata_client/selection/conditional_validation_selection.py +17 -4
- rapidata/rapidata_client/selection/demographic_selection.py +18 -7
- rapidata/rapidata_client/selection/labeling_selection.py +10 -3
- rapidata/rapidata_client/selection/rapidata_selections.py +21 -0
- rapidata/rapidata_client/selection/validation_selection.py +11 -4
- rapidata/rapidata_client/settings/__init__.py +9 -2
- rapidata/rapidata_client/settings/_rapidata_setting.py +11 -0
- rapidata/rapidata_client/settings/alert_on_fast_response.py +21 -0
- rapidata/rapidata_client/settings/custom_setting.py +16 -0
- rapidata/rapidata_client/settings/free_text_minimum_characters.py +16 -0
- rapidata/rapidata_client/settings/models/__init__.py +1 -0
- rapidata/rapidata_client/settings/models/translation_behaviour_options.py +14 -0
- rapidata/rapidata_client/settings/no_shuffle.py +16 -0
- rapidata/rapidata_client/settings/play_video_until_the_end.py +16 -0
- rapidata/rapidata_client/settings/rapidata_settings.py +31 -0
- rapidata/rapidata_client/settings/translation_behaviour.py +18 -0
- rapidata/rapidata_client/validation/__init__.py +1 -0
- rapidata/rapidata_client/{dataset/validation_rapid_parts.py → validation/_validation_rapid_parts.py} +7 -6
- rapidata/rapidata_client/validation/_validation_set_builder.py +371 -0
- rapidata/rapidata_client/{dataset → validation}/rapidata_validation_set.py +54 -50
- rapidata/rapidata_client/validation/rapids/__init__.py +1 -0
- rapidata/rapidata_client/validation/rapids/box.py +17 -0
- rapidata/rapidata_client/validation/rapids/rapids.py +94 -0
- rapidata/rapidata_client/validation/rapids/rapids_manager.py +163 -0
- rapidata/rapidata_client/validation/validation_set_manager.py +335 -0
- rapidata/rapidata_client/workflow/__init__.py +8 -6
- rapidata/rapidata_client/workflow/_base_workflow.py +25 -0
- rapidata/rapidata_client/workflow/{classify_workflow.py → _classify_workflow.py} +6 -6
- rapidata/rapidata_client/workflow/{compare_workflow.py → _compare_workflow.py} +10 -16
- rapidata/rapidata_client/workflow/_draw_workflow.py +22 -0
- rapidata/rapidata_client/workflow/_evaluation_workflow.py +26 -0
- rapidata/rapidata_client/workflow/{free_text_workflow.py → _free_text_workflow.py} +10 -16
- rapidata/rapidata_client/workflow/_locate_workflow.py +22 -0
- rapidata/rapidata_client/workflow/{select_words_workflow.py → _select_words_workflow.py} +2 -8
- rapidata/service/credential_manager.py +11 -1
- rapidata/service/openapi_service.py +23 -4
- {rapidata-1.10.1.dist-info → rapidata-2.0.0.dist-info}/METADATA +2 -1
- {rapidata-1.10.1.dist-info → rapidata-2.0.0.dist-info}/RECORD +118 -94
- rapidata/constants.py +0 -1
- rapidata/rapidata_client/dataset/rapid_builders/__init__.py +0 -4
- rapidata/rapidata_client/dataset/rapid_builders/base_rapid_builder.py +0 -33
- rapidata/rapidata_client/dataset/rapid_builders/classify_rapid_builders.py +0 -166
- rapidata/rapidata_client/dataset/rapid_builders/compare_rapid_builders.py +0 -145
- rapidata/rapidata_client/dataset/rapid_builders/rapids.py +0 -33
- rapidata/rapidata_client/dataset/rapid_builders/select_words_rapid_builders.py +0 -124
- rapidata/rapidata_client/dataset/validation_set_builder.py +0 -336
- rapidata/rapidata_client/order/order_builder.py +0 -25
- rapidata/rapidata_client/order/rapidata_order_builder.py +0 -463
- rapidata/rapidata_client/selection/base_selection.py +0 -9
- rapidata/rapidata_client/settings/feature_flags.py +0 -125
- rapidata/rapidata_client/settings/settings.py +0 -124
- rapidata/rapidata_client/simple_builders/__init__.py +0 -0
- rapidata/rapidata_client/simple_builders/simple_classification_builders.py +0 -271
- rapidata/rapidata_client/simple_builders/simple_compare_builders.py +0 -267
- rapidata/rapidata_client/simple_builders/simple_free_text_builders.py +0 -192
- rapidata/rapidata_client/simple_builders/simple_select_words_builders.py +0 -196
- rapidata/rapidata_client/workflow/base_workflow.py +0 -42
- rapidata/rapidata_client/workflow/evaluation_workflow.py +0 -15
- /rapidata/rapidata_client/assets/{base_asset.py → _base_asset.py} +0 -0
- /rapidata/rapidata_client/{dataset → filter/models}/__init__.py +0 -0
- {rapidata-1.10.1.dist-info → rapidata-2.0.0.dist-info}/LICENSE +0 -0
- {rapidata-1.10.1.dist-info → rapidata-2.0.0.dist-info}/WHEEL +0 -0
|
@@ -26,12 +26,11 @@ from rapidata.api_client.models.original_filename_metadata_model import Original
|
|
|
26
26
|
from rapidata.api_client.models.prompt_metadata_model import PromptMetadataModel
|
|
27
27
|
from rapidata.api_client.models.text_metadata_model import TextMetadataModel
|
|
28
28
|
from rapidata.api_client.models.transcription_metadata_model import TranscriptionMetadataModel
|
|
29
|
-
from rapidata.api_client.models.translated_prompt_metadata_model import TranslatedPromptMetadataModel
|
|
30
29
|
from pydantic import StrictStr, Field
|
|
31
30
|
from typing import Union, List, Set, Optional, Dict
|
|
32
31
|
from typing_extensions import Literal, Self
|
|
33
32
|
|
|
34
|
-
FILEASSETMODELMETADATAINNER_ONE_OF_SCHEMAS = ["ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel"
|
|
33
|
+
FILEASSETMODELMETADATAINNER_ONE_OF_SCHEMAS = ["ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel"]
|
|
35
34
|
|
|
36
35
|
class FileAssetModelMetadataInner(BaseModel):
|
|
37
36
|
"""
|
|
@@ -55,10 +54,8 @@ class FileAssetModelMetadataInner(BaseModel):
|
|
|
55
54
|
oneof_schema_8_validator: Optional[TextMetadataModel] = None
|
|
56
55
|
# data type: TranscriptionMetadataModel
|
|
57
56
|
oneof_schema_9_validator: Optional[TranscriptionMetadataModel] = None
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
actual_instance: Optional[Union[ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel]] = None
|
|
61
|
-
one_of_schemas: Set[str] = { "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel" }
|
|
57
|
+
actual_instance: Optional[Union[ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel]] = None
|
|
58
|
+
one_of_schemas: Set[str] = { "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel" }
|
|
62
59
|
|
|
63
60
|
model_config = ConfigDict(
|
|
64
61
|
validate_assignment=True,
|
|
@@ -129,17 +126,12 @@ class FileAssetModelMetadataInner(BaseModel):
|
|
|
129
126
|
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionMetadataModel`")
|
|
130
127
|
else:
|
|
131
128
|
match += 1
|
|
132
|
-
# validate data type: TranslatedPromptMetadataModel
|
|
133
|
-
if not isinstance(v, TranslatedPromptMetadataModel):
|
|
134
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `TranslatedPromptMetadataModel`")
|
|
135
|
-
else:
|
|
136
|
-
match += 1
|
|
137
129
|
if match > 1:
|
|
138
130
|
# more than 1 match
|
|
139
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel
|
|
131
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel. Details: " + ", ".join(error_messages))
|
|
140
132
|
elif match == 0:
|
|
141
133
|
# no match
|
|
142
|
-
raise ValueError("No match found when setting `actual_instance` in FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel
|
|
134
|
+
raise ValueError("No match found when setting `actual_instance` in FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel. Details: " + ", ".join(error_messages))
|
|
143
135
|
else:
|
|
144
136
|
return v
|
|
145
137
|
|
|
@@ -208,19 +200,13 @@ class FileAssetModelMetadataInner(BaseModel):
|
|
|
208
200
|
match += 1
|
|
209
201
|
except (ValidationError, ValueError) as e:
|
|
210
202
|
error_messages.append(str(e))
|
|
211
|
-
# deserialize data into TranslatedPromptMetadataModel
|
|
212
|
-
try:
|
|
213
|
-
instance.actual_instance = TranslatedPromptMetadataModel.from_json(json_str)
|
|
214
|
-
match += 1
|
|
215
|
-
except (ValidationError, ValueError) as e:
|
|
216
|
-
error_messages.append(str(e))
|
|
217
203
|
|
|
218
204
|
if match > 1:
|
|
219
205
|
# more than 1 match
|
|
220
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel
|
|
206
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel. Details: " + ", ".join(error_messages))
|
|
221
207
|
elif match == 0:
|
|
222
208
|
# no match
|
|
223
|
-
raise ValueError("No match found when deserializing the JSON string into FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel
|
|
209
|
+
raise ValueError("No match found when deserializing the JSON string into FileAssetModelMetadataInner with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel. Details: " + ", ".join(error_messages))
|
|
224
210
|
else:
|
|
225
211
|
return instance
|
|
226
212
|
|
|
@@ -234,7 +220,7 @@ class FileAssetModelMetadataInner(BaseModel):
|
|
|
234
220
|
else:
|
|
235
221
|
return json.dumps(self.actual_instance)
|
|
236
222
|
|
|
237
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel
|
|
223
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, TextMetadataModel, TranscriptionMetadataModel]]:
|
|
238
224
|
"""Returns the dict representation of the actual instance"""
|
|
239
225
|
if self.actual_instance is None:
|
|
240
226
|
return None
|
|
@@ -0,0 +1,144 @@
|
|
|
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, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.completed_rapid_model import CompletedRapidModel
|
|
23
|
+
from rapidata.api_client.models.get_workflow_progress_result import GetWorkflowProgressResult
|
|
24
|
+
from rapidata.api_client.models.in_progress_rapid_model import InProgressRapidModel
|
|
25
|
+
from rapidata.api_client.models.not_started_rapid_model import NotStartedRapidModel
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
|
|
29
|
+
class GetClassifyWorkflowResultOverviewResult(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
GetClassifyWorkflowResultOverviewResult
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
state: StrictStr
|
|
34
|
+
progress: GetWorkflowProgressResult
|
|
35
|
+
rapid_type: StrictStr = Field(alias="rapidType")
|
|
36
|
+
not_started_rapids: List[NotStartedRapidModel] = Field(alias="notStartedRapids")
|
|
37
|
+
hidden_not_started_count: StrictInt = Field(alias="hiddenNotStartedCount")
|
|
38
|
+
in_progress_rapids: List[InProgressRapidModel] = Field(alias="inProgressRapids")
|
|
39
|
+
hidden_in_progress_rapids_count: StrictInt = Field(alias="hiddenInProgressRapidsCount")
|
|
40
|
+
completed_rapids: List[CompletedRapidModel] = Field(alias="completedRapids")
|
|
41
|
+
hidden_completed_rapids_count: StrictInt = Field(alias="hiddenCompletedRapidsCount")
|
|
42
|
+
result_type: Optional[StrictStr] = Field(default=None, alias="resultType")
|
|
43
|
+
occurrences_by_category: Dict[str, StrictInt] = Field(alias="occurrencesByCategory")
|
|
44
|
+
__properties: ClassVar[List[str]] = ["state", "progress", "rapidType", "notStartedRapids", "hiddenNotStartedCount", "inProgressRapids", "hiddenInProgressRapidsCount", "completedRapids", "hiddenCompletedRapidsCount", "resultType", "occurrencesByCategory"]
|
|
45
|
+
|
|
46
|
+
@field_validator('state')
|
|
47
|
+
def state_validate_enum(cls, value):
|
|
48
|
+
"""Validates the enum"""
|
|
49
|
+
if value not in set(['Created', 'Started', 'Labeling', 'Paused', 'Done', 'Failed']):
|
|
50
|
+
raise ValueError("must be one of enum values ('Created', 'Started', 'Labeling', 'Paused', 'Done', 'Failed')")
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
populate_by_name=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def to_str(self) -> str:
|
|
61
|
+
"""Returns the string representation of the model using alias"""
|
|
62
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
63
|
+
|
|
64
|
+
def to_json(self) -> str:
|
|
65
|
+
"""Returns the JSON representation of the model using alias"""
|
|
66
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
67
|
+
return json.dumps(self.to_dict())
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
71
|
+
"""Create an instance of GetClassifyWorkflowResultOverviewResult from a JSON string"""
|
|
72
|
+
return cls.from_dict(json.loads(json_str))
|
|
73
|
+
|
|
74
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
75
|
+
"""Return the dictionary representation of the model using alias.
|
|
76
|
+
|
|
77
|
+
This has the following differences from calling pydantic's
|
|
78
|
+
`self.model_dump(by_alias=True)`:
|
|
79
|
+
|
|
80
|
+
* `None` is only added to the output dict for nullable fields that
|
|
81
|
+
were set at model initialization. Other fields with value `None`
|
|
82
|
+
are ignored.
|
|
83
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
84
|
+
"""
|
|
85
|
+
excluded_fields: Set[str] = set([
|
|
86
|
+
"result_type",
|
|
87
|
+
])
|
|
88
|
+
|
|
89
|
+
_dict = self.model_dump(
|
|
90
|
+
by_alias=True,
|
|
91
|
+
exclude=excluded_fields,
|
|
92
|
+
exclude_none=True,
|
|
93
|
+
)
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of progress
|
|
95
|
+
if self.progress:
|
|
96
|
+
_dict['progress'] = self.progress.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of each item in not_started_rapids (list)
|
|
98
|
+
_items = []
|
|
99
|
+
if self.not_started_rapids:
|
|
100
|
+
for _item_not_started_rapids in self.not_started_rapids:
|
|
101
|
+
if _item_not_started_rapids:
|
|
102
|
+
_items.append(_item_not_started_rapids.to_dict())
|
|
103
|
+
_dict['notStartedRapids'] = _items
|
|
104
|
+
# override the default output from pydantic by calling `to_dict()` of each item in in_progress_rapids (list)
|
|
105
|
+
_items = []
|
|
106
|
+
if self.in_progress_rapids:
|
|
107
|
+
for _item_in_progress_rapids in self.in_progress_rapids:
|
|
108
|
+
if _item_in_progress_rapids:
|
|
109
|
+
_items.append(_item_in_progress_rapids.to_dict())
|
|
110
|
+
_dict['inProgressRapids'] = _items
|
|
111
|
+
# override the default output from pydantic by calling `to_dict()` of each item in completed_rapids (list)
|
|
112
|
+
_items = []
|
|
113
|
+
if self.completed_rapids:
|
|
114
|
+
for _item_completed_rapids in self.completed_rapids:
|
|
115
|
+
if _item_completed_rapids:
|
|
116
|
+
_items.append(_item_completed_rapids.to_dict())
|
|
117
|
+
_dict['completedRapids'] = _items
|
|
118
|
+
return _dict
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
122
|
+
"""Create an instance of GetClassifyWorkflowResultOverviewResult from a dict"""
|
|
123
|
+
if obj is None:
|
|
124
|
+
return None
|
|
125
|
+
|
|
126
|
+
if not isinstance(obj, dict):
|
|
127
|
+
return cls.model_validate(obj)
|
|
128
|
+
|
|
129
|
+
_obj = cls.model_validate({
|
|
130
|
+
"state": obj.get("state"),
|
|
131
|
+
"progress": GetWorkflowProgressResult.from_dict(obj["progress"]) if obj.get("progress") is not None else None,
|
|
132
|
+
"rapidType": obj.get("rapidType"),
|
|
133
|
+
"notStartedRapids": [NotStartedRapidModel.from_dict(_item) for _item in obj["notStartedRapids"]] if obj.get("notStartedRapids") is not None else None,
|
|
134
|
+
"hiddenNotStartedCount": obj.get("hiddenNotStartedCount"),
|
|
135
|
+
"inProgressRapids": [InProgressRapidModel.from_dict(_item) for _item in obj["inProgressRapids"]] if obj.get("inProgressRapids") is not None else None,
|
|
136
|
+
"hiddenInProgressRapidsCount": obj.get("hiddenInProgressRapidsCount"),
|
|
137
|
+
"completedRapids": [CompletedRapidModel.from_dict(_item) for _item in obj["completedRapids"]] if obj.get("completedRapids") is not None else None,
|
|
138
|
+
"hiddenCompletedRapidsCount": obj.get("hiddenCompletedRapidsCount"),
|
|
139
|
+
"resultType": obj.get("resultType"),
|
|
140
|
+
"occurrencesByCategory": obj.get("occurrencesByCategory")
|
|
141
|
+
})
|
|
142
|
+
return _obj
|
|
143
|
+
|
|
144
|
+
|
|
@@ -17,8 +17,9 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
22
23
|
from rapidata.api_client.models.get_pipeline_by_id_result_artifacts_value import GetPipelineByIdResultArtifactsValue
|
|
23
24
|
from typing import Optional, Set
|
|
24
25
|
from typing_extensions import Self
|
|
@@ -28,7 +29,8 @@ class GetPipelineByIdResult(BaseModel):
|
|
|
28
29
|
GetPipelineByIdResult
|
|
29
30
|
""" # noqa: E501
|
|
30
31
|
artifacts: Dict[str, GetPipelineByIdResultArtifactsValue]
|
|
31
|
-
|
|
32
|
+
feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["artifacts", "featureFlags"]
|
|
32
34
|
|
|
33
35
|
model_config = ConfigDict(
|
|
34
36
|
populate_by_name=True,
|
|
@@ -76,6 +78,13 @@ class GetPipelineByIdResult(BaseModel):
|
|
|
76
78
|
if self.artifacts[_key_artifacts]:
|
|
77
79
|
_field_dict[_key_artifacts] = self.artifacts[_key_artifacts].to_dict()
|
|
78
80
|
_dict['artifacts'] = _field_dict
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
|
|
82
|
+
_items = []
|
|
83
|
+
if self.feature_flags:
|
|
84
|
+
for _item_feature_flags in self.feature_flags:
|
|
85
|
+
if _item_feature_flags:
|
|
86
|
+
_items.append(_item_feature_flags.to_dict())
|
|
87
|
+
_dict['featureFlags'] = _items
|
|
79
88
|
return _dict
|
|
80
89
|
|
|
81
90
|
@classmethod
|
|
@@ -93,7 +102,8 @@ class GetPipelineByIdResult(BaseModel):
|
|
|
93
102
|
for _k, _v in obj["artifacts"].items()
|
|
94
103
|
)
|
|
95
104
|
if obj.get("artifacts") is not None
|
|
96
|
-
else None
|
|
105
|
+
else None,
|
|
106
|
+
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
|
|
97
107
|
})
|
|
98
108
|
return _obj
|
|
99
109
|
|
|
@@ -0,0 +1,140 @@
|
|
|
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, Dict, List, Optional
|
|
20
|
+
from rapidata.api_client.models.not_available_yet_result import NotAvailableYetResult
|
|
21
|
+
from pydantic import StrictStr, Field
|
|
22
|
+
from typing import Union, List, Set, Optional, Dict
|
|
23
|
+
from typing_extensions import Literal, Self
|
|
24
|
+
|
|
25
|
+
IDENTITYREADBRIDGETOKENGET202RESPONSE_ONE_OF_SCHEMAS = ["NotAvailableYetResult", "object"]
|
|
26
|
+
|
|
27
|
+
class IdentityReadBridgeTokenGet202Response(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
IdentityReadBridgeTokenGet202Response
|
|
30
|
+
"""
|
|
31
|
+
# data type: NotAvailableYetResult
|
|
32
|
+
oneof_schema_1_validator: Optional[NotAvailableYetResult] = None
|
|
33
|
+
# data type: object
|
|
34
|
+
oneof_schema_2_validator: Optional[Dict[str, Any]] = None
|
|
35
|
+
actual_instance: Optional[Union[NotAvailableYetResult, object]] = None
|
|
36
|
+
one_of_schemas: Set[str] = { "NotAvailableYetResult", "object" }
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
45
|
+
if args:
|
|
46
|
+
if len(args) > 1:
|
|
47
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
48
|
+
if kwargs:
|
|
49
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
50
|
+
super().__init__(actual_instance=args[0])
|
|
51
|
+
else:
|
|
52
|
+
super().__init__(**kwargs)
|
|
53
|
+
|
|
54
|
+
@field_validator('actual_instance')
|
|
55
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
56
|
+
instance = IdentityReadBridgeTokenGet202Response.model_construct()
|
|
57
|
+
error_messages = []
|
|
58
|
+
match = 0
|
|
59
|
+
# validate data type: NotAvailableYetResult
|
|
60
|
+
if not isinstance(v, NotAvailableYetResult):
|
|
61
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NotAvailableYetResult`")
|
|
62
|
+
else:
|
|
63
|
+
match += 1
|
|
64
|
+
# validate data type: object
|
|
65
|
+
try:
|
|
66
|
+
instance.oneof_schema_2_validator = v
|
|
67
|
+
match += 1
|
|
68
|
+
except (ValidationError, ValueError) as e:
|
|
69
|
+
error_messages.append(str(e))
|
|
70
|
+
if match > 1:
|
|
71
|
+
# more than 1 match
|
|
72
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in IdentityReadBridgeTokenGet202Response with oneOf schemas: NotAvailableYetResult, object. Details: " + ", ".join(error_messages))
|
|
73
|
+
elif match == 0:
|
|
74
|
+
# no match
|
|
75
|
+
raise ValueError("No match found when setting `actual_instance` in IdentityReadBridgeTokenGet202Response with oneOf schemas: NotAvailableYetResult, object. Details: " + ", ".join(error_messages))
|
|
76
|
+
else:
|
|
77
|
+
return v
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
81
|
+
return cls.from_json(json.dumps(obj))
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_json(cls, json_str: str) -> Self:
|
|
85
|
+
"""Returns the object represented by the json string"""
|
|
86
|
+
instance = cls.model_construct()
|
|
87
|
+
error_messages = []
|
|
88
|
+
match = 0
|
|
89
|
+
|
|
90
|
+
# deserialize data into NotAvailableYetResult
|
|
91
|
+
try:
|
|
92
|
+
instance.actual_instance = NotAvailableYetResult.from_json(json_str)
|
|
93
|
+
match += 1
|
|
94
|
+
except (ValidationError, ValueError) as e:
|
|
95
|
+
error_messages.append(str(e))
|
|
96
|
+
# deserialize data into object
|
|
97
|
+
try:
|
|
98
|
+
# validation
|
|
99
|
+
instance.oneof_schema_2_validator = json.loads(json_str)
|
|
100
|
+
# assign value to actual_instance
|
|
101
|
+
instance.actual_instance = instance.oneof_schema_2_validator
|
|
102
|
+
match += 1
|
|
103
|
+
except (ValidationError, ValueError) as e:
|
|
104
|
+
error_messages.append(str(e))
|
|
105
|
+
|
|
106
|
+
if match > 1:
|
|
107
|
+
# more than 1 match
|
|
108
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into IdentityReadBridgeTokenGet202Response with oneOf schemas: NotAvailableYetResult, object. Details: " + ", ".join(error_messages))
|
|
109
|
+
elif match == 0:
|
|
110
|
+
# no match
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into IdentityReadBridgeTokenGet202Response with oneOf schemas: NotAvailableYetResult, object. Details: " + ", ".join(error_messages))
|
|
112
|
+
else:
|
|
113
|
+
return instance
|
|
114
|
+
|
|
115
|
+
def to_json(self) -> str:
|
|
116
|
+
"""Returns the JSON representation of the actual instance"""
|
|
117
|
+
if self.actual_instance is None:
|
|
118
|
+
return "null"
|
|
119
|
+
|
|
120
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
121
|
+
return self.actual_instance.to_json()
|
|
122
|
+
else:
|
|
123
|
+
return json.dumps(self.actual_instance)
|
|
124
|
+
|
|
125
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], NotAvailableYetResult, object]]:
|
|
126
|
+
"""Returns the dict representation of the actual instance"""
|
|
127
|
+
if self.actual_instance is None:
|
|
128
|
+
return None
|
|
129
|
+
|
|
130
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
131
|
+
return self.actual_instance.to_dict()
|
|
132
|
+
else:
|
|
133
|
+
# primitive type
|
|
134
|
+
return self.actual_instance
|
|
135
|
+
|
|
136
|
+
def to_str(self) -> str:
|
|
137
|
+
"""Returns the string representation of the actual instance"""
|
|
138
|
+
return pprint.pformat(self.model_dump())
|
|
139
|
+
|
|
140
|
+
|
|
@@ -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 NotAvailableYetResult(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
NotAvailableYetResult
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for NotAvailableYetResult", alias="_t")
|
|
30
|
+
message: StrictStr
|
|
31
|
+
__properties: ClassVar[List[str]] = ["_t", "message"]
|
|
32
|
+
|
|
33
|
+
@field_validator('t')
|
|
34
|
+
def t_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in set(['NotAvailableYetResult']):
|
|
37
|
+
raise ValueError("must be one of enum values ('NotAvailableYetResult')")
|
|
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 NotAvailableYetResult 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 NotAvailableYetResult 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 'NotAvailableYetResult',
|
|
92
|
+
"message": obj.get("message")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -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, StrictFloat, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class OnlinePairMakerConfig(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
OnlinePairMakerConfig
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for OnlinePairMakerConfig", alias="_t")
|
|
30
|
+
random_matches_ratio: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="randomMatchesRatio")
|
|
31
|
+
total_comparison_budget: Optional[StrictInt] = Field(default=None, alias="totalComparisonBudget")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "randomMatchesRatio", "totalComparisonBudget"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['OnlinePairMakerConfig']):
|
|
38
|
+
raise ValueError("must be one of enum values ('OnlinePairMakerConfig')")
|
|
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 OnlinePairMakerConfig 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 OnlinePairMakerConfig 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 'OnlinePairMakerConfig',
|
|
93
|
+
"randomMatchesRatio": obj.get("randomMatchesRatio"),
|
|
94
|
+
"totalComparisonBudget": obj.get("totalComparisonBudget")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|