rapidata 1.10.1__py3-none-any.whl → 2.1.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 +22 -17
- rapidata/api_client/__init__.py +16 -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 +16 -5
- rapidata/api_client/models/add_campaign_model.py +5 -5
- 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/create_order_model.py +4 -2
- rapidata/api_client/models/create_order_model_user_filters_inner.py +25 -11
- rapidata/api_client/models/custom_user_filter_model.py +98 -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 +21 -7
- rapidata/rapidata_client/__init__.py +20 -10
- 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 +2 -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/custom_filter.py +29 -0
- 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 +35 -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 +50 -32
- 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 +338 -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.1.0.dist-info}/METADATA +2 -1
- {rapidata-1.10.1.dist-info → rapidata-2.1.0.dist-info}/RECORD +122 -96
- 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.1.0.dist-info}/LICENSE +0 -0
- {rapidata-1.10.1.dist-info → rapidata-2.1.0.dist-info}/WHEEL +0 -0
|
@@ -17,7 +17,7 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from rapidata.api_client.models.capped_selection_selections_inner import CappedSelectionSelectionsInner
|
|
23
23
|
from rapidata.api_client.models.create_order_model_referee import CreateOrderModelReferee
|
|
@@ -38,10 +38,11 @@ class CreateOrderModel(BaseModel):
|
|
|
38
38
|
aggregator: Optional[StrictStr] = Field(default=None, description="The aggregator is used to determine how the data will be aggregated. The default behavior is enough for most cases")
|
|
39
39
|
feature_flags: Optional[List[FeatureFlagModel]] = Field(default=None, description="The feature flags are used to enable or disable certain features.", alias="featureFlags")
|
|
40
40
|
priority: Optional[StrictInt] = Field(default=None, description="The priority is used to prioritize over other orders.")
|
|
41
|
+
is_sticky: Optional[StrictBool] = Field(default=None, description="Indicates if the underlying campaign should be sticky.", alias="isSticky")
|
|
41
42
|
user_filters: List[CreateOrderModelUserFiltersInner] = Field(description="The user filters are used to restrict the order to only collect votes from a specific demographic.", alias="userFilters")
|
|
42
43
|
validation_set_id: Optional[StrictStr] = Field(default=None, description="The validation set id can be changed to point to a specific validation set. if not provided a sane default will be used.", alias="validationSetId")
|
|
43
44
|
selections: Optional[List[CappedSelectionSelectionsInner]] = Field(default=None, description="The selections are used to determine which tasks are shown to a user.")
|
|
44
|
-
__properties: ClassVar[List[str]] = ["_t", "orderName", "workflow", "referee", "aggregator", "featureFlags", "priority", "userFilters", "validationSetId", "selections"]
|
|
45
|
+
__properties: ClassVar[List[str]] = ["_t", "orderName", "workflow", "referee", "aggregator", "featureFlags", "priority", "isSticky", "userFilters", "validationSetId", "selections"]
|
|
45
46
|
|
|
46
47
|
@field_validator('t')
|
|
47
48
|
def t_validate_enum(cls, value):
|
|
@@ -170,6 +171,7 @@ class CreateOrderModel(BaseModel):
|
|
|
170
171
|
"aggregator": obj.get("aggregator"),
|
|
171
172
|
"featureFlags": [FeatureFlagModel.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
172
173
|
"priority": obj.get("priority"),
|
|
174
|
+
"isSticky": obj.get("isSticky"),
|
|
173
175
|
"userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
|
|
174
176
|
"validationSetId": obj.get("validationSetId"),
|
|
175
177
|
"selections": [CappedSelectionSelectionsInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None
|
|
@@ -20,6 +20,7 @@ from typing import Any, List, Optional
|
|
|
20
20
|
from rapidata.api_client.models.age_user_filter_model import AgeUserFilterModel
|
|
21
21
|
from rapidata.api_client.models.campaign_user_filter_model import CampaignUserFilterModel
|
|
22
22
|
from rapidata.api_client.models.country_user_filter_model import CountryUserFilterModel
|
|
23
|
+
from rapidata.api_client.models.custom_user_filter_model import CustomUserFilterModel
|
|
23
24
|
from rapidata.api_client.models.gender_user_filter_model import GenderUserFilterModel
|
|
24
25
|
from rapidata.api_client.models.language_user_filter_model import LanguageUserFilterModel
|
|
25
26
|
from rapidata.api_client.models.user_score_user_filter_model import UserScoreUserFilterModel
|
|
@@ -27,7 +28,7 @@ from pydantic import StrictStr, Field
|
|
|
27
28
|
from typing import Union, List, Set, Optional, Dict
|
|
28
29
|
from typing_extensions import Literal, Self
|
|
29
30
|
|
|
30
|
-
CREATEORDERMODELUSERFILTERSINNER_ONE_OF_SCHEMAS = ["AgeUserFilterModel", "CampaignUserFilterModel", "CountryUserFilterModel", "GenderUserFilterModel", "LanguageUserFilterModel", "UserScoreUserFilterModel"]
|
|
31
|
+
CREATEORDERMODELUSERFILTERSINNER_ONE_OF_SCHEMAS = ["AgeUserFilterModel", "CampaignUserFilterModel", "CountryUserFilterModel", "CustomUserFilterModel", "GenderUserFilterModel", "LanguageUserFilterModel", "UserScoreUserFilterModel"]
|
|
31
32
|
|
|
32
33
|
class CreateOrderModelUserFiltersInner(BaseModel):
|
|
33
34
|
"""
|
|
@@ -39,14 +40,16 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
39
40
|
oneof_schema_2_validator: Optional[CampaignUserFilterModel] = None
|
|
40
41
|
# data type: CountryUserFilterModel
|
|
41
42
|
oneof_schema_3_validator: Optional[CountryUserFilterModel] = None
|
|
43
|
+
# data type: CustomUserFilterModel
|
|
44
|
+
oneof_schema_4_validator: Optional[CustomUserFilterModel] = None
|
|
42
45
|
# data type: GenderUserFilterModel
|
|
43
|
-
|
|
46
|
+
oneof_schema_5_validator: Optional[GenderUserFilterModel] = None
|
|
44
47
|
# data type: LanguageUserFilterModel
|
|
45
|
-
|
|
48
|
+
oneof_schema_6_validator: Optional[LanguageUserFilterModel] = None
|
|
46
49
|
# data type: UserScoreUserFilterModel
|
|
47
|
-
|
|
48
|
-
actual_instance: Optional[Union[AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel]] = None
|
|
49
|
-
one_of_schemas: Set[str] = { "AgeUserFilterModel", "CampaignUserFilterModel", "CountryUserFilterModel", "GenderUserFilterModel", "LanguageUserFilterModel", "UserScoreUserFilterModel" }
|
|
50
|
+
oneof_schema_7_validator: Optional[UserScoreUserFilterModel] = None
|
|
51
|
+
actual_instance: Optional[Union[AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, CustomUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel]] = None
|
|
52
|
+
one_of_schemas: Set[str] = { "AgeUserFilterModel", "CampaignUserFilterModel", "CountryUserFilterModel", "CustomUserFilterModel", "GenderUserFilterModel", "LanguageUserFilterModel", "UserScoreUserFilterModel" }
|
|
50
53
|
|
|
51
54
|
model_config = ConfigDict(
|
|
52
55
|
validate_assignment=True,
|
|
@@ -87,6 +90,11 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
87
90
|
error_messages.append(f"Error! Input type `{type(v)}` is not `CountryUserFilterModel`")
|
|
88
91
|
else:
|
|
89
92
|
match += 1
|
|
93
|
+
# validate data type: CustomUserFilterModel
|
|
94
|
+
if not isinstance(v, CustomUserFilterModel):
|
|
95
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CustomUserFilterModel`")
|
|
96
|
+
else:
|
|
97
|
+
match += 1
|
|
90
98
|
# validate data type: GenderUserFilterModel
|
|
91
99
|
if not isinstance(v, GenderUserFilterModel):
|
|
92
100
|
error_messages.append(f"Error! Input type `{type(v)}` is not `GenderUserFilterModel`")
|
|
@@ -104,10 +112,10 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
104
112
|
match += 1
|
|
105
113
|
if match > 1:
|
|
106
114
|
# more than 1 match
|
|
107
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
115
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, CustomUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
108
116
|
elif match == 0:
|
|
109
117
|
# no match
|
|
110
|
-
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
118
|
+
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, CustomUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
111
119
|
else:
|
|
112
120
|
return v
|
|
113
121
|
|
|
@@ -140,6 +148,12 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
140
148
|
match += 1
|
|
141
149
|
except (ValidationError, ValueError) as e:
|
|
142
150
|
error_messages.append(str(e))
|
|
151
|
+
# deserialize data into CustomUserFilterModel
|
|
152
|
+
try:
|
|
153
|
+
instance.actual_instance = CustomUserFilterModel.from_json(json_str)
|
|
154
|
+
match += 1
|
|
155
|
+
except (ValidationError, ValueError) as e:
|
|
156
|
+
error_messages.append(str(e))
|
|
143
157
|
# deserialize data into GenderUserFilterModel
|
|
144
158
|
try:
|
|
145
159
|
instance.actual_instance = GenderUserFilterModel.from_json(json_str)
|
|
@@ -161,10 +175,10 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
161
175
|
|
|
162
176
|
if match > 1:
|
|
163
177
|
# more than 1 match
|
|
164
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
178
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, CustomUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
165
179
|
elif match == 0:
|
|
166
180
|
# no match
|
|
167
|
-
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
181
|
+
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, CustomUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
168
182
|
else:
|
|
169
183
|
return instance
|
|
170
184
|
|
|
@@ -178,7 +192,7 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
178
192
|
else:
|
|
179
193
|
return json.dumps(self.actual_instance)
|
|
180
194
|
|
|
181
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel]]:
|
|
195
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, CustomUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel]]:
|
|
182
196
|
"""Returns the dict representation of the actual instance"""
|
|
183
197
|
if self.actual_instance is None:
|
|
184
198
|
return None
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class CustomUserFilterModel(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
CustomUserFilterModel
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for CustomFilter", alias="_t")
|
|
30
|
+
identifier: StrictStr
|
|
31
|
+
values: List[StrictStr]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "identifier", "values"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['CustomFilter']):
|
|
38
|
+
raise ValueError("must be one of enum values ('CustomFilter')")
|
|
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 CustomUserFilterModel 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 CustomUserFilterModel 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 'CustomFilter',
|
|
93
|
+
"identifier": obj.get("identifier"),
|
|
94
|
+
"values": obj.get("values")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -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
|
+
|