rapidata 0.4.0__py3-none-any.whl → 0.5.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 (92) hide show
  1. rapidata/__init__.py +4 -3
  2. rapidata/api_client/__init__.py +51 -15
  3. rapidata/api_client/api/__init__.py +5 -0
  4. rapidata/api_client/api/campaign_api.py +1044 -0
  5. rapidata/api_client/api/compare_workflow_api.py +316 -0
  6. rapidata/api_client/api/dataset_api.py +24 -24
  7. rapidata/api_client/api/order_api.py +206 -536
  8. rapidata/api_client/api/pipeline_api.py +843 -0
  9. rapidata/api_client/api/rapid_api.py +6 -6
  10. rapidata/api_client/api/simple_workflow_api.py +350 -0
  11. rapidata/api_client/api/validation_api.py +6 -6
  12. rapidata/api_client/api/workflow_api.py +2386 -0
  13. rapidata/api_client/api_client.py +2 -2
  14. rapidata/api_client/models/__init__.py +46 -15
  15. rapidata/api_client/models/add_campaign_artifact_result.py +87 -0
  16. rapidata/api_client/models/add_campaign_model.py +149 -0
  17. rapidata/api_client/models/admin_order_model.py +8 -1
  18. rapidata/api_client/models/age_group.py +1 -1
  19. rapidata/api_client/models/age_user_filter_model.py +2 -2
  20. rapidata/api_client/models/campaign_artifact_model.py +98 -0
  21. rapidata/api_client/models/campaign_query_model.py +105 -0
  22. rapidata/api_client/models/campaign_query_model_paged_result.py +105 -0
  23. rapidata/api_client/models/campaign_status.py +39 -0
  24. rapidata/api_client/models/campaign_user_filter_model.py +2 -2
  25. rapidata/api_client/models/compare_workflow_config.py +2 -12
  26. rapidata/api_client/models/compare_workflow_config_model.py +138 -0
  27. rapidata/api_client/models/compare_workflow_get_result_overview_get200_response.py +137 -0
  28. rapidata/api_client/models/compare_workflow_model1.py +146 -0
  29. rapidata/api_client/models/completed_rapid_model.py +103 -0
  30. rapidata/api_client/models/conditional_validation_selection.py +106 -0
  31. rapidata/api_client/models/country_user_filter_model.py +2 -2
  32. rapidata/api_client/models/create_demographic_rapid_model.py +3 -3
  33. rapidata/api_client/models/create_independent_workflow_model.py +93 -0
  34. rapidata/api_client/models/create_independent_workflow_model_workflow_config.py +140 -0
  35. rapidata/api_client/models/create_independent_workflow_result.py +89 -0
  36. rapidata/api_client/models/create_order_model.py +40 -31
  37. rapidata/api_client/models/create_order_model_selections_inner.py +40 -12
  38. rapidata/api_client/models/create_order_model_user_filters_inner.py +35 -35
  39. rapidata/api_client/models/customer_order_model.py +8 -1
  40. rapidata/api_client/models/dataset_artifact_model.py +98 -0
  41. rapidata/api_client/models/demographic_rapid_selection_config.py +7 -5
  42. rapidata/api_client/models/demographic_selection.py +8 -6
  43. rapidata/api_client/models/feedback_model.py +1 -1
  44. rapidata/api_client/models/file_artifact_model.py +98 -0
  45. rapidata/api_client/models/gender.py +1 -1
  46. rapidata/api_client/models/gender_user_filter_model.py +2 -2
  47. rapidata/api_client/models/get_attach_category_workflow_result_overview_result.py +144 -0
  48. rapidata/api_client/models/get_compare_workflow_result_overview_result.py +125 -0
  49. rapidata/api_client/models/get_compare_workflow_result_overview_small_result.py +114 -0
  50. rapidata/api_client/models/get_pipeline_by_id_result.py +100 -0
  51. rapidata/api_client/models/get_pipeline_by_id_result_artifacts_value.py +182 -0
  52. rapidata/api_client/models/get_simple_workflow_result_overview_result.py +142 -0
  53. rapidata/api_client/models/get_workflow_by_id_result.py +91 -0
  54. rapidata/api_client/models/get_workflow_by_id_result_workflow.py +140 -0
  55. rapidata/api_client/models/get_workflow_progress_result.py +100 -0
  56. rapidata/api_client/models/get_workflow_result_overview_result.py +104 -0
  57. rapidata/api_client/models/i_workflow_model_paged_result.py +105 -0
  58. rapidata/api_client/models/in_progress_rapid_model.py +103 -0
  59. rapidata/api_client/models/labeling_selection.py +2 -2
  60. rapidata/api_client/models/language_user_filter_model.py +2 -2
  61. rapidata/api_client/models/not_started_rapid_model.py +93 -0
  62. rapidata/api_client/models/order_state.py +43 -0
  63. rapidata/api_client/models/query_campaigns_model.py +112 -0
  64. rapidata/api_client/models/query_workflows_model.py +112 -0
  65. rapidata/api_client/models/ranked_datapoint_model.py +95 -0
  66. rapidata/api_client/models/rapid_answer.py +97 -0
  67. rapidata/api_client/models/rapid_answer_result.py +252 -0
  68. rapidata/api_client/models/simple_workflow_config.py +2 -12
  69. rapidata/api_client/models/simple_workflow_config_model.py +132 -0
  70. rapidata/api_client/models/simple_workflow_config_model_blueprint.py +238 -0
  71. rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +137 -0
  72. rapidata/api_client/models/simple_workflow_model1.py +140 -0
  73. rapidata/api_client/models/static_selection.py +96 -0
  74. rapidata/api_client/models/update_workflow_config_request.py +107 -0
  75. rapidata/api_client/models/update_workflow_config_request_config.py +140 -0
  76. rapidata/api_client/models/user_score_user_filter_model.py +3 -3
  77. rapidata/api_client/models/validation_selection.py +3 -3
  78. rapidata/api_client/models/workflow_artifact_model.py +98 -0
  79. rapidata/api_client/models/workflow_config_artifact_model.py +102 -0
  80. rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py +140 -0
  81. rapidata/api_client/models/workflow_state.py +41 -0
  82. rapidata/api_client/rest.py +1 -1
  83. rapidata/api_client_README.md +75 -29
  84. rapidata/rapidata_client/__init__.py +6 -1
  85. rapidata/rapidata_client/order/rapidata_order_builder.py +2 -1
  86. rapidata/rapidata_client/selection/__init__.py +1 -0
  87. rapidata/rapidata_client/selection/conditional_validation_rapid_selection.py +41 -0
  88. rapidata/rapidata_client/selection/demographic_selection.py +3 -5
  89. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/METADATA +1 -1
  90. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/RECORD +92 -40
  91. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/LICENSE +0 -0
  92. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,182 @@
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.campaign_artifact_model import CampaignArtifactModel
21
+ from rapidata.api_client.models.dataset_artifact_model import DatasetArtifactModel
22
+ from rapidata.api_client.models.file_artifact_model import FileArtifactModel
23
+ from rapidata.api_client.models.workflow_artifact_model import WorkflowArtifactModel
24
+ from rapidata.api_client.models.workflow_config_artifact_model import WorkflowConfigArtifactModel
25
+ from pydantic import StrictStr, Field
26
+ from typing import Union, List, Set, Optional, Dict
27
+ from typing_extensions import Literal, Self
28
+
29
+ GETPIPELINEBYIDRESULTARTIFACTSVALUE_ONE_OF_SCHEMAS = ["CampaignArtifactModel", "DatasetArtifactModel", "FileArtifactModel", "WorkflowArtifactModel", "WorkflowConfigArtifactModel"]
30
+
31
+ class GetPipelineByIdResultArtifactsValue(BaseModel):
32
+ """
33
+ GetPipelineByIdResultArtifactsValue
34
+ """
35
+ # data type: CampaignArtifactModel
36
+ oneof_schema_1_validator: Optional[CampaignArtifactModel] = None
37
+ # data type: DatasetArtifactModel
38
+ oneof_schema_2_validator: Optional[DatasetArtifactModel] = None
39
+ # data type: FileArtifactModel
40
+ oneof_schema_3_validator: Optional[FileArtifactModel] = None
41
+ # data type: WorkflowArtifactModel
42
+ oneof_schema_4_validator: Optional[WorkflowArtifactModel] = None
43
+ # data type: WorkflowConfigArtifactModel
44
+ oneof_schema_5_validator: Optional[WorkflowConfigArtifactModel] = None
45
+ actual_instance: Optional[Union[CampaignArtifactModel, DatasetArtifactModel, FileArtifactModel, WorkflowArtifactModel, WorkflowConfigArtifactModel]] = None
46
+ one_of_schemas: Set[str] = { "CampaignArtifactModel", "DatasetArtifactModel", "FileArtifactModel", "WorkflowArtifactModel", "WorkflowConfigArtifactModel" }
47
+
48
+ model_config = ConfigDict(
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ discriminator_value_class_map: Dict[str, str] = {
55
+ }
56
+
57
+ def __init__(self, *args, **kwargs) -> None:
58
+ if args:
59
+ if len(args) > 1:
60
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
61
+ if kwargs:
62
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
63
+ super().__init__(actual_instance=args[0])
64
+ else:
65
+ super().__init__(**kwargs)
66
+
67
+ @field_validator('actual_instance')
68
+ def actual_instance_must_validate_oneof(cls, v):
69
+ instance = GetPipelineByIdResultArtifactsValue.model_construct()
70
+ error_messages = []
71
+ match = 0
72
+ # validate data type: CampaignArtifactModel
73
+ if not isinstance(v, CampaignArtifactModel):
74
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CampaignArtifactModel`")
75
+ else:
76
+ match += 1
77
+ # validate data type: DatasetArtifactModel
78
+ if not isinstance(v, DatasetArtifactModel):
79
+ error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetArtifactModel`")
80
+ else:
81
+ match += 1
82
+ # validate data type: FileArtifactModel
83
+ if not isinstance(v, FileArtifactModel):
84
+ error_messages.append(f"Error! Input type `{type(v)}` is not `FileArtifactModel`")
85
+ else:
86
+ match += 1
87
+ # validate data type: WorkflowArtifactModel
88
+ if not isinstance(v, WorkflowArtifactModel):
89
+ error_messages.append(f"Error! Input type `{type(v)}` is not `WorkflowArtifactModel`")
90
+ else:
91
+ match += 1
92
+ # validate data type: WorkflowConfigArtifactModel
93
+ if not isinstance(v, WorkflowConfigArtifactModel):
94
+ error_messages.append(f"Error! Input type `{type(v)}` is not `WorkflowConfigArtifactModel`")
95
+ else:
96
+ match += 1
97
+ if match > 1:
98
+ # more than 1 match
99
+ raise ValueError("Multiple matches found when setting `actual_instance` in GetPipelineByIdResultArtifactsValue with oneOf schemas: CampaignArtifactModel, DatasetArtifactModel, FileArtifactModel, WorkflowArtifactModel, WorkflowConfigArtifactModel. Details: " + ", ".join(error_messages))
100
+ elif match == 0:
101
+ # no match
102
+ raise ValueError("No match found when setting `actual_instance` in GetPipelineByIdResultArtifactsValue with oneOf schemas: CampaignArtifactModel, DatasetArtifactModel, FileArtifactModel, WorkflowArtifactModel, WorkflowConfigArtifactModel. Details: " + ", ".join(error_messages))
103
+ else:
104
+ return v
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
108
+ return cls.from_json(json.dumps(obj))
109
+
110
+ @classmethod
111
+ def from_json(cls, json_str: str) -> Self:
112
+ """Returns the object represented by the json string"""
113
+ instance = cls.model_construct()
114
+ error_messages = []
115
+ match = 0
116
+
117
+ # deserialize data into CampaignArtifactModel
118
+ try:
119
+ instance.actual_instance = CampaignArtifactModel.from_json(json_str)
120
+ match += 1
121
+ except (ValidationError, ValueError) as e:
122
+ error_messages.append(str(e))
123
+ # deserialize data into DatasetArtifactModel
124
+ try:
125
+ instance.actual_instance = DatasetArtifactModel.from_json(json_str)
126
+ match += 1
127
+ except (ValidationError, ValueError) as e:
128
+ error_messages.append(str(e))
129
+ # deserialize data into FileArtifactModel
130
+ try:
131
+ instance.actual_instance = FileArtifactModel.from_json(json_str)
132
+ match += 1
133
+ except (ValidationError, ValueError) as e:
134
+ error_messages.append(str(e))
135
+ # deserialize data into WorkflowArtifactModel
136
+ try:
137
+ instance.actual_instance = WorkflowArtifactModel.from_json(json_str)
138
+ match += 1
139
+ except (ValidationError, ValueError) as e:
140
+ error_messages.append(str(e))
141
+ # deserialize data into WorkflowConfigArtifactModel
142
+ try:
143
+ instance.actual_instance = WorkflowConfigArtifactModel.from_json(json_str)
144
+ match += 1
145
+ except (ValidationError, ValueError) as e:
146
+ error_messages.append(str(e))
147
+
148
+ if match > 1:
149
+ # more than 1 match
150
+ raise ValueError("Multiple matches found when deserializing the JSON string into GetPipelineByIdResultArtifactsValue with oneOf schemas: CampaignArtifactModel, DatasetArtifactModel, FileArtifactModel, WorkflowArtifactModel, WorkflowConfigArtifactModel. Details: " + ", ".join(error_messages))
151
+ elif match == 0:
152
+ # no match
153
+ raise ValueError("No match found when deserializing the JSON string into GetPipelineByIdResultArtifactsValue with oneOf schemas: CampaignArtifactModel, DatasetArtifactModel, FileArtifactModel, WorkflowArtifactModel, WorkflowConfigArtifactModel. Details: " + ", ".join(error_messages))
154
+ else:
155
+ return instance
156
+
157
+ def to_json(self) -> str:
158
+ """Returns the JSON representation of the actual instance"""
159
+ if self.actual_instance is None:
160
+ return "null"
161
+
162
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
163
+ return self.actual_instance.to_json()
164
+ else:
165
+ return json.dumps(self.actual_instance)
166
+
167
+ def to_dict(self) -> Optional[Union[Dict[str, Any], CampaignArtifactModel, DatasetArtifactModel, FileArtifactModel, WorkflowArtifactModel, WorkflowConfigArtifactModel]]:
168
+ """Returns the dict representation of the actual instance"""
169
+ if self.actual_instance is None:
170
+ return None
171
+
172
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
173
+ return self.actual_instance.to_dict()
174
+ else:
175
+ # primitive type
176
+ return self.actual_instance
177
+
178
+ def to_str(self) -> str:
179
+ """Returns the string representation of the actual instance"""
180
+ return pprint.pformat(self.model_dump())
181
+
182
+
@@ -0,0 +1,142 @@
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 GetSimpleWorkflowResultOverviewResult(BaseModel):
30
+ """
31
+ GetSimpleWorkflowResultOverviewResult
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
+ __properties: ClassVar[List[str]] = ["state", "progress", "rapidType", "notStartedRapids", "hiddenNotStartedCount", "inProgressRapids", "hiddenInProgressRapidsCount", "completedRapids", "hiddenCompletedRapidsCount", "resultType"]
44
+
45
+ @field_validator('state')
46
+ def state_validate_enum(cls, value):
47
+ """Validates the enum"""
48
+ if value not in set(['Created', 'Started', 'Labeling', 'Paused', 'Done', 'Failed']):
49
+ raise ValueError("must be one of enum values ('Created', 'Started', 'Labeling', 'Paused', 'Done', 'Failed')")
50
+ return value
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of GetSimpleWorkflowResultOverviewResult from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ * OpenAPI `readOnly` fields are excluded.
83
+ """
84
+ excluded_fields: Set[str] = set([
85
+ "result_type",
86
+ ])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # override the default output from pydantic by calling `to_dict()` of progress
94
+ if self.progress:
95
+ _dict['progress'] = self.progress.to_dict()
96
+ # override the default output from pydantic by calling `to_dict()` of each item in not_started_rapids (list)
97
+ _items = []
98
+ if self.not_started_rapids:
99
+ for _item_not_started_rapids in self.not_started_rapids:
100
+ if _item_not_started_rapids:
101
+ _items.append(_item_not_started_rapids.to_dict())
102
+ _dict['notStartedRapids'] = _items
103
+ # override the default output from pydantic by calling `to_dict()` of each item in in_progress_rapids (list)
104
+ _items = []
105
+ if self.in_progress_rapids:
106
+ for _item_in_progress_rapids in self.in_progress_rapids:
107
+ if _item_in_progress_rapids:
108
+ _items.append(_item_in_progress_rapids.to_dict())
109
+ _dict['inProgressRapids'] = _items
110
+ # override the default output from pydantic by calling `to_dict()` of each item in completed_rapids (list)
111
+ _items = []
112
+ if self.completed_rapids:
113
+ for _item_completed_rapids in self.completed_rapids:
114
+ if _item_completed_rapids:
115
+ _items.append(_item_completed_rapids.to_dict())
116
+ _dict['completedRapids'] = _items
117
+ return _dict
118
+
119
+ @classmethod
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
121
+ """Create an instance of GetSimpleWorkflowResultOverviewResult from a dict"""
122
+ if obj is None:
123
+ return None
124
+
125
+ if not isinstance(obj, dict):
126
+ return cls.model_validate(obj)
127
+
128
+ _obj = cls.model_validate({
129
+ "state": obj.get("state"),
130
+ "progress": GetWorkflowProgressResult.from_dict(obj["progress"]) if obj.get("progress") is not None else None,
131
+ "rapidType": obj.get("rapidType"),
132
+ "notStartedRapids": [NotStartedRapidModel.from_dict(_item) for _item in obj["notStartedRapids"]] if obj.get("notStartedRapids") is not None else None,
133
+ "hiddenNotStartedCount": obj.get("hiddenNotStartedCount"),
134
+ "inProgressRapids": [InProgressRapidModel.from_dict(_item) for _item in obj["inProgressRapids"]] if obj.get("inProgressRapids") is not None else None,
135
+ "hiddenInProgressRapidsCount": obj.get("hiddenInProgressRapidsCount"),
136
+ "completedRapids": [CompletedRapidModel.from_dict(_item) for _item in obj["completedRapids"]] if obj.get("completedRapids") is not None else None,
137
+ "hiddenCompletedRapidsCount": obj.get("hiddenCompletedRapidsCount"),
138
+ "resultType": obj.get("resultType")
139
+ })
140
+ return _obj
141
+
142
+
@@ -0,0 +1,91 @@
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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from rapidata.api_client.models.get_workflow_by_id_result_workflow import GetWorkflowByIdResultWorkflow
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class GetWorkflowByIdResult(BaseModel):
27
+ """
28
+ GetWorkflowByIdResult
29
+ """ # noqa: E501
30
+ workflow: GetWorkflowByIdResultWorkflow
31
+ __properties: ClassVar[List[str]] = ["workflow"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of GetWorkflowByIdResult from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of workflow
73
+ if self.workflow:
74
+ _dict['workflow'] = self.workflow.to_dict()
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of GetWorkflowByIdResult from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "workflow": GetWorkflowByIdResultWorkflow.from_dict(obj["workflow"]) if obj.get("workflow") is not None else None
88
+ })
89
+ return _obj
90
+
91
+
@@ -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.compare_workflow_model1 import CompareWorkflowModel1
21
+ from rapidata.api_client.models.simple_workflow_model1 import SimpleWorkflowModel1
22
+ from pydantic import StrictStr, Field
23
+ from typing import Union, List, Set, Optional, Dict
24
+ from typing_extensions import Literal, Self
25
+
26
+ GETWORKFLOWBYIDRESULTWORKFLOW_ONE_OF_SCHEMAS = ["CompareWorkflowModel1", "SimpleWorkflowModel1"]
27
+
28
+ class GetWorkflowByIdResultWorkflow(BaseModel):
29
+ """
30
+ GetWorkflowByIdResultWorkflow
31
+ """
32
+ # data type: CompareWorkflowModel1
33
+ oneof_schema_1_validator: Optional[CompareWorkflowModel1] = None
34
+ # data type: SimpleWorkflowModel1
35
+ oneof_schema_2_validator: Optional[SimpleWorkflowModel1] = None
36
+ actual_instance: Optional[Union[CompareWorkflowModel1, SimpleWorkflowModel1]] = None
37
+ one_of_schemas: Set[str] = { "CompareWorkflowModel1", "SimpleWorkflowModel1" }
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 = GetWorkflowByIdResultWorkflow.model_construct()
61
+ error_messages = []
62
+ match = 0
63
+ # validate data type: CompareWorkflowModel1
64
+ if not isinstance(v, CompareWorkflowModel1):
65
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CompareWorkflowModel1`")
66
+ else:
67
+ match += 1
68
+ # validate data type: SimpleWorkflowModel1
69
+ if not isinstance(v, SimpleWorkflowModel1):
70
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleWorkflowModel1`")
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 GetWorkflowByIdResultWorkflow with oneOf schemas: CompareWorkflowModel1, SimpleWorkflowModel1. Details: " + ", ".join(error_messages))
76
+ elif match == 0:
77
+ # no match
78
+ raise ValueError("No match found when setting `actual_instance` in GetWorkflowByIdResultWorkflow with oneOf schemas: CompareWorkflowModel1, SimpleWorkflowModel1. 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 CompareWorkflowModel1
94
+ try:
95
+ instance.actual_instance = CompareWorkflowModel1.from_json(json_str)
96
+ match += 1
97
+ except (ValidationError, ValueError) as e:
98
+ error_messages.append(str(e))
99
+ # deserialize data into SimpleWorkflowModel1
100
+ try:
101
+ instance.actual_instance = SimpleWorkflowModel1.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 GetWorkflowByIdResultWorkflow with oneOf schemas: CompareWorkflowModel1, SimpleWorkflowModel1. Details: " + ", ".join(error_messages))
109
+ elif match == 0:
110
+ # no match
111
+ raise ValueError("No match found when deserializing the JSON string into GetWorkflowByIdResultWorkflow with oneOf schemas: CompareWorkflowModel1, SimpleWorkflowModel1. 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], CompareWorkflowModel1, SimpleWorkflowModel1]]:
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,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class GetWorkflowProgressResult(BaseModel):
26
+ """
27
+ GetWorkflowProgressResult
28
+ """ # noqa: E501
29
+ completion_percentage: Union[StrictFloat, StrictInt] = Field(alias="completionPercentage")
30
+ total: StrictInt
31
+ completed: StrictInt
32
+ state: StrictStr
33
+ __properties: ClassVar[List[str]] = ["completionPercentage", "total", "completed", "state"]
34
+
35
+ @field_validator('state')
36
+ def state_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['Created', 'Started', 'Labeling', 'Paused', 'Done', 'Failed']):
39
+ raise ValueError("must be one of enum values ('Created', 'Started', 'Labeling', 'Paused', 'Done', 'Failed')")
40
+ return value
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of GetWorkflowProgressResult from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of GetWorkflowProgressResult from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "completionPercentage": obj.get("completionPercentage"),
94
+ "total": obj.get("total"),
95
+ "completed": obj.get("completed"),
96
+ "state": obj.get("state")
97
+ })
98
+ return _obj
99
+
100
+