aind-metadata-service-async-client 1.0.7__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 aind-metadata-service-async-client might be problematic. Click here for more details.

Files changed (33) hide show
  1. aind_metadata_service_async_client/__init__.py +52 -0
  2. aind_metadata_service_async_client/api/__init__.py +6 -0
  3. aind_metadata_service_async_client/api/default_api.py +3818 -0
  4. aind_metadata_service_async_client/api/healthcheck_api.py +281 -0
  5. aind_metadata_service_async_client/api_client.py +800 -0
  6. aind_metadata_service_async_client/api_response.py +21 -0
  7. aind_metadata_service_async_client/configuration.py +568 -0
  8. aind_metadata_service_async_client/exceptions.py +216 -0
  9. aind_metadata_service_async_client/models/__init__.py +34 -0
  10. aind_metadata_service_async_client/models/anyof_schema1_validator.py +144 -0
  11. aind_metadata_service_async_client/models/average_hit_rate.py +144 -0
  12. aind_metadata_service_async_client/models/fov_coordinate_ap.py +144 -0
  13. aind_metadata_service_async_client/models/fov_coordinate_ml.py +112 -0
  14. aind_metadata_service_async_client/models/health_check.py +99 -0
  15. aind_metadata_service_async_client/models/hit_rate_trials010.py +144 -0
  16. aind_metadata_service_async_client/models/hit_rate_trials2040.py +144 -0
  17. aind_metadata_service_async_client/models/http_validation_error.py +95 -0
  18. aind_metadata_service_async_client/models/input_source.py +122 -0
  19. aind_metadata_service_async_client/models/job_settings.py +369 -0
  20. aind_metadata_service_async_client/models/job_settings_starting_lickport_position_inner.py +138 -0
  21. aind_metadata_service_async_client/models/output_directory.py +108 -0
  22. aind_metadata_service_async_client/models/slims_workflow.py +40 -0
  23. aind_metadata_service_async_client/models/total_hits.py +144 -0
  24. aind_metadata_service_async_client/models/trial_num.py +144 -0
  25. aind_metadata_service_async_client/models/user_settings_config_file.py +108 -0
  26. aind_metadata_service_async_client/models/validation_error.py +99 -0
  27. aind_metadata_service_async_client/models/validation_error_loc_inner.py +138 -0
  28. aind_metadata_service_async_client/py.typed +0 -0
  29. aind_metadata_service_async_client/rest.py +213 -0
  30. aind_metadata_service_async_client-1.0.7.dist-info/METADATA +25 -0
  31. aind_metadata_service_async_client-1.0.7.dist-info/RECORD +33 -0
  32. aind_metadata_service_async_client-1.0.7.dist-info/WHEEL +5 -0
  33. aind_metadata_service_async_client-1.0.7.dist-info/top_level.txt +1 -0
