rapidata 0.1.18__py3-none-any.whl → 0.1.20__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.
Files changed (54) hide show
  1. rapidata/api_client/__init__.py +26 -0
  2. rapidata/api_client/api/__init__.py +1 -0
  3. rapidata/api_client/api/rapid_api.py +1370 -0
  4. rapidata/api_client/api/validation_api.py +15 -5
  5. rapidata/api_client/models/__init__.py +25 -0
  6. rapidata/api_client/models/add_validation_rapid_result.py +87 -0
  7. rapidata/api_client/models/attach_category_result.py +98 -0
  8. rapidata/api_client/models/bounding_box_result.py +106 -0
  9. rapidata/api_client/models/classification_metadata.py +0 -10
  10. rapidata/api_client/models/compare_result.py +98 -0
  11. rapidata/api_client/models/coordinate.py +108 -0
  12. rapidata/api_client/models/count_metadata.py +0 -10
  13. rapidata/api_client/models/create_demographic_rapid_model.py +93 -0
  14. rapidata/api_client/models/create_order_model_referee.py +22 -8
  15. rapidata/api_client/models/early_stopping_referee_model.py +98 -0
  16. rapidata/api_client/models/free_text_result.py +98 -0
  17. rapidata/api_client/models/image_dimension_metadata.py +0 -10
  18. rapidata/api_client/models/line.py +106 -0
  19. rapidata/api_client/models/line_point.py +98 -0
  20. rapidata/api_client/models/line_result.py +106 -0
  21. rapidata/api_client/models/locate_coordinate.py +98 -0
  22. rapidata/api_client/models/locate_result.py +106 -0
  23. rapidata/api_client/models/location_metadata.py +0 -10
  24. rapidata/api_client/models/named_entity_result.py +106 -0
  25. rapidata/api_client/models/order_query_get200_response.py +12 -12
  26. rapidata/api_client/models/original_filename_metadata.py +0 -10
  27. rapidata/api_client/models/polygon_result.py +106 -0
  28. rapidata/api_client/models/prompt_metadata.py +0 -10
  29. rapidata/api_client/models/query_model.py +112 -0
  30. rapidata/api_client/models/query_validation_rapids_result.py +98 -0
  31. rapidata/api_client/models/query_validation_rapids_result_asset.py +174 -0
  32. rapidata/api_client/models/query_validation_rapids_result_paged_result.py +105 -0
  33. rapidata/api_client/models/rapid_result_model.py +93 -0
  34. rapidata/api_client/models/rapid_result_model_result.py +252 -0
  35. rapidata/api_client/models/rapid_skipped_model.py +89 -0
  36. rapidata/api_client/models/shape.py +104 -0
  37. rapidata/api_client/models/skip_result.py +96 -0
  38. rapidata/api_client/models/text_metadata.py +0 -7
  39. rapidata/api_client/models/transcription_metadata.py +0 -7
  40. rapidata/api_client/models/transcription_result.py +106 -0
  41. rapidata/rapidata_client/config.py +9 -0
  42. rapidata/rapidata_client/dataset/rapidata_dataset.py +1 -2
  43. rapidata/rapidata_client/dataset/rapidata_validation_set.py +1 -2
  44. rapidata/rapidata_client/dataset/validation_rapid_parts.py +1 -2
  45. rapidata/rapidata_client/order/rapidata_order_builder.py +4 -4
  46. rapidata/rapidata_client/rapidata_client.py +5 -0
  47. rapidata/rapidata_client/utils/__init__.py +0 -0
  48. rapidata/rapidata_client/utils/utils.py +22 -0
  49. rapidata/service/openapi_service.py +6 -2
  50. {rapidata-0.1.18.dist-info → rapidata-0.1.20.dist-info}/METADATA +3 -2
  51. {rapidata-0.1.18.dist-info → rapidata-0.1.20.dist-info}/RECORD +53 -25
  52. rapidata/rapidata_client/types/__init__.py +0 -1
  53. {rapidata-0.1.18.dist-info → rapidata-0.1.20.dist-info}/LICENSE +0 -0
  54. {rapidata-0.1.18.dist-info → rapidata-0.1.20.dist-info}/WHEEL +0 -0
