aind-metadata-service-client 2.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aind_metadata_service_client/__init__.py +39 -0
- aind_metadata_service_client/api/__init__.py +6 -0
- aind_metadata_service_client/api/default_api.py +8106 -0
- aind_metadata_service_client/api/healthcheck_api.py +281 -0
- aind_metadata_service_client/api_client.py +797 -0
- aind_metadata_service_client/api_response.py +21 -0
- aind_metadata_service_client/configuration.py +572 -0
- aind_metadata_service_client/exceptions.py +216 -0
- aind_metadata_service_client/models/__init__.py +21 -0
- aind_metadata_service_client/models/aind_metadata_service_server_routes_slims_slims_workflow.py +40 -0
- aind_metadata_service_client/models/health_check.py +99 -0
- aind_metadata_service_client/models/http_validation_error.py +95 -0
- aind_metadata_service_client/models/validation_error.py +99 -0
- aind_metadata_service_client/models/validation_error_loc_inner.py +138 -0
- aind_metadata_service_client/py.typed +0 -0
- aind_metadata_service_client/rest.py +258 -0
- aind_metadata_service_client-2.6.0.dist-info/METADATA +23 -0
- aind_metadata_service_client-2.6.0.dist-info/RECORD +20 -0
- aind_metadata_service_client-2.6.0.dist-info/WHEEL +5 -0
- aind_metadata_service_client-2.6.0.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: 2.6.0
|
|
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,21 @@
|
|
|
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: 2.6.0
|
|
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_client.models.aind_metadata_service_server_routes_slims_slims_workflow import AindMetadataServiceServerRoutesSlimsSlimsWorkflow
|
|
18
|
+
from aind_metadata_service_client.models.http_validation_error import HTTPValidationError
|
|
19
|
+
from aind_metadata_service_client.models.health_check import HealthCheck
|
|
20
|
+
from aind_metadata_service_client.models.validation_error import ValidationError
|
|
21
|
+
from aind_metadata_service_client.models.validation_error_loc_inner import ValidationErrorLocInner
|
aind_metadata_service_client/models/aind_metadata_service_server_routes_slims_slims_workflow.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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: 2.6.0
|
|
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
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AindMetadataServiceServerRoutesSlimsSlimsWorkflow(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Available workflows that can be queried.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
SMARTSPIM_IMAGING = 'smartspim_imaging'
|
|
30
|
+
HISTOLOGY = 'histology'
|
|
31
|
+
WATER_RESTRICTION = 'water_restriction'
|
|
32
|
+
VIRAL_INJECTIONS = 'viral_injections'
|
|
33
|
+
ECEPHYS_SESSIONS = 'ecephys_sessions'
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
|
37
|
+
"""Create an instance of AindMetadataServiceServerRoutesSlimsSlimsWorkflow from a JSON string"""
|
|
38
|
+
return cls(json.loads(json_str))
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
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: 2.6.0
|
|
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, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class HealthCheck(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Response model to validate and return when performing a health check.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
status: Optional[StrictStr] = 'OK'
|
|
30
|
+
service_version: Optional[StrictStr] = '2.6.0'
|
|
31
|
+
__properties: ClassVar[List[str]] = ["status", "service_version"]
|
|
32
|
+
|
|
33
|
+
@field_validator('status')
|
|
34
|
+
def status_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value is None:
|
|
37
|
+
return value
|
|
38
|
+
|
|
39
|
+
if value not in set(['OK']):
|
|
40
|
+
raise ValueError("must be one of enum values ('OK')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of HealthCheck from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of HealthCheck from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"status": obj.get("status") if obj.get("status") is not None else 'OK',
|
|
95
|
+
"service_version": obj.get("service_version") if obj.get("service_version") is not None else '2.6.0'
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
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: 2.6.0
|
|
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, Optional
|
|
22
|
+
from aind_metadata_service_client.models.validation_error import ValidationError
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class HTTPValidationError(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
HTTPValidationError
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
detail: Optional[List[ValidationError]] = None
|
|
31
|
+
__properties: ClassVar[List[str]] = ["detail"]
|
|
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 HTTPValidationError 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 item in detail (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.detail:
|
|
75
|
+
for _item_detail in self.detail:
|
|
76
|
+
if _item_detail:
|
|
77
|
+
_items.append(_item_detail.to_dict())
|
|
78
|
+
_dict['detail'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of HTTPValidationError 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
|
+
"detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
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: 2.6.0
|
|
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 aind_metadata_service_client.models.validation_error_loc_inner import ValidationErrorLocInner
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ValidationError(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ValidationError
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
loc: List[ValidationErrorLocInner]
|
|
31
|
+
msg: StrictStr
|
|
32
|
+
type: StrictStr
|
|
33
|
+
__properties: ClassVar[List[str]] = ["loc", "msg", "type"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ValidationError from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in loc (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.loc:
|
|
77
|
+
for _item_loc in self.loc:
|
|
78
|
+
if _item_loc:
|
|
79
|
+
_items.append(_item_loc.to_dict())
|
|
80
|
+
_dict['loc'] = _items
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of ValidationError 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
|
+
"loc": [ValidationErrorLocInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None,
|
|
94
|
+
"msg": obj.get("msg"),
|
|
95
|
+
"type": obj.get("type")
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|