rapidata 2.41.3__py3-none-any.whl → 2.42.1__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 (74) hide show
  1. rapidata/__init__.py +1 -5
  2. rapidata/api_client/__init__.py +14 -14
  3. rapidata/api_client/api/__init__.py +1 -0
  4. rapidata/api_client/api/asset_api.py +851 -0
  5. rapidata/api_client/api/benchmark_api.py +298 -0
  6. rapidata/api_client/api/customer_rapid_api.py +29 -43
  7. rapidata/api_client/api/dataset_api.py +163 -1143
  8. rapidata/api_client/api/participant_api.py +28 -74
  9. rapidata/api_client/api/validation_set_api.py +283 -0
  10. rapidata/api_client/models/__init__.py +13 -14
  11. rapidata/api_client/models/add_validation_rapid_model.py +3 -3
  12. rapidata/api_client/models/add_validation_rapid_new_model.py +152 -0
  13. rapidata/api_client/models/add_validation_rapid_new_model_asset.py +182 -0
  14. rapidata/api_client/models/compare_workflow_model.py +3 -3
  15. rapidata/api_client/models/create_datapoint_from_files_model.py +3 -3
  16. rapidata/api_client/models/create_datapoint_from_text_sources_model.py +3 -3
  17. rapidata/api_client/models/create_datapoint_from_urls_model.py +3 -3
  18. rapidata/api_client/models/create_datapoint_model.py +108 -0
  19. rapidata/api_client/models/create_datapoint_model_asset.py +182 -0
  20. rapidata/api_client/models/create_demographic_rapid_model.py +13 -2
  21. rapidata/api_client/models/create_demographic_rapid_model_asset.py +188 -0
  22. rapidata/api_client/models/create_demographic_rapid_model_new.py +119 -0
  23. rapidata/api_client/models/create_sample_model.py +8 -2
  24. rapidata/api_client/models/create_sample_model_asset.py +182 -0
  25. rapidata/api_client/models/create_sample_model_obsolete.py +87 -0
  26. rapidata/api_client/models/file_asset_input_file.py +8 -22
  27. rapidata/api_client/models/fork_benchmark_result.py +87 -0
  28. rapidata/api_client/models/form_file_wrapper.py +17 -2
  29. rapidata/api_client/models/get_asset_metadata_result.py +100 -0
  30. rapidata/api_client/models/multi_asset_input_assets_inner.py +10 -24
  31. rapidata/api_client/models/prompt_asset_metadata_input.py +3 -3
  32. rapidata/api_client/models/proxy_file_wrapper.py +17 -2
  33. rapidata/api_client/models/stream_file_wrapper.py +25 -3
  34. rapidata/api_client/models/submit_prompt_model.py +3 -3
  35. rapidata/api_client/models/text_metadata.py +6 -1
  36. rapidata/api_client/models/text_metadata_model.py +7 -2
  37. rapidata/api_client/models/upload_file_from_url_result.py +87 -0
  38. rapidata/api_client/models/upload_file_result.py +87 -0
  39. rapidata/api_client/models/zip_entry_file_wrapper.py +33 -2
  40. rapidata/api_client_README.md +28 -25
  41. rapidata/rapidata_client/__init__.py +0 -1
  42. rapidata/rapidata_client/benchmark/participant/_participant.py +25 -24
  43. rapidata/rapidata_client/benchmark/rapidata_benchmark.py +89 -102
  44. rapidata/rapidata_client/datapoints/__init__.py +0 -1
  45. rapidata/rapidata_client/datapoints/_asset_uploader.py +71 -0
  46. rapidata/rapidata_client/datapoints/_datapoint.py +58 -171
  47. rapidata/rapidata_client/datapoints/_datapoint_uploader.py +95 -0
  48. rapidata/rapidata_client/datapoints/assets/__init__.py +0 -11
  49. rapidata/rapidata_client/datapoints/metadata/_media_asset_metadata.py +10 -7
  50. rapidata/rapidata_client/demographic/demographic_manager.py +21 -8
  51. rapidata/rapidata_client/exceptions/failed_upload_exception.py +0 -62
  52. rapidata/rapidata_client/order/_rapidata_order_builder.py +0 -10
  53. rapidata/rapidata_client/order/dataset/_rapidata_dataset.py +65 -187
  54. rapidata/rapidata_client/order/rapidata_order_manager.py +62 -124
  55. rapidata/rapidata_client/validation/rapidata_validation_set.py +9 -5
  56. rapidata/rapidata_client/validation/rapids/_validation_rapid_uploader.py +101 -0
  57. rapidata/rapidata_client/validation/rapids/box.py +35 -11
  58. rapidata/rapidata_client/validation/rapids/rapids.py +26 -128
  59. rapidata/rapidata_client/validation/rapids/rapids_manager.py +123 -104
  60. rapidata/rapidata_client/validation/validation_set_manager.py +41 -38
  61. rapidata/rapidata_client/workflow/_ranking_workflow.py +14 -17
  62. rapidata/rapidata_client/workflow/_select_words_workflow.py +3 -16
  63. rapidata/service/openapi_service.py +8 -3
  64. {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/METADATA +1 -1
  65. {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/RECORD +67 -58
  66. {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/WHEEL +1 -1
  67. rapidata/rapidata_client/datapoints/assets/_base_asset.py +0 -13
  68. rapidata/rapidata_client/datapoints/assets/_media_asset.py +0 -318
  69. rapidata/rapidata_client/datapoints/assets/_multi_asset.py +0 -61
  70. rapidata/rapidata_client/datapoints/assets/_sessions.py +0 -40
  71. rapidata/rapidata_client/datapoints/assets/_text_asset.py +0 -34
  72. rapidata/rapidata_client/datapoints/assets/data_type_enum.py +0 -8
  73. rapidata/rapidata_client/order/dataset/_progress_tracker.py +0 -100
  74. {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/licenses/LICENSE +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.existing_asset_input import ExistingAssetInput
21
+ from rapidata.api_client.models.file_asset_input import FileAssetInput
22
+ from rapidata.api_client.models.multi_asset_input import MultiAssetInput
23
+ from rapidata.api_client.models.text_asset_input import TextAssetInput
24
+ from rapidata.api_client.models.url_asset_input import UrlAssetInput
25
+ from pydantic import StrictStr, Field
26
+ from typing import Union, List, Set, Optional, Dict
27
+ from typing_extensions import Literal, Self
28
+
29
+ CREATESAMPLEMODELASSET_ONE_OF_SCHEMAS = ["ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput"]
30
+
31
+ class CreateSampleModelAsset(BaseModel):
32
+ """
33
+ The asset input for the sample.
34
+ """
35
+ # data type: ExistingAssetInput
36
+ oneof_schema_1_validator: Optional[ExistingAssetInput] = None
37
+ # data type: FileAssetInput
38
+ oneof_schema_2_validator: Optional[FileAssetInput] = None
39
+ # data type: MultiAssetInput
40
+ oneof_schema_3_validator: Optional[MultiAssetInput] = None
41
+ # data type: TextAssetInput
42
+ oneof_schema_4_validator: Optional[TextAssetInput] = None
43
+ # data type: UrlAssetInput
44
+ oneof_schema_5_validator: Optional[UrlAssetInput] = None
45
+ actual_instance: Optional[Union[ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]] = None
46
+ one_of_schemas: Set[str] = { "ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput" }
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 = CreateSampleModelAsset.model_construct()
70
+ error_messages = []
71
+ match = 0
72
+ # validate data type: ExistingAssetInput
73
+ if not isinstance(v, ExistingAssetInput):
74
+ error_messages.append(f"Error! Input type `{type(v)}` is not `ExistingAssetInput`")
75
+ else:
76
+ match += 1
77
+ # validate data type: FileAssetInput
78
+ if not isinstance(v, FileAssetInput):
79
+ error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetInput`")
80
+ else:
81
+ match += 1
82
+ # validate data type: MultiAssetInput
83
+ if not isinstance(v, MultiAssetInput):
84
+ error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetInput`")
85
+ else:
86
+ match += 1
87
+ # validate data type: TextAssetInput
88
+ if not isinstance(v, TextAssetInput):
89
+ error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetInput`")
90
+ else:
91
+ match += 1
92
+ # validate data type: UrlAssetInput
93
+ if not isinstance(v, UrlAssetInput):
94
+ error_messages.append(f"Error! Input type `{type(v)}` is not `UrlAssetInput`")
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 CreateSampleModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
100
+ elif match == 0:
101
+ # no match
102
+ raise ValueError("No match found when setting `actual_instance` in CreateSampleModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. 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 ExistingAssetInput
118
+ try:
119
+ instance.actual_instance = ExistingAssetInput.from_json(json_str)
120
+ match += 1
121
+ except (ValidationError, ValueError) as e:
122
+ error_messages.append(str(e))
123
+ # deserialize data into FileAssetInput
124
+ try:
125
+ instance.actual_instance = FileAssetInput.from_json(json_str)
126
+ match += 1
127
+ except (ValidationError, ValueError) as e:
128
+ error_messages.append(str(e))
129
+ # deserialize data into MultiAssetInput
130
+ try:
131
+ instance.actual_instance = MultiAssetInput.from_json(json_str)
132
+ match += 1
133
+ except (ValidationError, ValueError) as e:
134
+ error_messages.append(str(e))
135
+ # deserialize data into TextAssetInput
136
+ try:
137
+ instance.actual_instance = TextAssetInput.from_json(json_str)
138
+ match += 1
139
+ except (ValidationError, ValueError) as e:
140
+ error_messages.append(str(e))
141
+ # deserialize data into UrlAssetInput
142
+ try:
143
+ instance.actual_instance = UrlAssetInput.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 CreateSampleModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
151
+ elif match == 0:
152
+ # no match
153
+ raise ValueError("No match found when deserializing the JSON string into CreateSampleModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. 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], ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]]:
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,87 @@
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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class CreateSampleModelObsolete(BaseModel):
26
+ """
27
+ The model used to create a sample to a participant.
28
+ """ # noqa: E501
29
+ identifier: StrictStr = Field(description="The identifier used to correlate samples of different participants.")
30
+ __properties: ClassVar[List[str]] = ["identifier"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of CreateSampleModelObsolete from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of CreateSampleModelObsolete from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "identifier": obj.get("identifier")
84
+ })
85
+ return _obj
86
+
87
+
@@ -18,7 +18,6 @@ import pprint
18
18
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
19
19
  from typing import Any, List, Optional
20
20
  from rapidata.api_client.models.form_file_wrapper import FormFileWrapper
21
- from rapidata.api_client.models.local_file_wrapper import LocalFileWrapper
22
21
  from rapidata.api_client.models.proxy_file_wrapper import ProxyFileWrapper
23
22
  from rapidata.api_client.models.stream_file_wrapper import StreamFileWrapper
24
23
  from rapidata.api_client.models.zip_entry_file_wrapper import ZipEntryFileWrapper
@@ -26,7 +25,7 @@ from pydantic import StrictStr, Field
26
25
  from typing import Union, List, Set, Optional, Dict
27
26
  from typing_extensions import Literal, Self
28
27
 
29
- FILEASSETINPUTFILE_ONE_OF_SCHEMAS = ["FormFileWrapper", "LocalFileWrapper", "ProxyFileWrapper", "StreamFileWrapper", "ZipEntryFileWrapper"]
28
+ FILEASSETINPUTFILE_ONE_OF_SCHEMAS = ["FormFileWrapper", "ProxyFileWrapper", "StreamFileWrapper", "ZipEntryFileWrapper"]
30
29
 
31
30
  class FileAssetInputFile(BaseModel):
32
31
  """
@@ -40,10 +39,8 @@ class FileAssetInputFile(BaseModel):
40
39
  oneof_schema_3_validator: Optional[StreamFileWrapper] = None
41
40
  # data type: ZipEntryFileWrapper
42
41
  oneof_schema_4_validator: Optional[ZipEntryFileWrapper] = None
43
- # data type: LocalFileWrapper
44
- oneof_schema_5_validator: Optional[LocalFileWrapper] = None
45
- actual_instance: Optional[Union[FormFileWrapper, LocalFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper]] = None
46
- one_of_schemas: Set[str] = { "FormFileWrapper", "LocalFileWrapper", "ProxyFileWrapper", "StreamFileWrapper", "ZipEntryFileWrapper" }
42
+ actual_instance: Optional[Union[FormFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper]] = None
43
+ one_of_schemas: Set[str] = { "FormFileWrapper", "ProxyFileWrapper", "StreamFileWrapper", "ZipEntryFileWrapper" }
47
44
 
48
45
  model_config = ConfigDict(
49
46
  validate_assignment=True,
@@ -89,17 +86,12 @@ class FileAssetInputFile(BaseModel):
89
86
  error_messages.append(f"Error! Input type `{type(v)}` is not `ZipEntryFileWrapper`")
90
87
  else:
91
88
  match += 1
92
- # validate data type: LocalFileWrapper
93
- if not isinstance(v, LocalFileWrapper):
94
- error_messages.append(f"Error! Input type `{type(v)}` is not `LocalFileWrapper`")
95
- else:
96
- match += 1
97
89
  if match > 1:
98
90
  # more than 1 match
99
- raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetInputFile with oneOf schemas: FormFileWrapper, LocalFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
91
+ raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetInputFile with oneOf schemas: FormFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
100
92
  elif match == 0:
101
93
  # no match
102
- raise ValueError("No match found when setting `actual_instance` in FileAssetInputFile with oneOf schemas: FormFileWrapper, LocalFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
94
+ raise ValueError("No match found when setting `actual_instance` in FileAssetInputFile with oneOf schemas: FormFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
103
95
  else:
104
96
  return v
105
97
 
@@ -138,19 +130,13 @@ class FileAssetInputFile(BaseModel):
138
130
  match += 1
139
131
  except (ValidationError, ValueError) as e:
140
132
  error_messages.append(str(e))
141
- # deserialize data into LocalFileWrapper
142
- try:
143
- instance.actual_instance = LocalFileWrapper.from_json(json_str)
144
- match += 1
145
- except (ValidationError, ValueError) as e:
146
- error_messages.append(str(e))
147
133
 
148
134
  if match > 1:
149
135
  # more than 1 match
150
- raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetInputFile with oneOf schemas: FormFileWrapper, LocalFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
136
+ raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetInputFile with oneOf schemas: FormFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
151
137
  elif match == 0:
152
138
  # no match
153
- raise ValueError("No match found when deserializing the JSON string into FileAssetInputFile with oneOf schemas: FormFileWrapper, LocalFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
139
+ raise ValueError("No match found when deserializing the JSON string into FileAssetInputFile with oneOf schemas: FormFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper. Details: " + ", ".join(error_messages))
154
140
  else:
155
141
  return instance
156
142
 
@@ -164,7 +150,7 @@ class FileAssetInputFile(BaseModel):
164
150
  else:
165
151
  return json.dumps(self.actual_instance)
166
152
 
167
- def to_dict(self) -> Optional[Union[Dict[str, Any], FormFileWrapper, LocalFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper]]:
153
+ def to_dict(self) -> Optional[Union[Dict[str, Any], FormFileWrapper, ProxyFileWrapper, StreamFileWrapper, ZipEntryFileWrapper]]:
168
154
  """Returns the dict representation of the actual instance"""
169
155
  if self.actual_instance is None:
170
156
  return None
@@ -0,0 +1,87 @@
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
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ForkBenchmarkResult(BaseModel):
26
+ """
27
+ ForkBenchmarkResult
28
+ """ # noqa: E501
29
+ id: StrictStr
30
+ __properties: ClassVar[List[str]] = ["id"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of ForkBenchmarkResult from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of ForkBenchmarkResult from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "id": obj.get("id")
84
+ })
85
+ return _obj
86
+
87
+
@@ -19,6 +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.file_asset_metadata_value import FileAssetMetadataValue
22
23
  from typing import Optional, Set
23
24
  from typing_extensions import Self
24
25
 
@@ -31,7 +32,8 @@ class FormFileWrapper(BaseModel):
31
32
  content_length: Optional[StrictInt] = Field(default=None, alias="contentLength")
32
33
  content_type: Optional[StrictStr] = Field(default=None, alias="contentType")
33
34
  is_in_memory: Optional[StrictBool] = Field(default=None, alias="isInMemory")
34
- __properties: ClassVar[List[str]] = ["_t", "name", "contentLength", "contentType", "isInMemory"]
35
+ metadata: Optional[Dict[str, FileAssetMetadataValue]] = None
36
+ __properties: ClassVar[List[str]] = ["_t", "name", "contentLength", "contentType", "isInMemory", "metadata"]
35
37
 
36
38
  @field_validator('t')
37
39
  def t_validate_enum(cls, value):
@@ -87,6 +89,13 @@ class FormFileWrapper(BaseModel):
87
89
  exclude=excluded_fields,
88
90
  exclude_none=True,
89
91
  )
92
+ # override the default output from pydantic by calling `to_dict()` of each value in metadata (dict)
93
+ _field_dict = {}
94
+ if self.metadata:
95
+ for _key_metadata in self.metadata:
96
+ if self.metadata[_key_metadata]:
97
+ _field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
98
+ _dict['metadata'] = _field_dict
90
99
  # set to None if content_length (nullable) is None
91
100
  # and model_fields_set contains the field
92
101
  if self.content_length is None and "content_length" in self.model_fields_set:
@@ -113,7 +122,13 @@ class FormFileWrapper(BaseModel):
113
122
  "name": obj.get("name"),
114
123
  "contentLength": obj.get("contentLength"),
115
124
  "contentType": obj.get("contentType"),
116
- "isInMemory": obj.get("isInMemory")
125
+ "isInMemory": obj.get("isInMemory"),
126
+ "metadata": dict(
127
+ (_k, FileAssetMetadataValue.from_dict(_v))
128
+ for _k, _v in obj["metadata"].items()
129
+ )
130
+ if obj.get("metadata") is not None
131
+ else None
117
132
  })
118
133
  return _obj
119
134
 
@@ -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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class GetAssetMetadataResult(BaseModel):
27
+ """
28
+ GetAssetMetadataResult
29
+ """ # noqa: E501
30
+ metadata: Dict[str, FileAssetMetadataValue]
31
+ __properties: ClassVar[List[str]] = ["metadata"]
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 GetAssetMetadataResult 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 each value in metadata (dict)
73
+ _field_dict = {}
74
+ if self.metadata:
75
+ for _key_metadata in self.metadata:
76
+ if self.metadata[_key_metadata]:
77
+ _field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
78
+ _dict['metadata'] = _field_dict
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of GetAssetMetadataResult from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "metadata": dict(
92
+ (_k, FileAssetMetadataValue.from_dict(_v))
93
+ for _k, _v in obj["metadata"].items()
94
+ )
95
+ if obj.get("metadata") is not None
96
+ else None
97
+ })
98
+ return _obj
99
+
100
+