@@ -0,0 +1,106 @@
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 rapidata.api_client.models.shape import Shape
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PolygonResult(BaseModel):
27
+ """
28
+ PolygonResult
29
+ """ # noqa: E501
30
+ t: StrictStr = Field(description="Discriminator value for PolygonResult", alias="_t")
31
+ shapes: List[Shape]
32
+ rapid_id: StrictStr = Field(alias="rapidId")
33
+ __properties: ClassVar[List[str]] = ["_t", "shapes", "rapidId"]
34
+
35
+ @field_validator('t')
36
+ def t_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['PolygonResult']):
39
+ raise ValueError("must be one of enum values ('PolygonResult')")
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 PolygonResult 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
+ # override the default output from pydantic by calling `to_dict()` of each item in shapes (list)
82
+ _items = []
83
+ if self.shapes:
84
+ for _item_shapes in self.shapes:
85
+ if _item_shapes:
86
+ _items.append(_item_shapes.to_dict())
87
+ _dict['shapes'] = _items
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of PolygonResult from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'PolygonResult',
101
+ "shapes": [Shape.from_dict(_item) for _item in obj["shapes"]] if obj.get("shapes") is not None else None,
102
+ "rapidId": obj.get("rapidId")
103
+ })
104
+ return _obj
105
+
106
+
@@ -39,16 +39,6 @@ class PromptMetadata(BaseModel):
39
39
  raise ValueError("must be one of enum values ('PromptMetadata')")
40
40
  return value
41
41
 