@@ -0,0 +1,122 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ aind-metadata-service
5
+
6
+ ## aind-metadata-service Service to pull data from example backend.
7
+
8
+ The version of the OpenAPI document: 1.0.7
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class InputSource(BaseModel):
26
+ """
27
+ Location or locations of data sources to parse for metadata.
28
+ """ # noqa: E501
29
+ anyof_schema_1_validator: Optional[StrictStr] = None
30
+ anyof_schema_2_validator: Optional[StrictStr] = None
31
+ anyof_schema_3_validator: Optional[List[StrictStr]] = None
32
+ anyof_schema_4_validator: Optional[List[StrictStr]] = None
33
+ actual_instance: Optional[Any] = None
34
+ any_of_schemas: Optional[List[StrictStr]] = None
35
+ __properties: ClassVar[List[str]] = ["anyof_schema_1_validator", "anyof_schema_2_validator", "anyof_schema_3_validator", "anyof_schema_4_validator", "actual_instance", "any_of_schemas"]
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 InputSource 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
+ # set to None if anyof_schema_1_validator (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.anyof_schema_1_validator is None and "anyof_schema_1_validator" in self.model_fields_set:
79
+ _dict['anyof_schema_1_validator'] = None
80
+
81
+ # set to None if anyof_schema_2_validator (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.anyof_schema_2_validator is None and "anyof_schema_2_validator" in self.model_fields_set:
84
+ _dict['anyof_schema_2_validator'] = None
85
+
86
+ # set to None if anyof_schema_3_validator (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.anyof_schema_3_validator is None and "anyof_schema_3_validator" in self.model_fields_set:
89
+ _dict['anyof_schema_3_validator'] = None
90
+
91
+ # set to None if anyof_schema_4_validator (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.anyof_schema_4_validator is None and "anyof_schema_4_validator" in self.model_fields_set:
94
+ _dict['anyof_schema_4_validator'] = None
95
+
96
+ # set to None if actual_instance (nullable) is None
97
+ # and model_fields_set contains the field
98
+ if self.actual_instance is None and "actual_instance" in self.model_fields_set:
99
+ _dict['actual_instance'] = None
100
+
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of InputSource from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate({
113
+ "anyof_schema_1_validator": obj.get("anyof_schema_1_validator"),
114
+ "anyof_schema_2_validator": obj.get("anyof_schema_2_validator"),
115
+ "anyof_schema_3_validator": obj.get("anyof_schema_3_validator"),
116
+ "anyof_schema_4_validator": obj.get("anyof_schema_4_validator"),
117
+ "actual_instance": obj.get("actual_instance"),
118
+ "any_of_schemas": obj.get("any_of_schemas")
119
+ })
120
+ return _obj
121
+
122
+
@@ -0,0 +1,369 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ aind-metadata-service
5
+
6
+ ## aind-metadata-service Service to pull data from example backend.
7
+
8
+ The version of the OpenAPI document: 1.0.7
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, StrictBool, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from aind_metadata_service_async_client.models.average_hit_rate import AverageHitRate
23
+ from aind_metadata_service_async_client.models.fov_coordinate_ap import FovCoordinateAp
24
+ from aind_metadata_service_async_client.models.fov_coordinate_ml import FovCoordinateMl
25
+ from aind_metadata_service_async_client.models.hit_rate_trials010 import HitRateTrials010
26
+ from aind_metadata_service_async_client.models.hit_rate_trials2040 import HitRateTrials2040
27
+ from aind_metadata_service_async_client.models.input_source import InputSource
28
+ from aind_metadata_service_async_client.models.job_settings_starting_lickport_position_inner import JobSettingsStartingLickportPositionInner
29
+ from aind_metadata_service_async_client.models.output_directory import OutputDirectory
30
+ from aind_metadata_service_async_client.models.total_hits import TotalHits
31
+ from aind_metadata_service_async_client.models.trial_num import TrialNum
32
+ from aind_metadata_service_async_client.models.user_settings_config_file import UserSettingsConfigFile
33
+ from typing import Optional, Set
34
+ from typing_extensions import Self
35
+
36
+ class JobSettings(BaseModel):
37
+ """
38
+ Data that needs to be input by user. Can be pulled from env vars with BERGAMO prefix or set explicitly.
39
+ """ # noqa: E501
40
+ job_settings_name: Optional[StrictStr] = None
41
+ input_source: Optional[InputSource] = None
42
+ output_directory: Optional[OutputDirectory] = None
43
+ user_settings_config_file: Optional[UserSettingsConfigFile] = None
44
+ experimenter_full_name: List[StrictStr]
45
+ subject_id: StrictStr
46
+ imaging_laser_wavelength: StrictInt
47
+ fov_imaging_depth: StrictInt
48
+ fov_targeted_structure: StrictStr
49
+ notes: Optional[StrictStr]
50
+ mouse_platform_name: Optional[StrictStr] = None
51
+ active_mouse_platform: Optional[StrictBool] = None
52
+ session_type: Optional[StrictStr] = None
53
+ iacuc_protocol: Optional[StrictStr] = None
54
+ rig_id: Optional[StrictStr] = None
55
+ behavior_camera_names: Optional[List[StrictStr]] = None
56
+ ch1_filter_names: Optional[List[StrictStr]] = None
57
+ ch1_detector_name: Optional[StrictStr] = None
58
+ ch1_daq_name: Optional[StrictStr] = None
59
+ ch2_filter_names: Optional[List[StrictStr]] = None
60
+ ch2_detector_name: Optional[StrictStr] = None
61
+ ch2_daq_name: Optional[StrictStr] = None
62
+ imaging_laser_name: Optional[StrictStr] = None
63
+ photostim_laser_name: Optional[StrictStr] = None
64
+ stimulus_device_names: Optional[List[StrictStr]] = None
65
+ photostim_laser_wavelength: Optional[StrictInt] = None
66
+ fov_coordinate_ml: Optional[FovCoordinateMl] = None
67
+ fov_coordinate_ap: Optional[FovCoordinateAp] = None
68
+ fov_reference: Optional[StrictStr] = None
69
+ starting_lickport_position: Optional[List[JobSettingsStartingLickportPositionInner]] = None
70
+ behavior_task_name: Optional[StrictStr] = None
71
+ hit_rate_trials_0_10: Optional[HitRateTrials010] = None
72
+ hit_rate_trials_20_40: Optional[HitRateTrials2040] = None
73
+ total_hits: Optional[TotalHits] = None
74
+ average_hit_rate: Optional[AverageHitRate] = None
75
+ trial_num: Optional[TrialNum] = None
76
+ timezone: Optional[StrictStr] = None
77
+ additional_properties: Optional[Dict[str, Any]] = None
78
+ __properties: ClassVar[List[str]] = ["job_settings_name", "input_source", "output_directory", "user_settings_config_file", "experimenter_full_name", "subject_id", "imaging_laser_wavelength", "fov_imaging_depth", "fov_targeted_structure", "notes", "mouse_platform_name", "active_mouse_platform", "session_type", "iacuc_protocol", "rig_id", "behavior_camera_names", "ch1_filter_names", "ch1_detector_name", "ch1_daq_name", "ch2_filter_names", "ch2_detector_name", "ch2_daq_name", "imaging_laser_name", "photostim_laser_name", "stimulus_device_names", "photostim_laser_wavelength", "fov_coordinate_ml", "fov_coordinate_ap", "fov_reference", "starting_lickport_position", "behavior_task_name", "hit_rate_trials_0_10", "hit_rate_trials_20_40", "total_hits", "average_hit_rate", "trial_num", "timezone", "additional_properties"]
79
+
80
+ model_config = ConfigDict(
81
+ populate_by_name=True,
82
+ validate_assignment=True,
83
+ protected_namespaces=(),
84
+ )
85
+
86
+
87
+ def to_str(self) -> str:
88
+ """Returns the string representation of the model using alias"""
89
+ return pprint.pformat(self.model_dump(by_alias=True))
90
+
91
+ def to_json(self) -> str:
92
+ """Returns the JSON representation of the model using alias"""
93
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
94
+ return json.dumps(self.to_dict())
95
+
96
+ @classmethod
97
+ def from_json(cls, json_str: str) -> Optional[Self]:
98
+ """Create an instance of JobSettings from a JSON string"""
99
+ return cls.from_dict(json.loads(json_str))
100
+
101
+ def to_dict(self) -> Dict[str, Any]:
102
+ """Return the dictionary representation of the model using alias.
103
+
104
+ This has the following differences from calling pydantic's
105
+ `self.model_dump(by_alias=True)`:
106
+
107
+ * `None` is only added to the output dict for nullable fields that
108
+ were set at model initialization. Other fields with value `None`
109
+ are ignored.
110
+ """
111
+ excluded_fields: Set[str] = set([
112
+ ])
113
+
114
+ _dict = self.model_dump(
115
+ by_alias=True,
116
+ exclude=excluded_fields,
117
+ exclude_none=True,
118
+ )
119
+ # override the default output from pydantic by calling `to_dict()` of input_source
120
+ if self.input_source:
121
+ _dict['input_source'] = self.input_source.to_dict()
122
+ # override the default output from pydantic by calling `to_dict()` of output_directory
123
+ if self.output_directory:
124
+ _dict['output_directory'] = self.output_directory.to_dict()
125
+ # override the default output from pydantic by calling `to_dict()` of user_settings_config_file
126
+ if self.user_settings_config_file:
127
+ _dict['user_settings_config_file'] = self.user_settings_config_file.to_dict()
128
+ # override the default output from pydantic by calling `to_dict()` of fov_coordinate_ml
129
+ if self.fov_coordinate_ml:
130
+ _dict['fov_coordinate_ml'] = self.fov_coordinate_ml.to_dict()
131
+ # override the default output from pydantic by calling `to_dict()` of fov_coordinate_ap
132
+ if self.fov_coordinate_ap:
133
+ _dict['fov_coordinate_ap'] = self.fov_coordinate_ap.to_dict()
134
+ # override the default output from pydantic by calling `to_dict()` of each item in starting_lickport_position (list)
135
+ _items = []
136
+ if self.starting_lickport_position:
137
+ for _item_starting_lickport_position in self.starting_lickport_position:
138
+ if _item_starting_lickport_position:
139
+ _items.append(_item_starting_lickport_position.to_dict())
140
+ _dict['starting_lickport_position'] = _items
141
+ # override the default output from pydantic by calling `to_dict()` of hit_rate_trials_0_10
142
+ if self.hit_rate_trials_0_10:
143
+ _dict['hit_rate_trials_0_10'] = self.hit_rate_trials_0_10.to_dict()
144
+ # override the default output from pydantic by calling `to_dict()` of hit_rate_trials_20_40
145
+ if self.hit_rate_trials_20_40:
146
+ _dict['hit_rate_trials_20_40'] = self.hit_rate_trials_20_40.to_dict()
147
+ # override the default output from pydantic by calling `to_dict()` of total_hits
148
+ if self.total_hits:
149
+ _dict['total_hits'] = self.total_hits.to_dict()
150
+ # override the default output from pydantic by calling `to_dict()` of average_hit_rate
151
+ if self.average_hit_rate:
152
+ _dict['average_hit_rate'] = self.average_hit_rate.to_dict()
153
+ # override the default output from pydantic by calling `to_dict()` of trial_num
154
+ if self.trial_num:
155
+ _dict['trial_num'] = self.trial_num.to_dict()
156
+ # set to None if job_settings_name (nullable) is None
157
+ # and model_fields_set contains the field
158
+ if self.job_settings_name is None and "job_settings_name" in self.model_fields_set:
159
+ _dict['job_settings_name'] = None
160
+
161
+ # set to None if input_source (nullable) is None
162
+ # and model_fields_set contains the field
163
+ if self.input_source is None and "input_source" in self.model_fields_set:
164
+ _dict['input_source'] = None
165
+
166
+ # set to None if output_directory (nullable) is None
167
+ # and model_fields_set contains the field
168
+ if self.output_directory is None and "output_directory" in self.model_fields_set:
169
+ _dict['output_directory'] = None
170
+
171
+ # set to None if user_settings_config_file (nullable) is None
172
+ # and model_fields_set contains the field
173
+ if self.user_settings_config_file is None and "user_settings_config_file" in self.model_fields_set:
174
+ _dict['user_settings_config_file'] = None
175
+
176
+ # set to None if notes (nullable) is None
177
+ # and model_fields_set contains the field
178
+ if self.notes is None and "notes" in self.model_fields_set:
179
+ _dict['notes'] = None
180
+
181
+ # set to None if mouse_platform_name (nullable) is None
182
+ # and model_fields_set contains the field
183
+ if self.mouse_platform_name is None and "mouse_platform_name" in self.model_fields_set:
184
+ _dict['mouse_platform_name'] = None
185
+
186
+ # set to None if active_mouse_platform (nullable) is None
187
+ # and model_fields_set contains the field
188
+ if self.active_mouse_platform is None and "active_mouse_platform" in self.model_fields_set:
189
+ _dict['active_mouse_platform'] = None
190
+
191
+ # set to None if session_type (nullable) is None
192
+ # and model_fields_set contains the field
193
+ if self.session_type is None and "session_type" in self.model_fields_set:
194
+ _dict['session_type'] = None
195
+
196
+ # set to None if iacuc_protocol (nullable) is None
197
+ # and model_fields_set contains the field
198
+ if self.iacuc_protocol is None and "iacuc_protocol" in self.model_fields_set:
199
+ _dict['iacuc_protocol'] = None
200
+
201
+ # set to None if rig_id (nullable) is None
202
+ # and model_fields_set contains the field
203
+ if self.rig_id is None and "rig_id" in self.model_fields_set:
204
+ _dict['rig_id'] = None
205
+
206
+ # set to None if behavior_camera_names (nullable) is None
207
+ # and model_fields_set contains the field
208
+ if self.behavior_camera_names is None and "behavior_camera_names" in self.model_fields_set:
209
+ _dict['behavior_camera_names'] = None
210
+
211
+ # set to None if ch1_filter_names (nullable) is None
212
+ # and model_fields_set contains the field
213
+ if self.ch1_filter_names is None and "ch1_filter_names" in self.model_fields_set:
214
+ _dict['ch1_filter_names'] = None
215
+
216
+ # set to None if ch1_detector_name (nullable) is None
217
+ # and model_fields_set contains the field
218
+ if self.ch1_detector_name is None and "ch1_detector_name" in self.model_fields_set:
219
+ _dict['ch1_detector_name'] = None
220
+
221
+ # set to None if ch1_daq_name (nullable) is None
222
+ # and model_fields_set contains the field
223
+ if self.ch1_daq_name is None and "ch1_daq_name" in self.model_fields_set:
224
+ _dict['ch1_daq_name'] = None
225
+
226
+ # set to None if ch2_filter_names (nullable) is None
227
+ # and model_fields_set contains the field
228
+ if self.ch2_filter_names is None and "ch2_filter_names" in self.model_fields_set:
229
+ _dict['ch2_filter_names'] = None
230
+
231
+ # set to None if ch2_detector_name (nullable) is None
232
+ # and model_fields_set contains the field
233
+ if self.ch2_detector_name is None and "ch2_detector_name" in self.model_fields_set:
234
+ _dict['ch2_detector_name'] = None
235
+
236
+ # set to None if ch2_daq_name (nullable) is None
237
+ # and model_fields_set contains the field
238
+ if self.ch2_daq_name is None and "ch2_daq_name" in self.model_fields_set:
239
+ _dict['ch2_daq_name'] = None
240
+
241
+ # set to None if imaging_laser_name (nullable) is None
242
+ # and model_fields_set contains the field
243
+ if self.imaging_laser_name is None and "imaging_laser_name" in self.model_fields_set:
244
+ _dict['imaging_laser_name'] = None
245
+
246
+ # set to None if photostim_laser_name (nullable) is None
247
+ # and model_fields_set contains the field
248
+ if self.photostim_laser_name is None and "photostim_laser_name" in self.model_fields_set:
249
+ _dict['photostim_laser_name'] = None
250
+
251
+ # set to None if stimulus_device_names (nullable) is None
252
+ # and model_fields_set contains the field
253
+ if self.stimulus_device_names is None and "stimulus_device_names" in self.model_fields_set:
254
+ _dict['stimulus_device_names'] = None
255
+
256
+ # set to None if photostim_laser_wavelength (nullable) is None
257
+ # and model_fields_set contains the field
258
+ if self.photostim_laser_wavelength is None and "photostim_laser_wavelength" in self.model_fields_set:
259
+ _dict['photostim_laser_wavelength'] = None
260
+
261
+ # set to None if fov_coordinate_ml (nullable) is None
262
+ # and model_fields_set contains the field
263
+ if self.fov_coordinate_ml is None and "fov_coordinate_ml" in self.model_fields_set:
264
+ _dict['fov_coordinate_ml'] = None
265
+
266
+ # set to None if fov_coordinate_ap (nullable) is None
267
+ # and model_fields_set contains the field
268
+ if self.fov_coordinate_ap is None and "fov_coordinate_ap" in self.model_fields_set:
269
+ _dict['fov_coordinate_ap'] = None
270
+
271
+ # set to None if fov_reference (nullable) is None
272
+ # and model_fields_set contains the field
273
+ if self.fov_reference is None and "fov_reference" in self.model_fields_set:
274
+ _dict['fov_reference'] = None
275
+
276
+ # set to None if starting_lickport_position (nullable) is None
277
+ # and model_fields_set contains the field
278
+ if self.starting_lickport_position is None and "starting_lickport_position" in self.model_fields_set:
279
+ _dict['starting_lickport_position'] = None
280
+
281
+ # set to None if behavior_task_name (nullable) is None
282
+ # and model_fields_set contains the field
283
+ if self.behavior_task_name is None and "behavior_task_name" in self.model_fields_set:
284
+ _dict['behavior_task_name'] = None
285
+
286
+ # set to None if hit_rate_trials_0_10 (nullable) is None
287
+ # and model_fields_set contains the field
288
+ if self.hit_rate_trials_0_10 is None and "hit_rate_trials_0_10" in self.model_fields_set:
289
+ _dict['hit_rate_trials_0_10'] = None
290
+
291
+ # set to None if hit_rate_trials_20_40 (nullable) is None
292
+ # and model_fields_set contains the field
293
+ if self.hit_rate_trials_20_40 is None and "hit_rate_trials_20_40" in self.model_fields_set:
294
+ _dict['hit_rate_trials_20_40'] = None
295
+
296
+ # set to None if total_hits (nullable) is None
297
+ # and model_fields_set contains the field
298
+ if self.total_hits is None and "total_hits" in self.model_fields_set:
299
+ _dict['total_hits'] = None
300
+
301
+ # set to None if average_hit_rate (nullable) is None
302
+ # and model_fields_set contains the field
303
+ if self.average_hit_rate is None and "average_hit_rate" in self.model_fields_set:
304
+ _dict['average_hit_rate'] = None
305
+
306
+ # set to None if trial_num (nullable) is None
307
+ # and model_fields_set contains the field
308
+ if self.trial_num is None and "trial_num" in self.model_fields_set:
309
+ _dict['trial_num'] = None
310
+
311
+ # set to None if timezone (nullable) is None
312
+ # and model_fields_set contains the field
313
+ if self.timezone is None and "timezone" in self.model_fields_set:
314
+ _dict['timezone'] = None
315
+
316
+ return _dict
317
+
318
+ @classmethod
319
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
320
+ """Create an instance of JobSettings from a dict"""
321
+ if obj is None:
322
+ return None
323
+
324
+ if not isinstance(obj, dict):
325
+ return cls.model_validate(obj)
326
+
327
+ _obj = cls.model_validate({
328
+ "job_settings_name": obj.get("job_settings_name"),
329
+ "input_source": InputSource.from_dict(obj["input_source"]) if obj.get("input_source") is not None else None,
330
+ "output_directory": OutputDirectory.from_dict(obj["output_directory"]) if obj.get("output_directory") is not None else None,
331
+ "user_settings_config_file": UserSettingsConfigFile.from_dict(obj["user_settings_config_file"]) if obj.get("user_settings_config_file") is not None else None,
332
+ "experimenter_full_name": obj.get("experimenter_full_name"),
333
+ "subject_id": obj.get("subject_id"),
334
+ "imaging_laser_wavelength": obj.get("imaging_laser_wavelength"),
335
+ "fov_imaging_depth": obj.get("fov_imaging_depth"),
336
+ "fov_targeted_structure": obj.get("fov_targeted_structure"),
337
+ "notes": obj.get("notes"),
338
+ "mouse_platform_name": obj.get("mouse_platform_name"),
339
+ "active_mouse_platform": obj.get("active_mouse_platform"),
340
+ "session_type": obj.get("session_type"),
341
+ "iacuc_protocol": obj.get("iacuc_protocol"),
342
+ "rig_id": obj.get("rig_id"),
343
+ "behavior_camera_names": obj.get("behavior_camera_names"),
344
+ "ch1_filter_names": obj.get("ch1_filter_names"),
345
+ "ch1_detector_name": obj.get("ch1_detector_name"),
346
+ "ch1_daq_name": obj.get("ch1_daq_name"),
347
+ "ch2_filter_names": obj.get("ch2_filter_names"),
348
+ "ch2_detector_name": obj.get("ch2_detector_name"),
349
+ "ch2_daq_name": obj.get("ch2_daq_name"),
350
+ "imaging_laser_name": obj.get("imaging_laser_name"),
351
+ "photostim_laser_name": obj.get("photostim_laser_name"),
352
+ "stimulus_device_names": obj.get("stimulus_device_names"),
353
+ "photostim_laser_wavelength": obj.get("photostim_laser_wavelength"),
354
+ "fov_coordinate_ml": FovCoordinateMl.from_dict(obj["fov_coordinate_ml"]) if obj.get("fov_coordinate_ml") is not None else None,
355
+ "fov_coordinate_ap": FovCoordinateAp.from_dict(obj["fov_coordinate_ap"]) if obj.get("fov_coordinate_ap") is not None else None,
356
+ "fov_reference": obj.get("fov_reference"),
357
+ "starting_lickport_position": [JobSettingsStartingLickportPositionInner.from_dict(_item) for _item in obj["starting_lickport_position"]] if obj.get("starting_lickport_position") is not None else None,
358
+ "behavior_task_name": obj.get("behavior_task_name"),
359
+ "hit_rate_trials_0_10": HitRateTrials010.from_dict(obj["hit_rate_trials_0_10"]) if obj.get("hit_rate_trials_0_10") is not None else None,
360
+ "hit_rate_trials_20_40": HitRateTrials2040.from_dict(obj["hit_rate_trials_20_40"]) if obj.get("hit_rate_trials_20_40") is not None else None,
361
+ "total_hits": TotalHits.from_dict(obj["total_hits"]) if obj.get("total_hits") is not None else None,
362
+ "average_hit_rate": AverageHitRate.from_dict(obj["average_hit_rate"]) if obj.get("average_hit_rate") is not None else None,
363
+ "trial_num": TrialNum.from_dict(obj["trial_num"]) if obj.get("trial_num") is not None else None,
364
+ "timezone": obj.get("timezone"),
365
+ "additional_properties": obj.get("additional_properties")
366
+ })
367
+ return _obj
368
+
369
+
@@ -0,0 +1,138 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ aind-metadata-service
5
+
6
+ ## aind-metadata-service Service to pull data from example backend.
7
+
8
+ The version of the OpenAPI document: 1.0.7
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
+ from inspect import getfullargspec
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
21
+ from typing import Optional, Union
22
+ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
23
+ from typing_extensions import Literal, Self
24
+ from pydantic import Field
25
+
26
+ JOBSETTINGSSTARTINGLICKPORTPOSITIONINNER_ANY_OF_SCHEMAS = ["float", "int"]
27
+
28
+ class JobSettingsStartingLickportPositionInner(BaseModel):
29
+ """
30
+ JobSettingsStartingLickportPositionInner
31
+ """
32
+
33
+ # data type: float
34
+ anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
35
+ # data type: int
36
+ anyof_schema_2_validator: Optional[StrictInt] = None
37
+ if TYPE_CHECKING:
38
+ actual_instance: Optional[Union[float, int]] = None
39
+ else:
40
+ actual_instance: Any = None
41
+ any_of_schemas: Set[str] = { "float", "int" }
42
+
43
+ model_config = {
44
+ "validate_assignment": True,
45
+ "protected_namespaces": (),
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_anyof(cls, v):
60
+ instance = JobSettingsStartingLickportPositionInner.model_construct()
61
+ error_messages = []
62
+ # validate data type: float
63
+ try:
64
+ instance.anyof_schema_1_validator = v
65
+ return v
66
+ except (ValidationError, ValueError) as e:
67
+ error_messages.append(str(e))
68
+ # validate data type: int
69
+ try:
70
+ instance.anyof_schema_2_validator = v
71
+ return v
72
+ except (ValidationError, ValueError) as e:
73
+ error_messages.append(str(e))
74
+ if error_messages:
75
+ # no match
76
+ raise ValueError("No match found when setting the actual_instance in JobSettingsStartingLickportPositionInner with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
77
+ else:
78
+ return v
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
82
+ return cls.from_json(json.dumps(obj))
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Self:
86
+ """Returns the object represented by the json string"""
87
+ instance = cls.model_construct()
88
+ error_messages = []
89
+ # deserialize data into float
90
+ try:
91
+ # validation
92
+ instance.anyof_schema_1_validator = json.loads(json_str)
93
+ # assign value to actual_instance
94
+ instance.actual_instance = instance.anyof_schema_1_validator
95
+ return instance
96
+ except (ValidationError, ValueError) as e:
97
+ error_messages.append(str(e))
98
+ # deserialize data into int
99
+ try:
100
+ # validation
101
+ instance.anyof_schema_2_validator = json.loads(json_str)
102
+ # assign value to actual_instance
103
+ instance.actual_instance = instance.anyof_schema_2_validator
104
+ return instance
105
+ except (ValidationError, ValueError) as e:
106
+ error_messages.append(str(e))
107
+
108
+ if error_messages:
109
+ # no match
110
+ raise ValueError("No match found when deserializing the JSON string into JobSettingsStartingLickportPositionInner with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
111
+ else:
112
+ return instance
113
+
114
+ def to_json(self) -> str:
115
+ """Returns the JSON representation of the actual instance"""
116
+ if self.actual_instance is None:
117
+ return "null"
118
+
119
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
120
+ return self.actual_instance.to_json()
121
+ else:
122
+ return json.dumps(self.actual_instance)
123
+
124
+ def to_dict(self) -> Optional[Union[Dict[str, Any], float, int]]:
125
+ """Returns the dict representation of the actual instance"""
126
+ if self.actual_instance is None:
127
+ return None
128
+
129
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
130
+ return self.actual_instance.to_dict()
131
+ else:
132
+ return self.actual_instance
133
+
134
+ def to_str(self) -> str:
135
+ """Returns the string representation of the actual instance"""
136
+ return pprint.pformat(self.model_dump())
137
+
138
+