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
|
@@ -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, List, Optional
|
|
20
|
+
from rapidata.api_client.models.online_pair_maker_config import OnlinePairMakerConfig
|
|
21
|
+
from rapidata.api_client.models.pre_arranged_pair_maker_config import PreArrangedPairMakerConfig
|
|
22
|
+
from pydantic import StrictStr, Field
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
|
|
26
|
+
COMPAREWORKFLOWCONFIGMODELPAIRMAKERCONFIG_ONE_OF_SCHEMAS = ["OnlinePairMakerConfig", "PreArrangedPairMakerConfig"]
|
|
27
|
+
|
|
28
|
+
class CompareWorkflowConfigModelPairMakerConfig(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
The PairMaker Algorithm's config that is used for making matchups
|
|
31
|
+
"""
|
|
32
|
+
# data type: OnlinePairMakerConfig
|
|
33
|
+
oneof_schema_1_validator: Optional[OnlinePairMakerConfig] = None
|
|
34
|
+
# data type: PreArrangedPairMakerConfig
|
|
35
|
+
oneof_schema_2_validator: Optional[PreArrangedPairMakerConfig] = None
|
|
36
|
+
actual_instance: Optional[Union[OnlinePairMakerConfig, PreArrangedPairMakerConfig]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "OnlinePairMakerConfig", "PreArrangedPairMakerConfig" }
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
49
|
+
if args:
|
|
50
|
+
if len(args) > 1:
|
|
51
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
52
|
+
if kwargs:
|
|
53
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
54
|
+
super().__init__(actual_instance=args[0])
|
|
55
|
+
else:
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
|
|
58
|
+
@field_validator('actual_instance')
|
|
59
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
60
|
+
instance = CompareWorkflowConfigModelPairMakerConfig.model_construct()
|
|
61
|
+
error_messages = []
|
|
62
|
+
match = 0
|
|
63
|
+
# validate data type: OnlinePairMakerConfig
|
|
64
|
+
if not isinstance(v, OnlinePairMakerConfig):
|
|
65
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OnlinePairMakerConfig`")
|
|
66
|
+
else:
|
|
67
|
+
match += 1
|
|
68
|
+
# validate data type: PreArrangedPairMakerConfig
|
|
69
|
+
if not isinstance(v, PreArrangedPairMakerConfig):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PreArrangedPairMakerConfig`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
73
|
+
if match > 1:
|
|
74
|
+
# more than 1 match
|
|
75
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowConfigModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. Details: " + ", ".join(error_messages))
|
|
76
|
+
elif match == 0:
|
|
77
|
+
# no match
|
|
78
|
+
raise ValueError("No match found when setting `actual_instance` in CompareWorkflowConfigModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. Details: " + ", ".join(error_messages))
|
|
79
|
+
else:
|
|
80
|
+
return v
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
84
|
+
return cls.from_json(json.dumps(obj))
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_json(cls, json_str: str) -> Self:
|
|
88
|
+
"""Returns the object represented by the json string"""
|
|
89
|
+
instance = cls.model_construct()
|
|
90
|
+
error_messages = []
|
|
91
|
+
match = 0
|
|
92
|
+
|
|
93
|
+
# deserialize data into OnlinePairMakerConfig
|
|
94
|
+
try:
|
|
95
|
+
instance.actual_instance = OnlinePairMakerConfig.from_json(json_str)
|
|
96
|
+
match += 1
|
|
97
|
+
except (ValidationError, ValueError) as e:
|
|
98
|
+
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into PreArrangedPairMakerConfig
|
|
100
|
+
try:
|
|
101
|
+
instance.actual_instance = PreArrangedPairMakerConfig.from_json(json_str)
|
|
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 CompareWorkflowConfigModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. Details: " + ", ".join(error_messages))
|
|
109
|
+
elif match == 0:
|
|
110
|
+
# no match
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into CompareWorkflowConfigModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. 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], OnlinePairMakerConfig, PreArrangedPairMakerConfig]]:
|
|
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,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, List, Optional
|
|
20
|
+
from rapidata.api_client.models.online_pair_maker_config import OnlinePairMakerConfig
|
|
21
|
+
from rapidata.api_client.models.pre_arranged_pair_maker_config import PreArrangedPairMakerConfig
|
|
22
|
+
from pydantic import StrictStr, Field
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
|
|
26
|
+
COMPAREWORKFLOWCONFIGPAIRMAKERCONFIG_ONE_OF_SCHEMAS = ["OnlinePairMakerConfig", "PreArrangedPairMakerConfig"]
|
|
27
|
+
|
|
28
|
+
class CompareWorkflowConfigPairMakerConfig(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
CompareWorkflowConfigPairMakerConfig
|
|
31
|
+
"""
|
|
32
|
+
# data type: OnlinePairMakerConfig
|
|
33
|
+
oneof_schema_1_validator: Optional[OnlinePairMakerConfig] = None
|
|
34
|
+
# data type: PreArrangedPairMakerConfig
|
|
35
|
+
oneof_schema_2_validator: Optional[PreArrangedPairMakerConfig] = None
|
|
36
|
+
actual_instance: Optional[Union[OnlinePairMakerConfig, PreArrangedPairMakerConfig]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "OnlinePairMakerConfig", "PreArrangedPairMakerConfig" }
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
49
|
+
if args:
|
|
50
|
+
if len(args) > 1:
|
|
51
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
52
|
+
if kwargs:
|
|
53
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
54
|
+
super().__init__(actual_instance=args[0])
|
|
55
|
+
else:
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
|
|
58
|
+
@field_validator('actual_instance')
|
|
59
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
60
|
+
instance = CompareWorkflowConfigPairMakerConfig.model_construct()
|
|
61
|
+
error_messages = []
|
|
62
|
+
match = 0
|
|
63
|
+
# validate data type: OnlinePairMakerConfig
|
|
64
|
+
if not isinstance(v, OnlinePairMakerConfig):
|
|
65
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OnlinePairMakerConfig`")
|
|
66
|
+
else:
|
|
67
|
+
match += 1
|
|
68
|
+
# validate data type: PreArrangedPairMakerConfig
|
|
69
|
+
if not isinstance(v, PreArrangedPairMakerConfig):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PreArrangedPairMakerConfig`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
73
|
+
if match > 1:
|
|
74
|
+
# more than 1 match
|
|
75
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowConfigPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. Details: " + ", ".join(error_messages))
|
|
76
|
+
elif match == 0:
|
|
77
|
+
# no match
|
|
78
|
+
raise ValueError("No match found when setting `actual_instance` in CompareWorkflowConfigPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. Details: " + ", ".join(error_messages))
|
|
79
|
+
else:
|
|
80
|
+
return v
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
84
|
+
return cls.from_json(json.dumps(obj))
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_json(cls, json_str: str) -> Self:
|
|
88
|
+
"""Returns the object represented by the json string"""
|
|
89
|
+
instance = cls.model_construct()
|
|
90
|
+
error_messages = []
|
|
91
|
+
match = 0
|
|
92
|
+
|
|
93
|
+
# deserialize data into OnlinePairMakerConfig
|
|
94
|
+
try:
|
|
95
|
+
instance.actual_instance = OnlinePairMakerConfig.from_json(json_str)
|
|
96
|
+
match += 1
|
|
97
|
+
except (ValidationError, ValueError) as e:
|
|
98
|
+
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into PreArrangedPairMakerConfig
|
|
100
|
+
try:
|
|
101
|
+
instance.actual_instance = PreArrangedPairMakerConfig.from_json(json_str)
|
|
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 CompareWorkflowConfigPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. Details: " + ", ".join(error_messages))
|
|
109
|
+
elif match == 0:
|
|
110
|
+
# no match
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into CompareWorkflowConfigPairMakerConfig with oneOf schemas: OnlinePairMakerConfig, PreArrangedPairMakerConfig. 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], OnlinePairMakerConfig, PreArrangedPairMakerConfig]]:
|
|
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
|
+
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.compare_workflow_model_pair_maker_config import CompareWorkflowModelPairMakerConfig
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -30,10 +31,10 @@ class CompareWorkflowModel(BaseModel):
|
|
|
30
31
|
criteria: StrictStr = Field(description="The criteria that the datapoints should be compared based on. No default value.")
|
|
31
32
|
starting_elo: Optional[StrictInt] = Field(default=None, description="The Starting Elo is the Elo that all datapoints will start with. Default is usually between 1200-1500.", alias="startingElo")
|
|
32
33
|
k_factor: Optional[StrictInt] = Field(default=None, description="The KFactor is used to calculate the Elo change after each match. Per default this is between 20 and 40.", alias="kFactor")
|
|
33
|
-
|
|
34
|
+
pair_maker_config: Optional[CompareWorkflowModelPairMakerConfig] = Field(default=None, alias="pairMakerConfig")
|
|
34
35
|
scaling_factor: Optional[StrictInt] = Field(default=None, description="The ScalingFactor is used to calculate the expected outcome before a match. Per default this is 400.", alias="scalingFactor")
|
|
35
36
|
matches_until_completed: Optional[StrictInt] = Field(default=None, description="The amount of matches that a datapoint should have played until it completes. Per default this is 10.", alias="matchesUntilCompleted")
|
|
36
|
-
__properties: ClassVar[List[str]] = ["_t", "criteria", "startingElo", "kFactor", "
|
|
37
|
+
__properties: ClassVar[List[str]] = ["_t", "criteria", "startingElo", "kFactor", "pairMakerConfig", "scalingFactor", "matchesUntilCompleted"]
|
|
37
38
|
|
|
38
39
|
@field_validator('t')
|
|
39
40
|
def t_validate_enum(cls, value):
|
|
@@ -81,6 +82,9 @@ class CompareWorkflowModel(BaseModel):
|
|
|
81
82
|
exclude=excluded_fields,
|
|
82
83
|
exclude_none=True,
|
|
83
84
|
)
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of pair_maker_config
|
|
86
|
+
if self.pair_maker_config:
|
|
87
|
+
_dict['pairMakerConfig'] = self.pair_maker_config.to_dict()
|
|
84
88
|
return _dict
|
|
85
89
|
|
|
86
90
|
@classmethod
|
|
@@ -97,7 +101,7 @@ class CompareWorkflowModel(BaseModel):
|
|
|
97
101
|
"criteria": obj.get("criteria"),
|
|
98
102
|
"startingElo": obj.get("startingElo"),
|
|
99
103
|
"kFactor": obj.get("kFactor"),
|
|
100
|
-
"
|
|
104
|
+
"pairMakerConfig": CompareWorkflowModelPairMakerConfig.from_dict(obj["pairMakerConfig"]) if obj.get("pairMakerConfig") is not None else None,
|
|
101
105
|
"scalingFactor": obj.get("scalingFactor"),
|
|
102
106
|
"matchesUntilCompleted": obj.get("matchesUntilCompleted")
|
|
103
107
|
})
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.compare_workflow_model1_pair_maker_information import CompareWorkflowModel1PairMakerInformation
|
|
22
23
|
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
23
24
|
from typing import Optional, Set
|
|
24
25
|
from typing_extensions import Self
|
|
@@ -31,16 +32,16 @@ class CompareWorkflowModel1(BaseModel):
|
|
|
31
32
|
id: StrictStr
|
|
32
33
|
dataset_id: Optional[StrictStr] = Field(alias="datasetId")
|
|
33
34
|
referee: CompareWorkflowModel1Referee
|
|
35
|
+
pair_maker_information: CompareWorkflowModel1PairMakerInformation = Field(alias="pairMakerInformation")
|
|
34
36
|
state: StrictStr
|
|
35
37
|
criteria: StrictStr
|
|
36
38
|
name: StrictStr
|
|
37
39
|
owner_mail: Optional[StrictStr] = Field(alias="ownerMail")
|
|
38
40
|
starting_elo: StrictInt = Field(alias="startingElo")
|
|
39
41
|
k_factor: StrictInt = Field(alias="kFactor")
|
|
40
|
-
match_size: StrictInt = Field(alias="matchSize")
|
|
41
42
|
scaling_factor: StrictInt = Field(alias="scalingFactor")
|
|
42
43
|
matches_until_completed: StrictInt = Field(alias="matchesUntilCompleted")
|
|
43
|
-
__properties: ClassVar[List[str]] = ["_t", "id", "datasetId", "referee", "state", "criteria", "name", "ownerMail", "startingElo", "kFactor", "
|
|
44
|
+
__properties: ClassVar[List[str]] = ["_t", "id", "datasetId", "referee", "pairMakerInformation", "state", "criteria", "name", "ownerMail", "startingElo", "kFactor", "scalingFactor", "matchesUntilCompleted"]
|
|
44
45
|
|
|
45
46
|
@field_validator('t')
|
|
46
47
|
def t_validate_enum(cls, value):
|
|
@@ -91,6 +92,9 @@ class CompareWorkflowModel1(BaseModel):
|
|
|
91
92
|
# override the default output from pydantic by calling `to_dict()` of referee
|
|
92
93
|
if self.referee:
|
|
93
94
|
_dict['referee'] = self.referee.to_dict()
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of pair_maker_information
|
|
96
|
+
if self.pair_maker_information:
|
|
97
|
+
_dict['pairMakerInformation'] = self.pair_maker_information.to_dict()
|
|
94
98
|
# set to None if dataset_id (nullable) is None
|
|
95
99
|
# and model_fields_set contains the field
|
|
96
100
|
if self.dataset_id is None and "dataset_id" in self.model_fields_set:
|
|
@@ -117,13 +121,13 @@ class CompareWorkflowModel1(BaseModel):
|
|
|
117
121
|
"id": obj.get("id"),
|
|
118
122
|
"datasetId": obj.get("datasetId"),
|
|
119
123
|
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
124
|
+
"pairMakerInformation": CompareWorkflowModel1PairMakerInformation.from_dict(obj["pairMakerInformation"]) if obj.get("pairMakerInformation") is not None else None,
|
|
120
125
|
"state": obj.get("state"),
|
|
121
126
|
"criteria": obj.get("criteria"),
|
|
122
127
|
"name": obj.get("name"),
|
|
123
128
|
"ownerMail": obj.get("ownerMail"),
|
|
124
129
|
"startingElo": obj.get("startingElo"),
|
|
125
130
|
"kFactor": obj.get("kFactor"),
|
|
126
|
-
"matchSize": obj.get("matchSize"),
|
|
127
131
|
"scalingFactor": obj.get("scalingFactor"),
|
|
128
132
|
"matchesUntilCompleted": obj.get("matchesUntilCompleted")
|
|
129
133
|
})
|
|
@@ -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, List, Optional
|
|
20
|
+
from rapidata.api_client.models.online_pair_maker_information import OnlinePairMakerInformation
|
|
21
|
+
from rapidata.api_client.models.pre_arranged_pair_maker_information import PreArrangedPairMakerInformation
|
|
22
|
+
from pydantic import StrictStr, Field
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
|
|
26
|
+
COMPAREWORKFLOWMODEL1PAIRMAKERINFORMATION_ONE_OF_SCHEMAS = ["OnlinePairMakerInformation", "PreArrangedPairMakerInformation"]
|
|
27
|
+
|
|
28
|
+
class CompareWorkflowModel1PairMakerInformation(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
CompareWorkflowModel1PairMakerInformation
|
|
31
|
+
"""
|
|
32
|
+
# data type: OnlinePairMakerInformation
|
|
33
|
+
oneof_schema_1_validator: Optional[OnlinePairMakerInformation] = None
|
|
34
|
+
# data type: PreArrangedPairMakerInformation
|
|
35
|
+
oneof_schema_2_validator: Optional[PreArrangedPairMakerInformation] = None
|
|
36
|
+
actual_instance: Optional[Union[OnlinePairMakerInformation, PreArrangedPairMakerInformation]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "OnlinePairMakerInformation", "PreArrangedPairMakerInformation" }
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
49
|
+
if args:
|
|
50
|
+
if len(args) > 1:
|
|
51
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
52
|
+
if kwargs:
|
|
53
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
54
|
+
super().__init__(actual_instance=args[0])
|
|
55
|
+
else:
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
|
|
58
|
+
@field_validator('actual_instance')
|
|
59
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
60
|
+
instance = CompareWorkflowModel1PairMakerInformation.model_construct()
|
|
61
|
+
error_messages = []
|
|
62
|
+
match = 0
|
|
63
|
+
# validate data type: OnlinePairMakerInformation
|
|
64
|
+
if not isinstance(v, OnlinePairMakerInformation):
|
|
65
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OnlinePairMakerInformation`")
|
|
66
|
+
else:
|
|
67
|
+
match += 1
|
|
68
|
+
# validate data type: PreArrangedPairMakerInformation
|
|
69
|
+
if not isinstance(v, PreArrangedPairMakerInformation):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PreArrangedPairMakerInformation`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
73
|
+
if match > 1:
|
|
74
|
+
# more than 1 match
|
|
75
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowModel1PairMakerInformation with oneOf schemas: OnlinePairMakerInformation, PreArrangedPairMakerInformation. Details: " + ", ".join(error_messages))
|
|
76
|
+
elif match == 0:
|
|
77
|
+
# no match
|
|
78
|
+
raise ValueError("No match found when setting `actual_instance` in CompareWorkflowModel1PairMakerInformation with oneOf schemas: OnlinePairMakerInformation, PreArrangedPairMakerInformation. Details: " + ", ".join(error_messages))
|
|
79
|
+
else:
|
|
80
|
+
return v
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
84
|
+
return cls.from_json(json.dumps(obj))
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_json(cls, json_str: str) -> Self:
|
|
88
|
+
"""Returns the object represented by the json string"""
|
|
89
|
+
instance = cls.model_construct()
|
|
90
|
+
error_messages = []
|
|
91
|
+
match = 0
|
|
92
|
+
|
|
93
|
+
# deserialize data into OnlinePairMakerInformation
|
|
94
|
+
try:
|
|
95
|
+
instance.actual_instance = OnlinePairMakerInformation.from_json(json_str)
|
|
96
|
+
match += 1
|
|
97
|
+
except (ValidationError, ValueError) as e:
|
|
98
|
+
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into PreArrangedPairMakerInformation
|
|
100
|
+
try:
|
|
101
|
+
instance.actual_instance = PreArrangedPairMakerInformation.from_json(json_str)
|
|
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 CompareWorkflowModel1PairMakerInformation with oneOf schemas: OnlinePairMakerInformation, PreArrangedPairMakerInformation. Details: " + ", ".join(error_messages))
|
|
109
|
+
elif match == 0:
|
|
110
|
+
# no match
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into CompareWorkflowModel1PairMakerInformation with oneOf schemas: OnlinePairMakerInformation, PreArrangedPairMakerInformation. 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], OnlinePairMakerInformation, PreArrangedPairMakerInformation]]:
|
|
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,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, List, Optional
|
|
20
|
+
from rapidata.api_client.models.online_pair_maker_config_model import OnlinePairMakerConfigModel
|
|
21
|
+
from rapidata.api_client.models.pre_arranged_pair_maker_config_model import PreArrangedPairMakerConfigModel
|
|
22
|
+
from pydantic import StrictStr, Field
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
|
|
26
|
+
COMPAREWORKFLOWMODELPAIRMAKERCONFIG_ONE_OF_SCHEMAS = ["OnlinePairMakerConfigModel", "PreArrangedPairMakerConfigModel"]
|
|
27
|
+
|
|
28
|
+
class CompareWorkflowModelPairMakerConfig(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PairMakerConfig is responsible for matchmaking. Use PreArrangedPairMakerConfig for completely random matches or use OnlinePairMakerConfig for more dynamic pairmaking
|
|
31
|
+
"""
|
|
32
|
+
# data type: PreArrangedPairMakerConfigModel
|
|
33
|
+
oneof_schema_1_validator: Optional[PreArrangedPairMakerConfigModel] = None
|
|
34
|
+
# data type: OnlinePairMakerConfigModel
|
|
35
|
+
oneof_schema_2_validator: Optional[OnlinePairMakerConfigModel] = None
|
|
36
|
+
actual_instance: Optional[Union[OnlinePairMakerConfigModel, PreArrangedPairMakerConfigModel]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "OnlinePairMakerConfigModel", "PreArrangedPairMakerConfigModel" }
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
49
|
+
if args:
|
|
50
|
+
if len(args) > 1:
|
|
51
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
52
|
+
if kwargs:
|
|
53
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
54
|
+
super().__init__(actual_instance=args[0])
|
|
55
|
+
else:
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
|
|
58
|
+
@field_validator('actual_instance')
|
|
59
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
60
|
+
instance = CompareWorkflowModelPairMakerConfig.model_construct()
|
|
61
|
+
error_messages = []
|
|
62
|
+
match = 0
|
|
63
|
+
# validate data type: PreArrangedPairMakerConfigModel
|
|
64
|
+
if not isinstance(v, PreArrangedPairMakerConfigModel):
|
|
65
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PreArrangedPairMakerConfigModel`")
|
|
66
|
+
else:
|
|
67
|
+
match += 1
|
|
68
|
+
# validate data type: OnlinePairMakerConfigModel
|
|
69
|
+
if not isinstance(v, OnlinePairMakerConfigModel):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OnlinePairMakerConfigModel`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
73
|
+
if match > 1:
|
|
74
|
+
# more than 1 match
|
|
75
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfigModel, PreArrangedPairMakerConfigModel. Details: " + ", ".join(error_messages))
|
|
76
|
+
elif match == 0:
|
|
77
|
+
# no match
|
|
78
|
+
raise ValueError("No match found when setting `actual_instance` in CompareWorkflowModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfigModel, PreArrangedPairMakerConfigModel. Details: " + ", ".join(error_messages))
|
|
79
|
+
else:
|
|
80
|
+
return v
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
84
|
+
return cls.from_json(json.dumps(obj))
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_json(cls, json_str: str) -> Self:
|
|
88
|
+
"""Returns the object represented by the json string"""
|
|
89
|
+
instance = cls.model_construct()
|
|
90
|
+
error_messages = []
|
|
91
|
+
match = 0
|
|
92
|
+
|
|
93
|
+
# deserialize data into PreArrangedPairMakerConfigModel
|
|
94
|
+
try:
|
|
95
|
+
instance.actual_instance = PreArrangedPairMakerConfigModel.from_json(json_str)
|
|
96
|
+
match += 1
|
|
97
|
+
except (ValidationError, ValueError) as e:
|
|
98
|
+
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into OnlinePairMakerConfigModel
|
|
100
|
+
try:
|
|
101
|
+
instance.actual_instance = OnlinePairMakerConfigModel.from_json(json_str)
|
|
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 CompareWorkflowModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfigModel, PreArrangedPairMakerConfigModel. Details: " + ", ".join(error_messages))
|
|
109
|
+
elif match == 0:
|
|
110
|
+
# no match
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into CompareWorkflowModelPairMakerConfig with oneOf schemas: OnlinePairMakerConfigModel, PreArrangedPairMakerConfigModel. 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], OnlinePairMakerConfigModel, PreArrangedPairMakerConfigModel]]:
|
|
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
|
+
|