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,216 @@
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
+ from typing import Any, Optional
15
+ from typing_extensions import Self
16
+
17
+ class OpenApiException(Exception):
18
+ """The base exception class for all OpenAPIExceptions"""
19
+
20
+
21
+ class ApiTypeError(OpenApiException, TypeError):
22
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
23
+ key_type=None) -> None:
24
+ """ Raises an exception for TypeErrors
25
+
26
+ Args:
27
+ msg (str): the exception message
28
+
29
+ Keyword Args:
30
+ path_to_item (list): a list of keys an indices to get to the
31
+ current_item
32
+ None if unset
33
+ valid_classes (tuple): the primitive classes that current item
34
+ should be an instance of
35
+ None if unset
36
+ key_type (bool): False if our value is a value in a dict
37
+ True if it is a key in a dict
38
+ False if our item is an item in a list
39
+ None if unset
40
+ """
41
+ self.path_to_item = path_to_item
42
+ self.valid_classes = valid_classes
43
+ self.key_type = key_type
44
+ full_msg = msg
45
+ if path_to_item:
46
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
47
+ super(ApiTypeError, self).__init__(full_msg)
48
+
49
+
50
+ class ApiValueError(OpenApiException, ValueError):
51
+ def __init__(self, msg, path_to_item=None) -> None:
52
+ """
53
+ Args:
54
+ msg (str): the exception message
55
+
56
+ Keyword Args:
57
+ path_to_item (list) the path to the exception in the
58
+ received_data dict. None if unset
59
+ """
60
+
61
+ self.path_to_item = path_to_item
62
+ full_msg = msg
63
+ if path_to_item:
64
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
65
+ super(ApiValueError, self).__init__(full_msg)
66
+
67
+
68
+ class ApiAttributeError(OpenApiException, AttributeError):
69
+ def __init__(self, msg, path_to_item=None) -> None:
70
+ """
71
+ Raised when an attribute reference or assignment fails.
72
+
73
+ Args:
74
+ msg (str): the exception message
75
+
76
+ Keyword Args:
77
+ path_to_item (None/list) the path to the exception in the
78
+ received_data dict
79
+ """
80
+ self.path_to_item = path_to_item
81
+ full_msg = msg
82
+ if path_to_item:
83
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
84
+ super(ApiAttributeError, self).__init__(full_msg)
85
+
86
+
87
+ class ApiKeyError(OpenApiException, KeyError):
88
+ def __init__(self, msg, path_to_item=None) -> None:
89
+ """
90
+ Args:
91
+ msg (str): the exception message
92
+
93
+ Keyword Args:
94
+ path_to_item (None/list) the path to the exception in the
95
+ received_data dict
96
+ """
97
+ self.path_to_item = path_to_item
98
+ full_msg = msg
99
+ if path_to_item:
100
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
101
+ super(ApiKeyError, self).__init__(full_msg)
102
+
103
+
104
+ class ApiException(OpenApiException):
105
+
106
+ def __init__(
107
+ self,
108
+ status=None,
109
+ reason=None,
110
+ http_resp=None,
111
+ *,
112
+ body: Optional[str] = None,
113
+ data: Optional[Any] = None,
114
+ ) -> None:
115
+ self.status = status
116
+ self.reason = reason
117
+ self.body = body
118
+ self.data = data
119
+ self.headers = None
120
+
121
+ if http_resp:
122
+ if self.status is None:
123
+ self.status = http_resp.status
124
+ if self.reason is None:
125
+ self.reason = http_resp.reason
126
+ if self.body is None:
127
+ try:
128
+ self.body = http_resp.data.decode('utf-8')
129
+ except Exception:
130
+ pass
131
+ self.headers = http_resp.getheaders()
132
+
133
+ @classmethod
134
+ def from_response(
135
+ cls,
136
+ *,
137
+ http_resp,
138
+ body: Optional[str],
139
+ data: Optional[Any],
140
+ ) -> Self:
141
+ if http_resp.status == 400:
142
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
143
+
144
+ if http_resp.status == 401:
145
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
146
+
147
+ if http_resp.status == 403:
148
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
149
+
150
+ if http_resp.status == 404:
151
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
152
+
153
+ # Added new conditions for 409 and 422
154
+ if http_resp.status == 409:
155
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
156
+
157
+ if http_resp.status == 422:
158
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159
+
160
+ if 500 <= http_resp.status <= 599:
161
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
162
+ raise ApiException(http_resp=http_resp, body=body, data=data)
163
+
164
+ def __str__(self):
165
+ """Custom error messages for exception"""
166
+ error_message = "({0})\n"\
167
+ "Reason: {1}\n".format(self.status, self.reason)
168
+ if self.headers:
169
+ error_message += "HTTP response headers: {0}\n".format(
170
+ self.headers)
171
+
172
+ if self.data or self.body:
173
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
174
+
175
+ return error_message
176
+
177
+
178
+ class BadRequestException(ApiException):
179
+ pass
180
+
181
+
182
+ class NotFoundException(ApiException):
183
+ pass
184
+
185
+
186
+ class UnauthorizedException(ApiException):
187
+ pass
188
+
189
+
190
+ class ForbiddenException(ApiException):
191
+ pass
192
+
193
+
194
+ class ServiceException(ApiException):
195
+ pass
196
+
197
+
198
+ class ConflictException(ApiException):
199
+ """Exception for HTTP 409 Conflict."""
200
+ pass
201
+
202
+
203
+ class UnprocessableEntityException(ApiException):
204
+ """Exception for HTTP 422 Unprocessable Entity."""
205
+ pass
206
+
207
+
208
+ def render_path(path_to_item):
209
+ """Returns a string representation of a path"""
210
+ result = ""
211
+ for pth in path_to_item:
212
+ if isinstance(pth, int):
213
+ result += "[{0}]".format(pth)
214
+ else:
215
+ result += "['{0}']".format(pth)
216
+ return result
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ aind-metadata-service
6
+
7
+ ## aind-metadata-service Service to pull data from example backend.
8
+
9
+ The version of the OpenAPI document: 1.0.7
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ # import models into model package
17
+ from aind_metadata_service_async_client.models.anyof_schema1_validator import AnyofSchema1Validator
18
+ from aind_metadata_service_async_client.models.average_hit_rate import AverageHitRate
19
+ from aind_metadata_service_async_client.models.fov_coordinate_ap import FovCoordinateAp
20
+ from aind_metadata_service_async_client.models.fov_coordinate_ml import FovCoordinateMl
21
+ from aind_metadata_service_async_client.models.http_validation_error import HTTPValidationError
22
+ from aind_metadata_service_async_client.models.health_check import HealthCheck
23
+ from aind_metadata_service_async_client.models.hit_rate_trials010 import HitRateTrials010
24
+ from aind_metadata_service_async_client.models.hit_rate_trials2040 import HitRateTrials2040
25
+ from aind_metadata_service_async_client.models.input_source import InputSource
26
+ from aind_metadata_service_async_client.models.job_settings import JobSettings
27
+ from aind_metadata_service_async_client.models.job_settings_starting_lickport_position_inner import JobSettingsStartingLickportPositionInner
28
+ from aind_metadata_service_async_client.models.output_directory import OutputDirectory
29
+ from aind_metadata_service_async_client.models.slims_workflow import SlimsWorkflow
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 aind_metadata_service_async_client.models.validation_error import ValidationError
34
+ from aind_metadata_service_async_client.models.validation_error_loc_inner import ValidationErrorLocInner
@@ -0,0 +1,144 @@
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
+ ANYOFSCHEMA1VALIDATOR_ANY_OF_SCHEMAS = ["float", "int"]
27
+
28
+ class AnyofSchema1Validator(BaseModel):
29
+ """
30
+ AnyofSchema1Validator
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
+ if v is None:
61
+ return v
62
+
63
+ instance = AnyofSchema1Validator.model_construct()
64
+ error_messages = []
65
+ # validate data type: float
66
+ try:
67
+ instance.anyof_schema_1_validator = v
68
+ return v
69
+ except (ValidationError, ValueError) as e:
70
+ error_messages.append(str(e))
71
+ # validate data type: int
72
+ try:
73
+ instance.anyof_schema_2_validator = v
74
+ return v
75
+ except (ValidationError, ValueError) as e:
76
+ error_messages.append(str(e))
77
+ if error_messages:
78
+ # no match
79
+ raise ValueError("No match found when setting the actual_instance in AnyofSchema1Validator with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
80
+ else:
81
+ return v
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
85
+ return cls.from_json(json.dumps(obj))
86
+
87
+ @classmethod
88
+ def from_json(cls, json_str: str) -> Self:
89
+ """Returns the object represented by the json string"""
90
+ instance = cls.model_construct()
91
+ if json_str is None:
92
+ return instance
93
+
94
+ error_messages = []
95
+ # deserialize data into float
96
+ try:
97
+ # validation
98
+ instance.anyof_schema_1_validator = json.loads(json_str)
99
+ # assign value to actual_instance
100
+ instance.actual_instance = instance.anyof_schema_1_validator
101
+ return instance
102
+ except (ValidationError, ValueError) as e:
103
+ error_messages.append(str(e))
104
+ # deserialize data into int
105
+ try:
106
+ # validation
107
+ instance.anyof_schema_2_validator = json.loads(json_str)
108
+ # assign value to actual_instance
109
+ instance.actual_instance = instance.anyof_schema_2_validator
110
+ return instance
111
+ except (ValidationError, ValueError) as e:
112
+ error_messages.append(str(e))
113
+
114
+ if error_messages:
115
+ # no match
116
+ raise ValueError("No match found when deserializing the JSON string into AnyofSchema1Validator with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
117
+ else:
118
+ return instance
119
+
120
+ def to_json(self) -> str:
121
+ """Returns the JSON representation of the actual instance"""
122
+ if self.actual_instance is None:
123
+ return "null"
124
+
125
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
126
+ return self.actual_instance.to_json()
127
+ else:
128
+ return json.dumps(self.actual_instance)
129
+
130
+ def to_dict(self) -> Optional[Union[Dict[str, Any], float, int]]:
131
+ """Returns the dict representation of the actual instance"""
132
+ if self.actual_instance is None:
133
+ return None
134
+
135
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
136
+ return self.actual_instance.to_dict()
137
+ else:
138
+ return self.actual_instance
139
+
140
+ def to_str(self) -> str:
141
+ """Returns the string representation of the actual instance"""
142
+ return pprint.pformat(self.model_dump())
143
+
144
+
@@ -0,0 +1,144 @@
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
+ AVERAGEHITRATE_ANY_OF_SCHEMAS = ["float", "int"]
27
+
28
+ class AverageHitRate(BaseModel):
29
+ """
30
+ AverageHitRate
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
+ if v is None:
61
+ return v
62
+
63
+ instance = AverageHitRate.model_construct()
64
+ error_messages = []
65
+ # validate data type: float
66
+ try:
67
+ instance.anyof_schema_1_validator = v
68
+ return v
69
+ except (ValidationError, ValueError) as e:
70
+ error_messages.append(str(e))
71
+ # validate data type: int
72
+ try:
73
+ instance.anyof_schema_2_validator = v
74
+ return v
75
+ except (ValidationError, ValueError) as e:
76
+ error_messages.append(str(e))
77
+ if error_messages:
78
+ # no match
79
+ raise ValueError("No match found when setting the actual_instance in AverageHitRate with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
80
+ else:
81
+ return v
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
85
+ return cls.from_json(json.dumps(obj))
86
+
87
+ @classmethod
88
+ def from_json(cls, json_str: str) -> Self:
89
+ """Returns the object represented by the json string"""
90
+ instance = cls.model_construct()
91
+ if json_str is None:
92
+ return instance
93
+
94
+ error_messages = []
95
+ # deserialize data into float
96
+ try:
97
+ # validation
98
+ instance.anyof_schema_1_validator = json.loads(json_str)
99
+ # assign value to actual_instance
100
+ instance.actual_instance = instance.anyof_schema_1_validator
101
+ return instance
102
+ except (ValidationError, ValueError) as e:
103
+ error_messages.append(str(e))
104
+ # deserialize data into int
105
+ try:
106
+ # validation
107
+ instance.anyof_schema_2_validator = json.loads(json_str)
108
+ # assign value to actual_instance
109
+ instance.actual_instance = instance.anyof_schema_2_validator
110
+ return instance
111
+ except (ValidationError, ValueError) as e:
112
+ error_messages.append(str(e))
113
+
114
+ if error_messages:
115
+ # no match
116
+ raise ValueError("No match found when deserializing the JSON string into AverageHitRate with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
117
+ else:
118
+ return instance
119
+
120
+ def to_json(self) -> str:
121
+ """Returns the JSON representation of the actual instance"""
122
+ if self.actual_instance is None:
123
+ return "null"
124
+
125
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
126
+ return self.actual_instance.to_json()
127
+ else:
128
+ return json.dumps(self.actual_instance)
129
+
130
+ def to_dict(self) -> Optional[Union[Dict[str, Any], float, int]]:
131
+ """Returns the dict representation of the actual instance"""
132
+ if self.actual_instance is None:
133
+ return None
134
+
135
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
136
+ return self.actual_instance.to_dict()
137
+ else:
138
+ return self.actual_instance
139
+
140
+ def to_str(self) -> str:
141
+ """Returns the string representation of the actual instance"""
142
+ return pprint.pformat(self.model_dump())
143
+
144
+
@@ -0,0 +1,144 @@
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
+ FOVCOORDINATEAP_ANY_OF_SCHEMAS = ["float", "int"]
27
+
28
+ class FovCoordinateAp(BaseModel):
29
+ """
30
+ FovCoordinateAp
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
+ if v is None:
61
+ return v
62
+
63
+ instance = FovCoordinateAp.model_construct()
64
+ error_messages = []
65
+ # validate data type: float
66
+ try:
67
+ instance.anyof_schema_1_validator = v
68
+ return v
69
+ except (ValidationError, ValueError) as e:
70
+ error_messages.append(str(e))
71
+ # validate data type: int
72
+ try:
73
+ instance.anyof_schema_2_validator = v
74
+ return v
75
+ except (ValidationError, ValueError) as e:
76
+ error_messages.append(str(e))
77
+ if error_messages:
78
+ # no match
79
+ raise ValueError("No match found when setting the actual_instance in FovCoordinateAp with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
80
+ else:
81
+ return v
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
85
+ return cls.from_json(json.dumps(obj))
86
+
87
+ @classmethod
88
+ def from_json(cls, json_str: str) -> Self:
89
+ """Returns the object represented by the json string"""
90
+ instance = cls.model_construct()
91
+ if json_str is None:
92
+ return instance
93
+
94
+ error_messages = []
95
+ # deserialize data into float
96
+ try:
97
+ # validation
98
+ instance.anyof_schema_1_validator = json.loads(json_str)
99
+ # assign value to actual_instance
100
+ instance.actual_instance = instance.anyof_schema_1_validator
101
+ return instance
102
+ except (ValidationError, ValueError) as e:
103
+ error_messages.append(str(e))
104
+ # deserialize data into int
105
+ try:
106
+ # validation
107
+ instance.anyof_schema_2_validator = json.loads(json_str)
108
+ # assign value to actual_instance
109
+ instance.actual_instance = instance.anyof_schema_2_validator
110
+ return instance
111
+ except (ValidationError, ValueError) as e:
112
+ error_messages.append(str(e))
113
+
114
+ if error_messages:
115
+ # no match
116
+ raise ValueError("No match found when deserializing the JSON string into FovCoordinateAp with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
117
+ else:
118
+ return instance
119
+
120
+ def to_json(self) -> str:
121
+ """Returns the JSON representation of the actual instance"""
122
+ if self.actual_instance is None:
123
+ return "null"
124
+
125
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
126
+ return self.actual_instance.to_json()
127
+ else:
128
+ return json.dumps(self.actual_instance)
129
+
130
+ def to_dict(self) -> Optional[Union[Dict[str, Any], float, int]]:
131
+ """Returns the dict representation of the actual instance"""
132
+ if self.actual_instance is None:
133
+ return None
134
+
135
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
136
+ return self.actual_instance.to_dict()
137
+ else:
138
+ return self.actual_instance
139
+
140
+ def to_str(self) -> str:
141
+ """Returns the string representation of the actual instance"""
142
+ return pprint.pformat(self.model_dump())
143
+
144
+