gamsapi 52.5.0__cp312-cp312-win_amd64.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.
- gams/__init__.py +27 -0
- gams/_version.py +1 -0
- gams/connect/__init__.py +28 -0
- gams/connect/agents/__init__.py +24 -0
- gams/connect/agents/_excel/__init__.py +32 -0
- gams/connect/agents/_excel/excelagent.py +312 -0
- gams/connect/agents/_excel/workbook.py +155 -0
- gams/connect/agents/_sqlconnectors/__init__.py +42 -0
- gams/connect/agents/_sqlconnectors/_accesshandler.py +211 -0
- gams/connect/agents/_sqlconnectors/_databasehandler.py +250 -0
- gams/connect/agents/_sqlconnectors/_mysqlhandler.py +168 -0
- gams/connect/agents/_sqlconnectors/_postgreshandler.py +131 -0
- gams/connect/agents/_sqlconnectors/_pyodbchandler.py +112 -0
- gams/connect/agents/_sqlconnectors/_sqlalchemyhandler.py +74 -0
- gams/connect/agents/_sqlconnectors/_sqlitehandler.py +262 -0
- gams/connect/agents/_sqlconnectors/_sqlserverhandler.py +179 -0
- gams/connect/agents/concatenate.py +440 -0
- gams/connect/agents/connectagent.py +743 -0
- gams/connect/agents/csvreader.py +675 -0
- gams/connect/agents/csvwriter.py +151 -0
- gams/connect/agents/domainwriter.py +143 -0
- gams/connect/agents/excelreader.py +756 -0
- gams/connect/agents/excelwriter.py +467 -0
- gams/connect/agents/filter.py +223 -0
- gams/connect/agents/gamsreader.py +112 -0
- gams/connect/agents/gamswriter.py +239 -0
- gams/connect/agents/gdxreader.py +109 -0
- gams/connect/agents/gdxwriter.py +146 -0
- gams/connect/agents/labelmanipulator.py +303 -0
- gams/connect/agents/projection.py +539 -0
- gams/connect/agents/pythoncode.py +71 -0
- gams/connect/agents/rawcsvreader.py +248 -0
- gams/connect/agents/rawexcelreader.py +312 -0
- gams/connect/agents/schema/CSVReader.yaml +92 -0
- gams/connect/agents/schema/CSVWriter.yaml +44 -0
- gams/connect/agents/schema/Concatenate.yaml +52 -0
- gams/connect/agents/schema/DomainWriter.yaml +25 -0
- gams/connect/agents/schema/ExcelReader.yaml +121 -0
- gams/connect/agents/schema/ExcelWriter.yaml +78 -0
- gams/connect/agents/schema/Filter.yaml +74 -0
- gams/connect/agents/schema/GAMSReader.yaml +20 -0
- gams/connect/agents/schema/GAMSWriter.yaml +47 -0
- gams/connect/agents/schema/GDXReader.yaml +23 -0
- gams/connect/agents/schema/GDXWriter.yaml +32 -0
- gams/connect/agents/schema/LabelManipulator.yaml +99 -0
- gams/connect/agents/schema/Projection.yaml +24 -0
- gams/connect/agents/schema/PythonCode.yaml +6 -0
- gams/connect/agents/schema/RawCSVReader.yaml +34 -0
- gams/connect/agents/schema/RawExcelReader.yaml +42 -0
- gams/connect/agents/schema/SQLReader.yaml +75 -0
- gams/connect/agents/schema/SQLWriter.yaml +103 -0
- gams/connect/agents/sqlreader.py +301 -0
- gams/connect/agents/sqlwriter.py +276 -0
- gams/connect/connectdatabase.py +275 -0
- gams/connect/connectvalidator.py +93 -0
- gams/connect/errors.py +34 -0
- gams/control/__init__.py +136 -0
- gams/control/database.py +2231 -0
- gams/control/execution.py +1900 -0
- gams/control/options.py +2792 -0
- gams/control/workspace.py +1198 -0
- gams/core/__init__.py +24 -0
- gams/core/cfg/__init__.py +26 -0
- gams/core/cfg/_cfgmcc.cp312-win_amd64.pyd +0 -0
- gams/core/cfg/cfgmcc.py +519 -0
- gams/core/dct/__init__.py +26 -0
- gams/core/dct/_dctmcc.cp312-win_amd64.pyd +0 -0
- gams/core/dct/dctmcc.py +574 -0
- gams/core/embedded/__init__.py +26 -0
- gams/core/embedded/gamsemb.py +1024 -0
- gams/core/emp/__init__.py +24 -0
- gams/core/emp/emplexer.py +89 -0
- gams/core/emp/empyacc.py +281 -0
- gams/core/gdx/__init__.py +26 -0
- gams/core/gdx/_gdxcc.cp312-win_amd64.pyd +0 -0
- gams/core/gdx/gdxcc.py +866 -0
- gams/core/gev/__init__.py +26 -0
- gams/core/gev/_gevmcc.cp312-win_amd64.pyd +0 -0
- gams/core/gev/gevmcc.py +855 -0
- gams/core/gmd/__init__.py +26 -0
- gams/core/gmd/_gmdcc.cp312-win_amd64.pyd +0 -0
- gams/core/gmd/gmdcc.py +917 -0
- gams/core/gmo/__init__.py +26 -0
- gams/core/gmo/_gmomcc.cp312-win_amd64.pyd +0 -0
- gams/core/gmo/gmomcc.py +2046 -0
- gams/core/idx/__init__.py +26 -0
- gams/core/idx/_idxcc.cp312-win_amd64.pyd +0 -0
- gams/core/idx/idxcc.py +510 -0
- gams/core/numpy/__init__.py +29 -0
- gams/core/numpy/_gams2numpy.cp312-win_amd64.pyd +0 -0
- gams/core/numpy/gams2numpy.py +1048 -0
- gams/core/opt/__init__.py +26 -0
- gams/core/opt/_optcc.cp312-win_amd64.pyd +0 -0
- gams/core/opt/optcc.py +840 -0
- gams/engine/__init__.py +204 -0
- gams/engine/api/__init__.py +13 -0
- gams/engine/api/auth_api.py +7653 -0
- gams/engine/api/cleanup_api.py +751 -0
- gams/engine/api/default_api.py +887 -0
- gams/engine/api/hypercube_api.py +2629 -0
- gams/engine/api/jobs_api.py +5229 -0
- gams/engine/api/licenses_api.py +2220 -0
- gams/engine/api/namespaces_api.py +7783 -0
- gams/engine/api/usage_api.py +5627 -0
- gams/engine/api/users_api.py +5931 -0
- gams/engine/api_client.py +804 -0
- gams/engine/api_response.py +21 -0
- gams/engine/configuration.py +601 -0
- gams/engine/exceptions.py +216 -0
- gams/engine/models/__init__.py +86 -0
- gams/engine/models/bad_input.py +89 -0
- gams/engine/models/cleanable_job_result.py +104 -0
- gams/engine/models/cleanable_job_result_page.py +113 -0
- gams/engine/models/engine_license.py +107 -0
- gams/engine/models/files_not_found.py +93 -0
- gams/engine/models/forwarded_token_response.py +112 -0
- gams/engine/models/generic_key_value_pair.py +89 -0
- gams/engine/models/hypercube.py +160 -0
- gams/engine/models/hypercube_page.py +111 -0
- gams/engine/models/hypercube_summary.py +91 -0
- gams/engine/models/hypercube_token.py +97 -0
- gams/engine/models/identity_provider.py +107 -0
- gams/engine/models/identity_provider_ldap.py +121 -0
- gams/engine/models/identity_provider_oauth2.py +146 -0
- gams/engine/models/identity_provider_oauth2_scope.py +89 -0
- gams/engine/models/identity_provider_oauth2_with_secret.py +152 -0
- gams/engine/models/identity_provider_oidc.py +133 -0
- gams/engine/models/identity_provider_oidc_with_secret.py +143 -0
- gams/engine/models/inex.py +91 -0
- gams/engine/models/invitation.py +136 -0
- gams/engine/models/invitation_quota.py +106 -0
- gams/engine/models/invitation_token.py +87 -0
- gams/engine/models/job.py +165 -0
- gams/engine/models/job_no_text_entry.py +138 -0
- gams/engine/models/job_no_text_entry_page.py +111 -0
- gams/engine/models/license.py +91 -0
- gams/engine/models/log_piece.py +96 -0
- gams/engine/models/message.py +87 -0
- gams/engine/models/message_and_token.py +99 -0
- gams/engine/models/message_with_webhook_id.py +89 -0
- gams/engine/models/model_auth_token.py +87 -0
- gams/engine/models/model_configuration.py +125 -0
- gams/engine/models/model_default_instance.py +99 -0
- gams/engine/models/model_default_user_instance.py +98 -0
- gams/engine/models/model_hypercube_job.py +106 -0
- gams/engine/models/model_hypercube_usage.py +130 -0
- gams/engine/models/model_instance_info.py +116 -0
- gams/engine/models/model_instance_info_full.py +123 -0
- gams/engine/models/model_instance_pool_info.py +112 -0
- gams/engine/models/model_job_labels.py +179 -0
- gams/engine/models/model_job_usage.py +133 -0
- gams/engine/models/model_pool_usage.py +124 -0
- gams/engine/models/model_usage.py +115 -0
- gams/engine/models/model_user.py +96 -0
- gams/engine/models/model_userinstance_info.py +119 -0
- gams/engine/models/model_userinstancepool_info.py +95 -0
- gams/engine/models/model_version.py +91 -0
- gams/engine/models/models.py +120 -0
- gams/engine/models/namespace.py +104 -0
- gams/engine/models/namespace_quota.py +96 -0
- gams/engine/models/namespace_with_permission.py +96 -0
- gams/engine/models/not_found.py +91 -0
- gams/engine/models/password_policy.py +97 -0
- gams/engine/models/perm_and_username.py +89 -0
- gams/engine/models/quota.py +117 -0
- gams/engine/models/quota_exceeded.py +97 -0
- gams/engine/models/status_code_meaning.py +89 -0
- gams/engine/models/stream_entry.py +89 -0
- gams/engine/models/system_wide_license.py +92 -0
- gams/engine/models/text_entries.py +87 -0
- gams/engine/models/text_entry.py +101 -0
- gams/engine/models/time_span.py +95 -0
- gams/engine/models/time_span_pool_worker.py +99 -0
- gams/engine/models/token_forward_error.py +87 -0
- gams/engine/models/user.py +127 -0
- gams/engine/models/user_group_member.py +96 -0
- gams/engine/models/user_groups.py +108 -0
- gams/engine/models/vapid_info.py +87 -0
- gams/engine/models/webhook.py +138 -0
- gams/engine/models/webhook_parameterized_event.py +99 -0
- gams/engine/py.typed +0 -0
- gams/engine/rest.py +258 -0
- gams/magic/__init__.py +32 -0
- gams/magic/gams_magic.py +142 -0
- gams/magic/interactive.py +402 -0
- gams/tools/__init__.py +30 -0
- gams/tools/errors.py +34 -0
- gams/tools/toolcollection/__init__.py +24 -0
- gams/tools/toolcollection/alg/__init__.py +24 -0
- gams/tools/toolcollection/alg/rank.py +51 -0
- gams/tools/toolcollection/data/__init__.py +24 -0
- gams/tools/toolcollection/data/csvread.py +444 -0
- gams/tools/toolcollection/data/csvwrite.py +311 -0
- gams/tools/toolcollection/data/exceldump.py +47 -0
- gams/tools/toolcollection/data/sqlitewrite.py +276 -0
- gams/tools/toolcollection/gdxservice/__init__.py +24 -0
- gams/tools/toolcollection/gdxservice/gdxencoding.py +104 -0
- gams/tools/toolcollection/gdxservice/gdxrename.py +94 -0
- gams/tools/toolcollection/linalg/__init__.py +24 -0
- gams/tools/toolcollection/linalg/cholesky.py +57 -0
- gams/tools/toolcollection/linalg/eigenvalue.py +56 -0
- gams/tools/toolcollection/linalg/eigenvector.py +58 -0
- gams/tools/toolcollection/linalg/invert.py +55 -0
- gams/tools/toolcollection/linalg/ols.py +138 -0
- gams/tools/toolcollection/tooltemplate.py +321 -0
- gams/tools/toolcollection/win32/__init__.py +24 -0
- gams/tools/toolcollection/win32/excelmerge.py +93 -0
- gams/tools/toolcollection/win32/exceltalk.py +76 -0
- gams/tools/toolcollection/win32/msappavail.py +49 -0
- gams/tools/toolcollection/win32/shellexecute.py +54 -0
- gams/tools/tools.py +116 -0
- gams/transfer/__init__.py +35 -0
- gams/transfer/_abcs/__init__.py +37 -0
- gams/transfer/_abcs/container_abcs.py +433 -0
- gams/transfer/_internals/__init__.py +63 -0
- gams/transfer/_internals/algorithms.py +436 -0
- gams/transfer/_internals/casepreservingdict.py +124 -0
- gams/transfer/_internals/constants.py +270 -0
- gams/transfer/_internals/domainviolation.py +103 -0
- gams/transfer/_internals/specialvalues.py +172 -0
- gams/transfer/containers/__init__.py +26 -0
- gams/transfer/containers/_container.py +1794 -0
- gams/transfer/containers/_io/__init__.py +28 -0
- gams/transfer/containers/_io/containers.py +164 -0
- gams/transfer/containers/_io/gdx.py +1029 -0
- gams/transfer/containers/_io/gmd.py +872 -0
- gams/transfer/containers/_mixins/__init__.py +26 -0
- gams/transfer/containers/_mixins/ccc.py +1274 -0
- gams/transfer/syms/__init__.py +33 -0
- gams/transfer/syms/_methods/__init__.py +24 -0
- gams/transfer/syms/_methods/tables.py +120 -0
- gams/transfer/syms/_methods/toDict.py +115 -0
- gams/transfer/syms/_methods/toList.py +83 -0
- gams/transfer/syms/_methods/toValue.py +60 -0
- gams/transfer/syms/_mixins/__init__.py +32 -0
- gams/transfer/syms/_mixins/equals.py +626 -0
- gams/transfer/syms/_mixins/generateRecords.py +499 -0
- gams/transfer/syms/_mixins/pivot.py +313 -0
- gams/transfer/syms/_mixins/pve.py +627 -0
- gams/transfer/syms/_mixins/sa.py +27 -0
- gams/transfer/syms/_mixins/sapve.py +27 -0
- gams/transfer/syms/_mixins/saua.py +27 -0
- gams/transfer/syms/_mixins/sauapve.py +199 -0
- gams/transfer/syms/_mixins/spve.py +1528 -0
- gams/transfer/syms/_mixins/ve.py +936 -0
- gams/transfer/syms/container_syms/__init__.py +31 -0
- gams/transfer/syms/container_syms/_alias.py +984 -0
- gams/transfer/syms/container_syms/_equation.py +333 -0
- gams/transfer/syms/container_syms/_parameter.py +973 -0
- gams/transfer/syms/container_syms/_set.py +604 -0
- gams/transfer/syms/container_syms/_universe_alias.py +461 -0
- gams/transfer/syms/container_syms/_variable.py +321 -0
- gamsapi-52.5.0.dist-info/METADATA +150 -0
- gamsapi-52.5.0.dist-info/RECORD +257 -0
- gamsapi-52.5.0.dist-info/WHEEL +5 -0
- gamsapi-52.5.0.dist-info/licenses/LICENSE +22 -0
- gamsapi-52.5.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
GAMS Engine
|
|
5
|
+
|
|
6
|
+
With GAMS Engine you can register and solve GAMS models. It has a namespace management system, so you can restrict your users to certain models.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: latest
|
|
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 gams.engine.models.model_instance_info import ModelInstanceInfo
|
|
23
|
+
from gams.engine.models.model_user import ModelUser
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class ModelInstancePoolInfo(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ModelInstancePoolInfo
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
cancelling: Optional[StrictBool] = None
|
|
32
|
+
instance: Optional[ModelInstanceInfo] = None
|
|
33
|
+
label: Optional[StrictStr] = None
|
|
34
|
+
owner: Optional[ModelUser] = None
|
|
35
|
+
size: Optional[StrictInt] = None
|
|
36
|
+
size_active: Optional[StrictInt] = None
|
|
37
|
+
size_busy: Optional[StrictInt] = None
|
|
38
|
+
__properties: ClassVar[List[str]] = ["cancelling", "instance", "label", "owner", "size", "size_active", "size_busy"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of ModelInstancePoolInfo from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of instance
|
|
80
|
+
if self.instance:
|
|
81
|
+
_dict['instance'] = self.instance.to_dict()
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of owner
|
|
83
|
+
if self.owner:
|
|
84
|
+
_dict['owner'] = self.owner.to_dict()
|
|
85
|
+
# set to None if instance (nullable) is None
|
|
86
|
+
# and model_fields_set contains the field
|
|
87
|
+
if self.instance is None and "instance" in self.model_fields_set:
|
|
88
|
+
_dict['instance'] = None
|
|
89
|
+
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of ModelInstancePoolInfo from a dict"""
|
|
95
|
+
if obj is None:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
if not isinstance(obj, dict):
|
|
99
|
+
return cls.model_validate(obj)
|
|
100
|
+
|
|
101
|
+
_obj = cls.model_validate({
|
|
102
|
+
"cancelling": obj.get("cancelling"),
|
|
103
|
+
"instance": ModelInstanceInfo.from_dict(obj["instance"]) if obj.get("instance") is not None else None,
|
|
104
|
+
"label": obj.get("label"),
|
|
105
|
+
"owner": ModelUser.from_dict(obj["owner"]) if obj.get("owner") is not None else None,
|
|
106
|
+
"size": obj.get("size"),
|
|
107
|
+
"size_active": obj.get("size_active"),
|
|
108
|
+
"size_busy": obj.get("size_busy")
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
GAMS Engine
|
|
5
|
+
|
|
6
|
+
With GAMS Engine you can register and solve GAMS models. It has a namespace management system, so you can restrict your users to certain models.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: latest
|
|
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, StrictFloat, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from gams.engine.models.generic_key_value_pair import GenericKeyValuePair
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ModelJobLabels(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ModelJobLabels
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
cpu_request: Optional[Union[StrictFloat, StrictInt]] = None
|
|
31
|
+
instance: Optional[StrictStr] = None
|
|
32
|
+
memory_request: Optional[StrictInt] = None
|
|
33
|
+
multiplier: Optional[Union[StrictFloat, StrictInt]] = None
|
|
34
|
+
node_selectors: Optional[List[GenericKeyValuePair]] = None
|
|
35
|
+
resource_warning: Optional[StrictStr] = None
|
|
36
|
+
tolerations: Optional[List[GenericKeyValuePair]] = None
|
|
37
|
+
workspace_request: Optional[StrictInt] = None
|
|
38
|
+
additional_properties: Dict[str, Any] = {}
|
|
39
|
+
__properties: ClassVar[List[str]] = ["cpu_request", "instance", "memory_request", "multiplier", "node_selectors", "resource_warning", "tolerations", "workspace_request"]
|
|
40
|
+
|
|
41
|
+
@field_validator('resource_warning')
|
|
42
|
+
def resource_warning_validate_enum(cls, value):
|
|
43
|
+
"""Validates the enum"""
|
|
44
|
+
if value is None:
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
if value not in set(['none', 'disk', 'memory']):
|
|
48
|
+
raise ValueError("must be one of enum values ('none', 'disk', 'memory')")
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
populate_by_name=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of ModelJobLabels from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
82
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([
|
|
84
|
+
"additional_properties",
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
_dict = self.model_dump(
|
|
88
|
+
by_alias=True,
|
|
89
|
+
exclude=excluded_fields,
|
|
90
|
+
exclude_none=True,
|
|
91
|
+
)
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of each item in node_selectors (list)
|
|
93
|
+
_items = []
|
|
94
|
+
if self.node_selectors:
|
|
95
|
+
for _item_node_selectors in self.node_selectors:
|
|
96
|
+
if _item_node_selectors:
|
|
97
|
+
_items.append(_item_node_selectors.to_dict())
|
|
98
|
+
_dict['node_selectors'] = _items
|
|
99
|
+
# override the default output from pydantic by calling `to_dict()` of each item in tolerations (list)
|
|
100
|
+
_items = []
|
|
101
|
+
if self.tolerations:
|
|
102
|
+
for _item_tolerations in self.tolerations:
|
|
103
|
+
if _item_tolerations:
|
|
104
|
+
_items.append(_item_tolerations.to_dict())
|
|
105
|
+
_dict['tolerations'] = _items
|
|
106
|
+
# puts key-value pairs in additional_properties in the top level
|
|
107
|
+
if self.additional_properties is not None:
|
|
108
|
+
for _key, _value in self.additional_properties.items():
|
|
109
|
+
_dict[_key] = _value
|
|
110
|
+
|
|
111
|
+
# set to None if cpu_request (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.cpu_request is None and "cpu_request" in self.model_fields_set:
|
|
114
|
+
_dict['cpu_request'] = None
|
|
115
|
+
|
|
116
|
+
# set to None if instance (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.instance is None and "instance" in self.model_fields_set:
|
|
119
|
+
_dict['instance'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if memory_request (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.memory_request is None and "memory_request" in self.model_fields_set:
|
|
124
|
+
_dict['memory_request'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if multiplier (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.multiplier is None and "multiplier" in self.model_fields_set:
|
|
129
|
+
_dict['multiplier'] = None
|
|
130
|
+
|
|
131
|
+
# set to None if node_selectors (nullable) is None
|
|
132
|
+
# and model_fields_set contains the field
|
|
133
|
+
if self.node_selectors is None and "node_selectors" in self.model_fields_set:
|
|
134
|
+
_dict['node_selectors'] = None
|
|
135
|
+
|
|
136
|
+
# set to None if resource_warning (nullable) is None
|
|
137
|
+
# and model_fields_set contains the field
|
|
138
|
+
if self.resource_warning is None and "resource_warning" in self.model_fields_set:
|
|
139
|
+
_dict['resource_warning'] = None
|
|
140
|
+
|
|
141
|
+
# set to None if tolerations (nullable) is None
|
|
142
|
+
# and model_fields_set contains the field
|
|
143
|
+
if self.tolerations is None and "tolerations" in self.model_fields_set:
|
|
144
|
+
_dict['tolerations'] = None
|
|
145
|
+
|
|
146
|
+
# set to None if workspace_request (nullable) is None
|
|
147
|
+
# and model_fields_set contains the field
|
|
148
|
+
if self.workspace_request is None and "workspace_request" in self.model_fields_set:
|
|
149
|
+
_dict['workspace_request'] = None
|
|
150
|
+
|
|
151
|
+
return _dict
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
155
|
+
"""Create an instance of ModelJobLabels from a dict"""
|
|
156
|
+
if obj is None:
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
if not isinstance(obj, dict):
|
|
160
|
+
return cls.model_validate(obj)
|
|
161
|
+
|
|
162
|
+
_obj = cls.model_validate({
|
|
163
|
+
"cpu_request": obj.get("cpu_request"),
|
|
164
|
+
"instance": obj.get("instance"),
|
|
165
|
+
"memory_request": obj.get("memory_request"),
|
|
166
|
+
"multiplier": obj.get("multiplier"),
|
|
167
|
+
"node_selectors": [GenericKeyValuePair.from_dict(_item) for _item in obj["node_selectors"]] if obj.get("node_selectors") is not None else None,
|
|
168
|
+
"resource_warning": obj.get("resource_warning"),
|
|
169
|
+
"tolerations": [GenericKeyValuePair.from_dict(_item) for _item in obj["tolerations"]] if obj.get("tolerations") is not None else None,
|
|
170
|
+
"workspace_request": obj.get("workspace_request")
|
|
171
|
+
})
|
|
172
|
+
# store additional fields in additional_properties
|
|
173
|
+
for _key in obj.keys():
|
|
174
|
+
if _key not in cls.__properties:
|
|
175
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
176
|
+
|
|
177
|
+
return _obj
|
|
178
|
+
|
|
179
|
+
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
GAMS Engine
|
|
5
|
+
|
|
6
|
+
With GAMS Engine you can register and solve GAMS models. It has a namespace management system, so you can restrict your users to certain models.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: latest
|
|
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 datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from gams.engine.models.model_job_labels import ModelJobLabels
|
|
24
|
+
from gams.engine.models.time_span import TimeSpan
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class ModelJobUsage(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ModelJobUsage
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
finished: Optional[datetime] = None
|
|
33
|
+
labels: Optional[ModelJobLabels] = None
|
|
34
|
+
model: Optional[StrictStr] = None
|
|
35
|
+
namespace: Optional[StrictStr] = None
|
|
36
|
+
process_status: Optional[StrictInt] = None
|
|
37
|
+
status: Optional[StrictInt] = None
|
|
38
|
+
submitted: Optional[datetime] = None
|
|
39
|
+
times: Optional[List[TimeSpan]] = None
|
|
40
|
+
token: Optional[StrictStr] = None
|
|
41
|
+
username: Optional[StrictStr] = None
|
|
42
|
+
__properties: ClassVar[List[str]] = ["finished", "labels", "model", "namespace", "process_status", "status", "submitted", "times", "token", "username"]
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
populate_by_name=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def to_str(self) -> str:
|
|
52
|
+
"""Returns the string representation of the model using alias"""
|
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> str:
|
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
58
|
+
return json.dumps(self.to_dict())
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of ModelJobUsage from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
76
|
+
])
|
|
77
|
+
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude=excluded_fields,
|
|
81
|
+
exclude_none=True,
|
|
82
|
+
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of labels
|
|
84
|
+
if self.labels:
|
|
85
|
+
_dict['labels'] = self.labels.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in times (list)
|
|
87
|
+
_items = []
|
|
88
|
+
if self.times:
|
|
89
|
+
for _item_times in self.times:
|
|
90
|
+
if _item_times:
|
|
91
|
+
_items.append(_item_times.to_dict())
|
|
92
|
+
_dict['times'] = _items
|
|
93
|
+
# set to None if finished (nullable) is None
|
|
94
|
+
# and model_fields_set contains the field
|
|
95
|
+
if self.finished is None and "finished" in self.model_fields_set:
|
|
96
|
+
_dict['finished'] = None
|
|
97
|
+
|
|
98
|
+
# set to None if labels (nullable) is None
|
|
99
|
+
# and model_fields_set contains the field
|
|
100
|
+
if self.labels is None and "labels" in self.model_fields_set:
|
|
101
|
+
_dict['labels'] = None
|
|
102
|
+
|
|
103
|
+
# set to None if process_status (nullable) is None
|
|
104
|
+
# and model_fields_set contains the field
|
|
105
|
+
if self.process_status is None and "process_status" in self.model_fields_set:
|
|
106
|
+
_dict['process_status'] = None
|
|
107
|
+
|
|
108
|
+
return _dict
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
112
|
+
"""Create an instance of ModelJobUsage from a dict"""
|
|
113
|
+
if obj is None:
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
if not isinstance(obj, dict):
|
|
117
|
+
return cls.model_validate(obj)
|
|
118
|
+
|
|
119
|
+
_obj = cls.model_validate({
|
|
120
|
+
"finished": obj.get("finished"),
|
|
121
|
+
"labels": ModelJobLabels.from_dict(obj["labels"]) if obj.get("labels") is not None else None,
|
|
122
|
+
"model": obj.get("model"),
|
|
123
|
+
"namespace": obj.get("namespace"),
|
|
124
|
+
"process_status": obj.get("process_status"),
|
|
125
|
+
"status": obj.get("status"),
|
|
126
|
+
"submitted": obj.get("submitted"),
|
|
127
|
+
"times": [TimeSpan.from_dict(_item) for _item in obj["times"]] if obj.get("times") is not None else None,
|
|
128
|
+
"token": obj.get("token"),
|
|
129
|
+
"username": obj.get("username")
|
|
130
|
+
})
|
|
131
|
+
return _obj
|
|
132
|
+
|
|
133
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
GAMS Engine
|
|
5
|
+
|
|
6
|
+
With GAMS Engine you can register and solve GAMS models. It has a namespace management system, so you can restrict your users to certain models.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: latest
|
|
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 datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from gams.engine.models.model_instance_info import ModelInstanceInfo
|
|
24
|
+
from gams.engine.models.model_user import ModelUser
|
|
25
|
+
from gams.engine.models.time_span_pool_worker import TimeSpanPoolWorker
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
|
|
29
|
+
class ModelPoolUsage(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
ModelPoolUsage
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
created_at: Optional[datetime] = None
|
|
34
|
+
deleted_at: Optional[datetime] = None
|
|
35
|
+
instance: Optional[ModelInstanceInfo] = None
|
|
36
|
+
label: Optional[StrictStr] = None
|
|
37
|
+
owner: Optional[ModelUser] = None
|
|
38
|
+
times: Optional[List[TimeSpanPoolWorker]] = None
|
|
39
|
+
__properties: ClassVar[List[str]] = ["created_at", "deleted_at", "instance", "label", "owner", "times"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ModelPoolUsage from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of instance
|
|
81
|
+
if self.instance:
|
|
82
|
+
_dict['instance'] = self.instance.to_dict()
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of owner
|
|
84
|
+
if self.owner:
|
|
85
|
+
_dict['owner'] = self.owner.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in times (list)
|
|
87
|
+
_items = []
|
|
88
|
+
if self.times:
|
|
89
|
+
for _item_times in self.times:
|
|
90
|
+
if _item_times:
|
|
91
|
+
_items.append(_item_times.to_dict())
|
|
92
|
+
_dict['times'] = _items
|
|
93
|
+
# set to None if deleted_at (nullable) is None
|
|
94
|
+
# and model_fields_set contains the field
|
|
95
|
+
if self.deleted_at is None and "deleted_at" in self.model_fields_set:
|
|
96
|
+
_dict['deleted_at'] = None
|
|
97
|
+
|
|
98
|
+
# set to None if instance (nullable) is None
|
|
99
|
+
# and model_fields_set contains the field
|
|
100
|
+
if self.instance is None and "instance" in self.model_fields_set:
|
|
101
|
+
_dict['instance'] = None
|
|
102
|
+
|
|
103
|
+
return _dict
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
107
|
+
"""Create an instance of ModelPoolUsage from a dict"""
|
|
108
|
+
if obj is None:
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
if not isinstance(obj, dict):
|
|
112
|
+
return cls.model_validate(obj)
|
|
113
|
+
|
|
114
|
+
_obj = cls.model_validate({
|
|
115
|
+
"created_at": obj.get("created_at"),
|
|
116
|
+
"deleted_at": obj.get("deleted_at"),
|
|
117
|
+
"instance": ModelInstanceInfo.from_dict(obj["instance"]) if obj.get("instance") is not None else None,
|
|
118
|
+
"label": obj.get("label"),
|
|
119
|
+
"owner": ModelUser.from_dict(obj["owner"]) if obj.get("owner") is not None else None,
|
|
120
|
+
"times": [TimeSpanPoolWorker.from_dict(_item) for _item in obj["times"]] if obj.get("times") is not None else None
|
|
121
|
+
})
|
|
122
|
+
return _obj
|
|
123
|
+
|
|
124
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
GAMS Engine
|
|
5
|
+
|
|
6
|
+
With GAMS Engine you can register and solve GAMS models. It has a namespace management system, so you can restrict your users to certain models.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: latest
|
|
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 gams.engine.models.model_hypercube_usage import ModelHypercubeUsage
|
|
23
|
+
from gams.engine.models.model_job_usage import ModelJobUsage
|
|
24
|
+
from gams.engine.models.model_pool_usage import ModelPoolUsage
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class ModelUsage(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ModelUsage
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
hypercube_job_usage: Optional[List[ModelHypercubeUsage]] = None
|
|
33
|
+
job_usage: Optional[List[ModelJobUsage]] = None
|
|
34
|
+
pool_usage: Optional[List[ModelPoolUsage]] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["hypercube_job_usage", "job_usage", "pool_usage"]
|
|
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 ModelUsage 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
|
+
# override the default output from pydantic by calling `to_dict()` of each item in hypercube_job_usage (list)
|
|
77
|
+
_items = []
|
|
78
|
+
if self.hypercube_job_usage:
|
|
79
|
+
for _item_hypercube_job_usage in self.hypercube_job_usage:
|
|
80
|
+
if _item_hypercube_job_usage:
|
|
81
|
+
_items.append(_item_hypercube_job_usage.to_dict())
|
|
82
|
+
_dict['hypercube_job_usage'] = _items
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of each item in job_usage (list)
|
|
84
|
+
_items = []
|
|
85
|
+
if self.job_usage:
|
|
86
|
+
for _item_job_usage in self.job_usage:
|
|
87
|
+
if _item_job_usage:
|
|
88
|
+
_items.append(_item_job_usage.to_dict())
|
|
89
|
+
_dict['job_usage'] = _items
|
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of each item in pool_usage (list)
|
|
91
|
+
_items = []
|
|
92
|
+
if self.pool_usage:
|
|
93
|
+
for _item_pool_usage in self.pool_usage:
|
|
94
|
+
if _item_pool_usage:
|
|
95
|
+
_items.append(_item_pool_usage.to_dict())
|
|
96
|
+
_dict['pool_usage'] = _items
|
|
97
|
+
return _dict
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
101
|
+
"""Create an instance of ModelUsage from a dict"""
|
|
102
|
+
if obj is None:
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
if not isinstance(obj, dict):
|
|
106
|
+
return cls.model_validate(obj)
|
|
107
|
+
|
|
108
|
+
_obj = cls.model_validate({
|
|
109
|
+
"hypercube_job_usage": [ModelHypercubeUsage.from_dict(_item) for _item in obj["hypercube_job_usage"]] if obj.get("hypercube_job_usage") is not None else None,
|
|
110
|
+
"job_usage": [ModelJobUsage.from_dict(_item) for _item in obj["job_usage"]] if obj.get("job_usage") is not None else None,
|
|
111
|
+
"pool_usage": [ModelPoolUsage.from_dict(_item) for _item in obj["pool_usage"]] if obj.get("pool_usage") is not None else None
|
|
112
|
+
})
|
|
113
|
+
return _obj
|
|
114
|
+
|
|
115
|
+
|