42
- @field_validator('visibilities')
43
- def visibilities_validate_enum(cls, value):
44
- """Validates the enum"""
45
- if value is None:
46
- return value
47
-
48
- if value not in set(['None', 'Users', 'Customers', 'Admins', 'All']):
49
- raise ValueError("must be one of enum values ('None', 'Users', 'Customers', 'Admins', 'All')")
50
- return value
51
-
52
42
  model_config = ConfigDict(
53
43
  populate_by_name=True,
54
44
  validate_assignment=True,
@@ -0,0 +1,112 @@
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.page_info import PageInfo
23
+ from rapidata.api_client.models.root_filter import RootFilter
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 QueryModel(BaseModel):
29
+ """
30
+ The model for a query.
31
+ """ # noqa: E501
32
+ page_info: Optional[PageInfo] = Field(default=None, alias="pageInfo")
33
+ filter: Optional[RootFilter] = None
34
+ sort_criteria: Optional[List[SortCriterion]] = Field(default=None, description="The sort criteria to apply to the query.", alias="sortCriteria")
35
+ __properties: ClassVar[List[str]] = ["pageInfo", "filter", "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 QueryModel 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_info
77
+ if self.page_info:
78
+ _dict['pageInfo'] = self.page_info.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of filter
80
+ if self.filter:
81
+ _dict['filter'] = self.filter.to_dict()
82
+ # override the default output from pydantic by calling `to_dict()` of each item in sort_criteria (list)
83
+ _items = []
84
+ if self.sort_criteria:
85
+ for _item_sort_criteria in self.sort_criteria:
86
+ if _item_sort_criteria:
87
+ _items.append(_item_sort_criteria.to_dict())
88
+ _dict['sortCriteria'] = _items
89
+ # set to None if sort_criteria (nullable) is None
90
+ # and model_fields_set contains the field
91
+ if self.sort_criteria is None and "sort_criteria" in self.model_fields_set:
92
+ _dict['sortCriteria'] = None
93
+
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of QueryModel from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate({
106
+ "pageInfo": PageInfo.from_dict(obj["pageInfo"]) if obj.get("pageInfo") is not None else None,
107
+ "filter": RootFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None,
108
+ "sortCriteria": [SortCriterion.from_dict(_item) for _item in obj["sortCriteria"]] if obj.get("sortCriteria") is not None else None
109
+ })
110
+ return _obj
111
+
112
+
@@ -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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.query_validation_rapids_result_asset import QueryValidationRapidsResultAsset
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class QueryValidationRapidsResult(BaseModel):
27
+ """
28
+ QueryValidationRapidsResult
29
+ """ # noqa: E501
30
+ type: StrictStr
31
+ asset: Optional[QueryValidationRapidsResultAsset]
32
+ __properties: ClassVar[List[str]] = ["type", "asset"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of QueryValidationRapidsResult from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of asset
74
+ if self.asset:
75
+ _dict['asset'] = self.asset.to_dict()
76
+ # set to None if asset (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.asset is None and "asset" in self.model_fields_set:
79
+ _dict['asset'] = None
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of QueryValidationRapidsResult 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
+ "type": obj.get("type"),
94
+ "asset": QueryValidationRapidsResultAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,174 @@
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.file_asset_model import FileAssetModel
21
+ from rapidata.api_client.models.multi_asset_model import MultiAssetModel
22
+ from rapidata.api_client.models.null_asset_model import NullAssetModel
23
+ from rapidata.api_client.models.text_asset_model import TextAssetModel
24
+ from pydantic import StrictStr, Field
25
+ from typing import Union, List, Set, Optional, Dict
26
+ from typing_extensions import Literal, Self
27
+
28
+ QUERYVALIDATIONRAPIDSRESULTASSET_ONE_OF_SCHEMAS = ["FileAssetModel", "MultiAssetModel", "NullAssetModel", "TextAssetModel"]
29
+
30
+ class QueryValidationRapidsResultAsset(BaseModel):
31
+ """
32
+ QueryValidationRapidsResultAsset
33
+ """
34
+ # data type: FileAssetModel
35
+ oneof_schema_1_validator: Optional[FileAssetModel] = None
36
+ # data type: MultiAssetModel
37
+ oneof_schema_2_validator: Optional[MultiAssetModel] = None
38
+ # data type: NullAssetModel
39
+ oneof_schema_3_validator: Optional[NullAssetModel] = None
40
+ # data type: TextAssetModel
41
+ oneof_schema_4_validator: Optional[TextAssetModel] = None
42
+ actual_instance: Optional[Union[FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel]] = None
43
+ one_of_schemas: Set[str] = { "FileAssetModel", "MultiAssetModel", "NullAssetModel", "TextAssetModel" }
44
+
45
+ model_config = ConfigDict(
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+
51
+ discriminator_value_class_map: Dict[str, str] = {
52
+ }
53
+
54
+ def __init__(self, *args, **kwargs) -> None:
55
+ if args:
56
+ if len(args) > 1:
57
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
58
+ if kwargs:
59
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
60
+ super().__init__(actual_instance=args[0])
61
+ else:
62
+ super().__init__(**kwargs)
63
+
64
+ @field_validator('actual_instance')
65
+ def actual_instance_must_validate_oneof(cls, v):
66
+ if v is None:
67
+ return v
68
+
69
+ instance = QueryValidationRapidsResultAsset.model_construct()
70
+ error_messages = []
71
+ match = 0
72
+ # validate data type: FileAssetModel
73
+ if not isinstance(v, FileAssetModel):
74
+ error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetModel`")
75
+ else:
76
+ match += 1
77
+ # validate data type: MultiAssetModel
78
+ if not isinstance(v, MultiAssetModel):
79
+ error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetModel`")
80
+ else:
81
+ match += 1
82
+ # validate data type: NullAssetModel
83
+ if not isinstance(v, NullAssetModel):
84
+ error_messages.append(f"Error! Input type `{type(v)}` is not `NullAssetModel`")
85
+ else:
86
+ match += 1
87
+ # validate data type: TextAssetModel
88
+ if not isinstance(v, TextAssetModel):
89
+ error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetModel`")
90
+ else:
91
+ match += 1
92
+ if match > 1:
93
+ # more than 1 match
94
+ raise ValueError("Multiple matches found when setting `actual_instance` in QueryValidationRapidsResultAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
95
+ elif match == 0:
96
+ # no match
97
+ raise ValueError("No match found when setting `actual_instance` in QueryValidationRapidsResultAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
98
+ else:
99
+ return v
100
+
101
+ @classmethod
102
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
103
+ return cls.from_json(json.dumps(obj))
104
+
105
+ @classmethod
106
+ def from_json(cls, json_str: Optional[str]) -> Self:
107
+ """Returns the object represented by the json string"""
108
+ instance = cls.model_construct()
109
+ if json_str is None:
110
+ return instance
111
+
112
+ error_messages = []
113
+ match = 0
114
+
115
+ # deserialize data into FileAssetModel
116
+ try:
117
+ instance.actual_instance = FileAssetModel.from_json(json_str)
118
+ match += 1
119
+ except (ValidationError, ValueError) as e:
120
+ error_messages.append(str(e))
121
+ # deserialize data into MultiAssetModel
122
+ try:
123
+ instance.actual_instance = MultiAssetModel.from_json(json_str)
124
+ match += 1
125
+ except (ValidationError, ValueError) as e:
126
+ error_messages.append(str(e))
127
+ # deserialize data into NullAssetModel
128
+ try:
129
+ instance.actual_instance = NullAssetModel.from_json(json_str)
130
+ match += 1
131
+ except (ValidationError, ValueError) as e:
132
+ error_messages.append(str(e))
133
+ # deserialize data into TextAssetModel
134
+ try:
135
+ instance.actual_instance = TextAssetModel.from_json(json_str)
136
+ match += 1
137
+ except (ValidationError, ValueError) as e:
138
+ error_messages.append(str(e))
139
+
140
+ if match > 1:
141
+ # more than 1 match
142
+ raise ValueError("Multiple matches found when deserializing the JSON string into QueryValidationRapidsResultAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
143
+ elif match == 0:
144
+ # no match
145
+ raise ValueError("No match found when deserializing the JSON string into QueryValidationRapidsResultAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
146
+ else:
147
+ return instance
148
+
149
+ def to_json(self) -> str:
150
+ """Returns the JSON representation of the actual instance"""
151
+ if self.actual_instance is None:
152
+ return "null"
153
+
154
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
155
+ return self.actual_instance.to_json()
156
+ else:
157
+ return json.dumps(self.actual_instance)
158
+
159
+ def to_dict(self) -> Optional[Union[Dict[str, Any], FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel]]:
160
+ """Returns the dict representation of the actual instance"""
161
+ if self.actual_instance is None:
162
+ return None
163
+
164
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
165
+ return self.actual_instance.to_dict()
166
+ else:
167
+ # primitive type
168
+ return self.actual_instance
169
+
170
+ def to_str(self) -> str:
171
+ """Returns the string representation of the actual instance"""
172
+ return pprint.pformat(self.model_dump())
173
+
174
+
@@ -0,0 +1,105 @@
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.query_validation_rapids_result import QueryValidationRapidsResult
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class QueryValidationRapidsResultPagedResult(BaseModel):
27
+ """
28
+ QueryValidationRapidsResultPagedResult
29
+ """ # noqa: E501
30
+ total: StrictInt
31
+ page: StrictInt
32
+ page_size: StrictInt = Field(alias="pageSize")
33
+ items: List[QueryValidationRapidsResult]
34
+ total_pages: Optional[StrictInt] = Field(default=None, alias="totalPages")
35
+ __properties: ClassVar[List[str]] = ["total", "page", "pageSize", "items", "totalPages"]
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 QueryValidationRapidsResultPagedResult 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
+ * OpenAPI `readOnly` fields are excluded.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "total_pages",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
79
+ _items = []
80
+ if self.items:
81
+ for _item_items in self.items:
82
+ if _item_items:
83
+ _items.append(_item_items.to_dict())
84
+ _dict['items'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of QueryValidationRapidsResultPagedResult 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
+ "total": obj.get("total"),
98
+ "page": obj.get("page"),
99
+ "pageSize": obj.get("pageSize"),
100
+ "items": [QueryValidationRapidsResult.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
101
+ "totalPages": obj.get("totalPages")
102
+ })
103
+ return _obj
104
+
105
+