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.
- aind_metadata_service_async_client/__init__.py +52 -0
- aind_metadata_service_async_client/api/__init__.py +6 -0
- aind_metadata_service_async_client/api/default_api.py +3818 -0
- aind_metadata_service_async_client/api/healthcheck_api.py +281 -0
- aind_metadata_service_async_client/api_client.py +800 -0
- aind_metadata_service_async_client/api_response.py +21 -0
- aind_metadata_service_async_client/configuration.py +568 -0
- aind_metadata_service_async_client/exceptions.py +216 -0
- aind_metadata_service_async_client/models/__init__.py +34 -0
- aind_metadata_service_async_client/models/anyof_schema1_validator.py +144 -0
- aind_metadata_service_async_client/models/average_hit_rate.py +144 -0
- aind_metadata_service_async_client/models/fov_coordinate_ap.py +144 -0
- aind_metadata_service_async_client/models/fov_coordinate_ml.py +112 -0
- aind_metadata_service_async_client/models/health_check.py +99 -0
- aind_metadata_service_async_client/models/hit_rate_trials010.py +144 -0
- aind_metadata_service_async_client/models/hit_rate_trials2040.py +144 -0
- aind_metadata_service_async_client/models/http_validation_error.py +95 -0
- aind_metadata_service_async_client/models/input_source.py +122 -0
- aind_metadata_service_async_client/models/job_settings.py +369 -0
- aind_metadata_service_async_client/models/job_settings_starting_lickport_position_inner.py +138 -0
- aind_metadata_service_async_client/models/output_directory.py +108 -0
- aind_metadata_service_async_client/models/slims_workflow.py +40 -0
- aind_metadata_service_async_client/models/total_hits.py +144 -0
- aind_metadata_service_async_client/models/trial_num.py +144 -0
- aind_metadata_service_async_client/models/user_settings_config_file.py +108 -0
- aind_metadata_service_async_client/models/validation_error.py +99 -0
- aind_metadata_service_async_client/models/validation_error_loc_inner.py +138 -0
- aind_metadata_service_async_client/py.typed +0 -0
- aind_metadata_service_async_client/rest.py +213 -0
- aind_metadata_service_async_client-1.0.7.dist-info/METADATA +25 -0
- aind_metadata_service_async_client-1.0.7.dist-info/RECORD +33 -0
- aind_metadata_service_async_client-1.0.7.dist-info/WHEEL +5 -0
- aind_metadata_service_async_client-1.0.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
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 aind_metadata_service_async_client.models.anyof_schema1_validator import AnyofSchema1Validator
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class FovCoordinateMl(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
FovCoordinateMl
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
anyof_schema_1_validator: Optional[AnyofSchema1Validator] = None
|
|
31
|
+
anyof_schema_2_validator: Optional[StrictStr] = None
|
|
32
|
+
actual_instance: Optional[Any] = None
|
|
33
|
+
any_of_schemas: Optional[List[StrictStr]] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["anyof_schema_1_validator", "anyof_schema_2_validator", "actual_instance", "any_of_schemas"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of FovCoordinateMl from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of anyof_schema_1_validator
|
|
76
|
+
if self.anyof_schema_1_validator:
|
|
77
|
+
_dict['anyof_schema_1_validator'] = self.anyof_schema_1_validator.to_dict()
|
|
78
|
+
# set to None if anyof_schema_1_validator (nullable) is None
|
|
79
|
+
# and model_fields_set contains the field
|
|
80
|
+
if self.anyof_schema_1_validator is None and "anyof_schema_1_validator" in self.model_fields_set:
|
|
81
|
+
_dict['anyof_schema_1_validator'] = None
|
|
82
|
+
|
|
83
|
+
# set to None if anyof_schema_2_validator (nullable) is None
|
|
84
|
+
# and model_fields_set contains the field
|
|
85
|
+
if self.anyof_schema_2_validator is None and "anyof_schema_2_validator" in self.model_fields_set:
|
|
86
|
+
_dict['anyof_schema_2_validator'] = None
|
|
87
|
+
|
|
88
|
+
# set to None if actual_instance (nullable) is None
|
|
89
|
+
# and model_fields_set contains the field
|
|
90
|
+
if self.actual_instance is None and "actual_instance" in self.model_fields_set:
|
|
91
|
+
_dict['actual_instance'] = None
|
|
92
|
+
|
|
93
|
+
return _dict
|
|
94
|
+
|
|
95
|
+
@classmethod
|
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
97
|
+
"""Create an instance of FovCoordinateMl from a dict"""
|
|
98
|
+
if obj is None:
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
if not isinstance(obj, dict):
|
|
102
|
+
return cls.model_validate(obj)
|
|
103
|
+
|
|
104
|
+
_obj = cls.model_validate({
|
|
105
|
+
"anyof_schema_1_validator": AnyofSchema1Validator.from_dict(obj["anyof_schema_1_validator"]) if obj.get("anyof_schema_1_validator") is not None else None,
|
|
106
|
+
"anyof_schema_2_validator": obj.get("anyof_schema_2_validator"),
|
|
107
|
+
"actual_instance": obj.get("actual_instance"),
|
|
108
|
+
"any_of_schemas": obj.get("any_of_schemas")
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -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: 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, 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] = '1.0.7'
|
|
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 '1.0.7'
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
|
@@ -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
|
+
HITRATETRIALS010_ANY_OF_SCHEMAS = ["float", "int"]
|
|
27
|
+
|
|
28
|
+
class HitRateTrials010(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
HitRateTrials010
|
|
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 = HitRateTrials010.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 HitRateTrials010 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 HitRateTrials010 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
|
+
HITRATETRIALS2040_ANY_OF_SCHEMAS = ["float", "int"]
|
|
27
|
+
|
|
28
|
+
class HitRateTrials2040(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
HitRateTrials2040
|
|
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 = HitRateTrials2040.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 HitRateTrials2040 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 HitRateTrials2040 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,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: 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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from aind_metadata_service_async_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
|
+
|