rapidata 2.5.0__py3-none-any.whl → 2.6.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.

Files changed (38) hide show
  1. rapidata/api_client/__init__.py +17 -15
  2. rapidata/api_client/api/compare_workflow_api.py +49 -48
  3. rapidata/api_client/api/pipeline_api.py +559 -2
  4. rapidata/api_client/api/rapid_api.py +283 -0
  5. rapidata/api_client/api/simple_workflow_api.py +49 -82
  6. rapidata/api_client/api/workflow_api.py +0 -264
  7. rapidata/api_client/models/__init__.py +17 -15
  8. rapidata/api_client/models/ab_test_selection.py +122 -0
  9. rapidata/api_client/models/ab_test_selection_a_inner.py +212 -0
  10. rapidata/api_client/models/add_campaign_model.py +3 -3
  11. rapidata/api_client/models/capped_selection.py +3 -3
  12. rapidata/api_client/models/compare_match_status.py +39 -0
  13. rapidata/api_client/models/create_order_model.py +3 -3
  14. rapidata/api_client/models/get_compare_workflow_results_model.py +114 -0
  15. rapidata/api_client/models/get_compare_workflow_results_result.py +104 -0
  16. rapidata/api_client/models/get_compare_workflow_results_result_asset.py +170 -0
  17. rapidata/api_client/models/get_compare_workflow_results_result_paged_result.py +105 -0
  18. rapidata/api_client/models/get_simple_workflow_results_model.py +114 -0
  19. rapidata/api_client/models/get_simple_workflow_results_result.py +112 -0
  20. rapidata/api_client/models/get_simple_workflow_results_result_paged_result.py +105 -0
  21. rapidata/api_client/models/multi_asset_model2.py +3 -3
  22. rapidata/api_client/models/order_model.py +3 -1
  23. rapidata/api_client/models/preliminary_download_model.py +87 -0
  24. rapidata/api_client/models/preliminary_download_result.py +87 -0
  25. rapidata/api_client/models/query_validation_rapids_result.py +11 -2
  26. rapidata/api_client/models/rapid_response.py +101 -0
  27. rapidata/api_client/models/rapid_response_result.py +266 -0
  28. rapidata/api_client/models/rapid_state.py +40 -0
  29. rapidata/api_client/models/update_validation_rapid_model.py +105 -0
  30. rapidata/api_client/models/update_validation_rapid_model_truth.py +252 -0
  31. rapidata/api_client_README.md +22 -18
  32. rapidata/rapidata_client/order/_rapidata_order_builder.py +3 -3
  33. rapidata/rapidata_client/selection/ab_test_selection.py +38 -0
  34. rapidata/rapidata_client/selection/capped_selection.py +3 -3
  35. {rapidata-2.5.0.dist-info → rapidata-2.6.0.dist-info}/METADATA +1 -1
  36. {rapidata-2.5.0.dist-info → rapidata-2.6.0.dist-info}/RECORD +38 -20
  37. {rapidata-2.5.0.dist-info → rapidata-2.6.0.dist-info}/LICENSE +0 -0
  38. {rapidata-2.5.0.dist-info → rapidata-2.6.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,212 @@
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.conditional_validation_selection import ConditionalValidationSelection
21
+ from rapidata.api_client.models.demographic_selection import DemographicSelection
22
+ from rapidata.api_client.models.labeling_selection import LabelingSelection
23
+ from rapidata.api_client.models.static_selection import StaticSelection
24
+ from rapidata.api_client.models.validation_selection import ValidationSelection
25
+ from pydantic import StrictStr, Field
26
+ from typing import Union, List, Set, Optional, Dict
27
+ from typing_extensions import Literal, Self
28
+
29
+ ABTESTSELECTIONAINNER_ONE_OF_SCHEMAS = ["AbTestSelection", "CappedSelection", "ConditionalValidationSelection", "DemographicSelection", "LabelingSelection", "StaticSelection", "ValidationSelection"]
30
+
31
+ class AbTestSelectionAInner(BaseModel):
32
+ """
33
+ AbTestSelectionAInner
34
+ """
35
+ # data type: AbTestSelection
36
+ oneof_schema_1_validator: Optional[AbTestSelection] = None
37
+ # data type: CappedSelection
38
+ oneof_schema_2_validator: Optional[CappedSelection] = None
39
+ # data type: ConditionalValidationSelection
40
+ oneof_schema_3_validator: Optional[ConditionalValidationSelection] = None
41
+ # data type: DemographicSelection
42
+ oneof_schema_4_validator: Optional[DemographicSelection] = None
43
+ # data type: LabelingSelection
44
+ oneof_schema_5_validator: Optional[LabelingSelection] = None
45
+ # data type: StaticSelection
46
+ oneof_schema_6_validator: Optional[StaticSelection] = None
47
+ # data type: ValidationSelection
48
+ oneof_schema_7_validator: Optional[ValidationSelection] = None
49
+ actual_instance: Optional[Union[AbTestSelection, CappedSelection, ConditionalValidationSelection, DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection]] = None
50
+ one_of_schemas: Set[str] = { "AbTestSelection", "CappedSelection", "ConditionalValidationSelection", "DemographicSelection", "LabelingSelection", "StaticSelection", "ValidationSelection" }
51
+
52
+ model_config = ConfigDict(
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+
58
+ discriminator_value_class_map: Dict[str, str] = {
59
+ }
60
+
61
+ def __init__(self, *args, **kwargs) -> None:
62
+ if args:
63
+ if len(args) > 1:
64
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
65
+ if kwargs:
66
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
67
+ super().__init__(actual_instance=args[0])
68
+ else:
69
+ super().__init__(**kwargs)
70
+
71
+ @field_validator('actual_instance')
72
+ def actual_instance_must_validate_oneof(cls, v):
73
+ instance = AbTestSelectionAInner.model_construct()
74
+ error_messages = []
75
+ match = 0
76
+ # validate data type: AbTestSelection
77
+ if not isinstance(v, AbTestSelection):
78
+ error_messages.append(f"Error! Input type `{type(v)}` is not `AbTestSelection`")
79
+ else:
80
+ match += 1
81
+ # validate data type: CappedSelection
82
+ if not isinstance(v, CappedSelection):
83
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CappedSelection`")
84
+ else:
85
+ match += 1
86
+ # validate data type: ConditionalValidationSelection
87
+ if not isinstance(v, ConditionalValidationSelection):
88
+ error_messages.append(f"Error! Input type `{type(v)}` is not `ConditionalValidationSelection`")
89
+ else:
90
+ match += 1
91
+ # validate data type: DemographicSelection
92
+ if not isinstance(v, DemographicSelection):
93
+ error_messages.append(f"Error! Input type `{type(v)}` is not `DemographicSelection`")
94
+ else:
95
+ match += 1
96
+ # validate data type: LabelingSelection
97
+ if not isinstance(v, LabelingSelection):
98
+ error_messages.append(f"Error! Input type `{type(v)}` is not `LabelingSelection`")
99
+ else:
100
+ match += 1
101
+ # validate data type: StaticSelection
102
+ if not isinstance(v, StaticSelection):
103
+ error_messages.append(f"Error! Input type `{type(v)}` is not `StaticSelection`")
104
+ else:
105
+ match += 1
106
+ # validate data type: ValidationSelection
107
+ if not isinstance(v, ValidationSelection):
108
+ error_messages.append(f"Error! Input type `{type(v)}` is not `ValidationSelection`")
109
+ else:
110
+ match += 1
111
+ if match > 1:
112
+ # more than 1 match
113
+ raise ValueError("Multiple matches found when setting `actual_instance` in AbTestSelectionAInner with oneOf schemas: AbTestSelection, CappedSelection, ConditionalValidationSelection, DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
114
+ elif match == 0:
115
+ # no match
116
+ raise ValueError("No match found when setting `actual_instance` in AbTestSelectionAInner with oneOf schemas: AbTestSelection, CappedSelection, ConditionalValidationSelection, DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
117
+ else:
118
+ return v
119
+
120
+ @classmethod
121
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
122
+ return cls.from_json(json.dumps(obj))
123
+
124
+ @classmethod
125
+ def from_json(cls, json_str: str) -> Self:
126
+ """Returns the object represented by the json string"""
127
+ instance = cls.model_construct()
128
+ error_messages = []
129
+ match = 0
130
+
131
+ # deserialize data into AbTestSelection
132
+ try:
133
+ instance.actual_instance = AbTestSelection.from_json(json_str)
134
+ match += 1
135
+ except (ValidationError, ValueError) as e:
136
+ error_messages.append(str(e))
137
+ # deserialize data into CappedSelection
138
+ try:
139
+ instance.actual_instance = CappedSelection.from_json(json_str)
140
+ match += 1
141
+ except (ValidationError, ValueError) as e:
142
+ error_messages.append(str(e))
143
+ # deserialize data into ConditionalValidationSelection
144
+ try:
145
+ instance.actual_instance = ConditionalValidationSelection.from_json(json_str)
146
+ match += 1
147
+ except (ValidationError, ValueError) as e:
148
+ error_messages.append(str(e))
149
+ # deserialize data into DemographicSelection
150
+ try:
151
+ instance.actual_instance = DemographicSelection.from_json(json_str)
152
+ match += 1
153
+ except (ValidationError, ValueError) as e:
154
+ error_messages.append(str(e))
155
+ # deserialize data into LabelingSelection
156
+ try:
157
+ instance.actual_instance = LabelingSelection.from_json(json_str)
158
+ match += 1
159
+ except (ValidationError, ValueError) as e:
160
+ error_messages.append(str(e))
161
+ # deserialize data into StaticSelection
162
+ try:
163
+ instance.actual_instance = StaticSelection.from_json(json_str)
164
+ match += 1
165
+ except (ValidationError, ValueError) as e:
166
+ error_messages.append(str(e))
167
+ # deserialize data into ValidationSelection
168
+ try:
169
+ instance.actual_instance = ValidationSelection.from_json(json_str)
170
+ match += 1
171
+ except (ValidationError, ValueError) as e:
172
+ error_messages.append(str(e))
173
+
174
+ if match > 1:
175
+ # more than 1 match
176
+ raise ValueError("Multiple matches found when deserializing the JSON string into AbTestSelectionAInner with oneOf schemas: AbTestSelection, CappedSelection, ConditionalValidationSelection, DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
177
+ elif match == 0:
178
+ # no match
179
+ raise ValueError("No match found when deserializing the JSON string into AbTestSelectionAInner with oneOf schemas: AbTestSelection, CappedSelection, ConditionalValidationSelection, DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
180
+ else:
181
+ return instance
182
+
183
+ def to_json(self) -> str:
184
+ """Returns the JSON representation of the actual instance"""
185
+ if self.actual_instance is None:
186
+ return "null"
187
+
188
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
189
+ return self.actual_instance.to_json()
190
+ else:
191
+ return json.dumps(self.actual_instance)
192
+
193
+ def to_dict(self) -> Optional[Union[Dict[str, Any], AbTestSelection, CappedSelection, ConditionalValidationSelection, DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection]]:
194
+ """Returns the dict representation of the actual instance"""
195
+ if self.actual_instance is None:
196
+ return None
197
+
198
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
199
+ return self.actual_instance.to_dict()
200
+ else:
201
+ # primitive type
202
+ return self.actual_instance
203
+
204
+ def to_str(self) -> str:
205
+ """Returns the string representation of the actual instance"""
206
+ return pprint.pformat(self.model_dump())
207
+
208
+ from rapidata.api_client.models.ab_test_selection import AbTestSelection
209
+ from rapidata.api_client.models.capped_selection import CappedSelection
210
+ # TODO: Rewrite to not use raise_errors
211
+ AbTestSelectionAInner.model_rebuild(raise_errors=False)
212
+
@@ -19,7 +19,7 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from rapidata.api_client.models.capped_selection_selections_inner import CappedSelectionSelectionsInner
22
+ from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
23
23
  from rapidata.api_client.models.create_order_model_user_filters_inner import CreateOrderModelUserFiltersInner
24
24
  from rapidata.api_client.models.feature_flag import FeatureFlag
25
25
  from typing import Optional, Set
@@ -34,7 +34,7 @@ class AddCampaignModel(BaseModel):
34
34
  campaign_name: StrictStr = Field(description="The name of the campaign.", alias="campaignName")
35
35
  user_filters: List[CreateOrderModelUserFiltersInner] = Field(description="The user filters to apply to the campaign.", alias="userFilters")
36
36
  validation_set_id: Optional[StrictStr] = Field(default=None, description="A validation set that should be used.", alias="validationSetId")
37
- selections: Optional[List[CappedSelectionSelectionsInner]] = Field(description="The selections that the campaign should have.")
37
+ selections: Optional[List[AbTestSelectionAInner]] = Field(description="The selections that the campaign should have.")
38
38
  feature_flags: List[FeatureFlag] = Field(description="The feature flags that should be applied to the campaign.", alias="featureFlags")
39
39
  priority: StrictInt = Field(description="The priority of the campaign.")
40
40
  is_sticky: Optional[StrictBool] = Field(default=None, description="Indicates if the campaign is sticky.", alias="isSticky")
@@ -139,7 +139,7 @@ class AddCampaignModel(BaseModel):
139
139
  "campaignName": obj.get("campaignName"),
140
140
  "userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
141
141
  "validationSetId": obj.get("validationSetId"),
142
- "selections": [CappedSelectionSelectionsInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
142
+ "selections": [AbTestSelectionAInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
143
143
  "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
144
144
  "priority": obj.get("priority"),
145
145
  "isSticky": obj.get("isSticky")
@@ -27,7 +27,7 @@ class CappedSelection(BaseModel):
27
27
  CappedSelection
28
28
  """ # noqa: E501
29
29
  t: StrictStr = Field(description="Discriminator value for CappedSelection", alias="_t")
30
- selections: List[CappedSelectionSelectionsInner]
30
+ selections: List[AbTestSelectionAInner]
31
31
  max_rapids: StrictInt = Field(alias="maxRapids")
32
32
  __properties: ClassVar[List[str]] = ["_t", "selections", "maxRapids"]
33
33
 
@@ -97,12 +97,12 @@ class CappedSelection(BaseModel):
97
97
 
98
98
  _obj = cls.model_validate({
99
99
  "_t": obj.get("_t") if obj.get("_t") is not None else 'CappedSelection',
100
- "selections": [CappedSelectionSelectionsInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
100
+ "selections": [AbTestSelectionAInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
101
101
  "maxRapids": obj.get("maxRapids")
102
102
  })
103
103
  return _obj
104
104
 
105
- from rapidata.api_client.models.capped_selection_selections_inner import CappedSelectionSelectionsInner
105
+ from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
106
106
  # TODO: Rewrite to not use raise_errors
107
107
  CappedSelection.model_rebuild(raise_errors=False)
108
108
 
@@ -0,0 +1,39 @@
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
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class CompareMatchStatus(str, Enum):
22
+ """
23
+ CompareMatchStatus
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ IDLE = 'Idle'
30
+ QUEUED = 'Queued'
31
+ PROCESSING = 'Processing'
32
+ COMPLETED = 'Completed'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of CompareMatchStatus from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -19,7 +19,7 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from rapidata.api_client.models.capped_selection_selections_inner import CappedSelectionSelectionsInner
22
+ from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
23
23
  from rapidata.api_client.models.create_order_model_referee import CreateOrderModelReferee
24
24
  from rapidata.api_client.models.create_order_model_user_filters_inner import CreateOrderModelUserFiltersInner
25
25
  from rapidata.api_client.models.create_order_model_workflow import CreateOrderModelWorkflow
@@ -41,7 +41,7 @@ class CreateOrderModel(BaseModel):
41
41
  is_sticky: Optional[StrictBool] = Field(default=None, description="Indicates if the underlying campaign should be sticky.", alias="isSticky")
42
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")
43
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")
44
- selections: Optional[List[CappedSelectionSelectionsInner]] = Field(default=None, description="The selections are used to determine which tasks are shown to a user.")
44
+ selections: Optional[List[AbTestSelectionAInner]] = Field(default=None, description="The selections are used to determine which tasks are shown to a user.")
45
45
  __properties: ClassVar[List[str]] = ["_t", "orderName", "workflow", "referee", "aggregator", "featureFlags", "priority", "isSticky", "userFilters", "validationSetId", "selections"]
46
46
 
47
47
  @field_validator('t')
@@ -174,7 +174,7 @@ class CreateOrderModel(BaseModel):
174
174
  "isSticky": obj.get("isSticky"),
175
175
  "userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
176
176
  "validationSetId": obj.get("validationSetId"),
177
- "selections": [CappedSelectionSelectionsInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None
177
+ "selections": [AbTestSelectionAInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None
178
178
  })
179
179
  return _obj
180
180
 
@@ -0,0 +1,114 @@
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.compare_match_status import CompareMatchStatus
23
+ from rapidata.api_client.models.page_info import PageInfo
24
+ from rapidata.api_client.models.sort_criterion import SortCriterion
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class GetCompareWorkflowResultsModel(BaseModel):
29
+ """
30
+ Model for getting the overview of a compare workflow result.
31
+ """ # noqa: E501
32
+ page: Optional[PageInfo] = None
33
+ states: Optional[List[CompareMatchStatus]] = Field(default=None, description="An optional list of states to filter the results by.")
34
+ sort_criteria: Optional[List[SortCriterion]] = Field(default=None, description="A list of criteria to sort the results by.", alias="sortCriteria")
35
+ __properties: ClassVar[List[str]] = ["page", "states", "sortCriteria"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of GetCompareWorkflowResultsModel from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of page
77
+ if self.page:
78
+ _dict['page'] = self.page.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of each item in sort_criteria (list)
80
+ _items = []
81
+ if self.sort_criteria:
82
+ for _item_sort_criteria in self.sort_criteria:
83
+ if _item_sort_criteria:
84
+ _items.append(_item_sort_criteria.to_dict())
85
+ _dict['sortCriteria'] = _items
86
+ # set to None if states (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.states is None and "states" in self.model_fields_set:
89
+ _dict['states'] = None
90
+
91
+ # set to None if sort_criteria (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.sort_criteria is None and "sort_criteria" in self.model_fields_set:
94
+ _dict['sortCriteria'] = None
95
+
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of GetCompareWorkflowResultsModel from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "page": PageInfo.from_dict(obj["page"]) if obj.get("page") is not None else None,
109
+ "states": obj.get("states"),
110
+ "sortCriteria": [SortCriterion.from_dict(_item) for _item in obj["sortCriteria"]] if obj.get("sortCriteria") is not None else None
111
+ })
112
+ return _obj
113
+
114
+
@@ -0,0 +1,104 @@
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
22
+ from rapidata.api_client.models.get_compare_workflow_results_result_asset import GetCompareWorkflowResultsResultAsset
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class GetCompareWorkflowResultsResult(BaseModel):
27
+ """
28
+ GetCompareWorkflowResultsResult
29
+ """ # noqa: E501
30
+ workflow_datapoint_id: StrictStr = Field(alias="workflowDatapointId")
31
+ asset: GetCompareWorkflowResultsResultAsset
32
+ elo: StrictInt
33
+ state: StrictStr
34
+ __properties: ClassVar[List[str]] = ["workflowDatapointId", "asset", "elo", "state"]
35
+
36
+ @field_validator('state')
37
+ def state_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in set(['Idle', 'Queued', 'Processing', 'Completed']):
40
+ raise ValueError("must be one of enum values ('Idle', 'Queued', 'Processing', 'Completed')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of GetCompareWorkflowResultsResult from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of asset
83
+ if self.asset:
84
+ _dict['asset'] = self.asset.to_dict()
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of GetCompareWorkflowResultsResult from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "workflowDatapointId": obj.get("workflowDatapointId"),
98
+ "asset": GetCompareWorkflowResultsResultAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
99
+ "elo": obj.get("elo"),
100
+ "state": obj.get("state")
101
+ })
102
+ return _obj
103
+
104
+