Coverage for skema/gromet/fn/gromet_fn_module_collection.py: 92%
121 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-30 17:15 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-30 17:15 +0000
1# coding: utf-8
3"""
4 Grounded Model Exchange (GroMEt) schema for Function Networks
6 This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` <automates>/automates/model_assembly/gromet/model/README.md ``` # noqa: E501
8 OpenAPI spec version: 0.1.10
9 Contact: claytonm@arizona.edu
10 Generated by: https://github.com/swagger-api/swagger-codegen.git
11"""
13import pprint
14import re # noqa: F401
16import six
17from skema.gromet.fn.gromet_object import GrometObject # noqa: F401,E501
19class GrometFNModuleCollection(GrometObject):
20 """NOTE: This class is auto generated by the swagger code generator program.
22 Do not edit the class manually.
23 """
24 """
25 Attributes:
26 swagger_types (dict): The key is attribute name
27 and the value is attribute type.
28 attribute_map (dict): The key is attribute name
29 and the value is json key in definition.
30 """
31 swagger_types = {
32 'schema': 'str',
33 'schema_version': 'str',
34 'name': 'str',
35 'modules': 'list[GrometFNModule]',
36 'module_index': 'list[str]',
37 'module_dependencies': 'list[GrometFNModuleDependencyReference]',
38 'executables': 'list[int]',
39 'metadata_collection': 'list[list[Metadata]]',
40 'gromet_type': 'str'
41 }
42 if hasattr(GrometObject, "swagger_types"):
43 swagger_types.update(GrometObject.swagger_types)
45 attribute_map = {
46 'schema': 'schema',
47 'schema_version': 'schema_version',
48 'name': 'name',
49 'modules': 'modules',
50 'module_index': 'module_index',
51 'module_dependencies': 'module_dependencies',
52 'executables': 'executables',
53 'metadata_collection': 'metadata_collection',
54 'gromet_type': 'gromet_type'
55 }
56 if hasattr(GrometObject, "attribute_map"):
57 attribute_map.update(GrometObject.attribute_map)
59 def __init__(self, schema='FN', schema_version=None, name=None, modules=None, module_index=None, module_dependencies=None, executables=None, metadata_collection=None, gromet_type='GrometFNModuleCollection', *args, **kwargs): # noqa: E501
60 """GrometFNModuleCollection - a model defined in Swagger""" # noqa: E501
61 self._schema = None
62 self._schema_version = None
63 self._name = None
64 self._modules = None
65 self._module_index = None
66 self._module_dependencies = None
67 self._executables = None
68 self._metadata_collection = None
69 self._gromet_type = None
70 self.discriminator = None
71 if schema is not None:
72 self.schema = schema
73 if schema_version is not None:
74 self.schema_version = schema_version
75 if name is not None:
76 self.name = name
77 if modules is not None:
78 self.modules = modules
79 if module_index is not None:
80 self.module_index = module_index
81 if module_dependencies is not None:
82 self.module_dependencies = module_dependencies
83 if executables is not None:
84 self.executables = executables
85 if metadata_collection is not None:
86 self.metadata_collection = metadata_collection
87 if gromet_type is not None:
88 self.gromet_type = gromet_type
89 GrometObject.__init__(self, *args, **kwargs)
91 @property
92 def schema(self):
93 """Gets the schema of this GrometFNModuleCollection. # noqa: E501
96 :return: The schema of this GrometFNModuleCollection. # noqa: E501
97 :rtype: str
98 """
99 return self._schema
101 @schema.setter
102 def schema(self, schema):
103 """Sets the schema of this GrometFNModuleCollection.
106 :param schema: The schema of this GrometFNModuleCollection. # noqa: E501
107 :type: str
108 """
110 self._schema = schema
112 @property
113 def schema_version(self):
114 """Gets the schema_version of this GrometFNModuleCollection. # noqa: E501
117 :return: The schema_version of this GrometFNModuleCollection. # noqa: E501
118 :rtype: str
119 """
120 return self._schema_version
122 @schema_version.setter
123 def schema_version(self, schema_version):
124 """Sets the schema_version of this GrometFNModuleCollection.
127 :param schema_version: The schema_version of this GrometFNModuleCollection. # noqa: E501
128 :type: str
129 """
131 self._schema_version = schema_version
133 @property
134 def name(self):
135 """Gets the name of this GrometFNModuleCollection. # noqa: E501
137 The name of the collection, e.g., the name of the multi-module system. # noqa: E501
139 :return: The name of this GrometFNModuleCollection. # noqa: E501
140 :rtype: str
141 """
142 return self._name
144 @name.setter
145 def name(self, name):
146 """Sets the name of this GrometFNModuleCollection.
148 The name of the collection, e.g., the name of the multi-module system. # noqa: E501
150 :param name: The name of this GrometFNModuleCollection. # noqa: E501
151 :type: str
152 """
154 self._name = name
156 @property
157 def modules(self):
158 """Gets the modules of this GrometFNModuleCollection. # noqa: E501
161 :return: The modules of this GrometFNModuleCollection. # noqa: E501
162 :rtype: list[GrometFNModule]
163 """
164 return self._modules
166 @modules.setter
167 def modules(self, modules):
168 """Sets the modules of this GrometFNModuleCollection.
171 :param modules: The modules of this GrometFNModuleCollection. # noqa: E501
172 :type: list[GrometFNModule]
173 """
175 self._modules = modules
177 @property
178 def module_index(self):
179 """Gets the module_index of this GrometFNModuleCollection. # noqa: E501
181 The index of module path names (strings) with the index to the GrometFNModule in the modules table. Because this is a bijection, the module path names are represented as an array of strings, where the order in the array is the index into the modules table. # noqa: E501
183 :return: The module_index of this GrometFNModuleCollection. # noqa: E501
184 :rtype: list[str]
185 """
186 return self._module_index
188 @module_index.setter
189 def module_index(self, module_index):
190 """Sets the module_index of this GrometFNModuleCollection.
192 The index of module path names (strings) with the index to the GrometFNModule in the modules table. Because this is a bijection, the module path names are represented as an array of strings, where the order in the array is the index into the modules table. # noqa: E501
194 :param module_index: The module_index of this GrometFNModuleCollection. # noqa: E501
195 :type: list[str]
196 """
198 self._module_index = module_index
200 @property
201 def module_dependencies(self):
202 """Gets the module_dependencies of this GrometFNModuleCollection. # noqa: E501
204 Collection of references to modules that have contents that are imported and / referred to by modules in this ModuleCollection. # noqa: E501
206 :return: The module_dependencies of this GrometFNModuleCollection. # noqa: E501
207 :rtype: list[GrometFNModuleDependencyReference]
208 """
209 return self._module_dependencies
211 @module_dependencies.setter
212 def module_dependencies(self, module_dependencies):
213 """Sets the module_dependencies of this GrometFNModuleCollection.
215 Collection of references to modules that have contents that are imported and / referred to by modules in this ModuleCollection. # noqa: E501
217 :param module_dependencies: The module_dependencies of this GrometFNModuleCollection. # noqa: E501
218 :type: list[GrometFNModuleDependencyReference]
219 """
221 self._module_dependencies = module_dependencies
223 @property
224 def executables(self):
225 """Gets the executables of this GrometFNModuleCollection. # noqa: E501
227 Array of indices into the modules table to denote GrometFNModules that have a main function (and are executable). # noqa: E501
229 :return: The executables of this GrometFNModuleCollection. # noqa: E501
230 :rtype: list[int]
231 """
232 return self._executables
234 @executables.setter
235 def executables(self, executables):
236 """Sets the executables of this GrometFNModuleCollection.
238 Array of indices into the modules table to denote GrometFNModules that have a main function (and are executable). # noqa: E501
240 :param executables: The executables of this GrometFNModuleCollection. # noqa: E501
241 :type: list[int]
242 """
244 self._executables = executables
246 @property
247 def metadata_collection(self):
248 """Gets the metadata_collection of this GrometFNModuleCollection. # noqa: E501
250 Table (array) of lists (arrays) of metadata, where each list in the Table-array represents the collection of metadata associated with a GrometFNModuleCollection object. # noqa: E501
252 :return: The metadata_collection of this GrometFNModuleCollection. # noqa: E501
253 :rtype: list[list[Metadata]]
254 """
255 return self._metadata_collection
257 @metadata_collection.setter
258 def metadata_collection(self, metadata_collection):
259 """Sets the metadata_collection of this GrometFNModuleCollection.
261 Table (array) of lists (arrays) of metadata, where each list in the Table-array represents the collection of metadata associated with a GrometFNModuleCollection object. # noqa: E501
263 :param metadata_collection: The metadata_collection of this GrometFNModuleCollection. # noqa: E501
264 :type: list[list[Metadata]]
265 """
267 self._metadata_collection = metadata_collection
269 @property
270 def gromet_type(self):
271 """Gets the gromet_type of this GrometFNModuleCollection. # noqa: E501
274 :return: The gromet_type of this GrometFNModuleCollection. # noqa: E501
275 :rtype: str
276 """
277 return self._gromet_type
279 @gromet_type.setter
280 def gromet_type(self, gromet_type):
281 """Sets the gromet_type of this GrometFNModuleCollection.
284 :param gromet_type: The gromet_type of this GrometFNModuleCollection. # noqa: E501
285 :type: str
286 """
288 self._gromet_type = gromet_type
290 def to_dict(self):
291 """Returns the model properties as a dict"""
292 result = {}
294 for attr, _ in six.iteritems(self.swagger_types):
295 value = getattr(self, attr)
296 if isinstance(value, list):
297 result[attr] = list(map(
298 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
299 value
300 ))
301 elif hasattr(value, "to_dict"):
302 result[attr] = value.to_dict()
303 elif isinstance(value, dict):
304 result[attr] = dict(map(
305 lambda item: (item[0], item[1].to_dict())
306 if hasattr(item[1], "to_dict") else item,
307 value.items()
308 ))
309 else:
310 result[attr] = value
311 if issubclass(GrometFNModuleCollection, dict):
312 for key, value in self.items():
313 result[key] = value
315 return result
317 def to_str(self):
318 """Returns the string representation of the model"""
319 return pprint.pformat(self.to_dict())
321 def __repr__(self):
322 """For `print` and `pprint`"""
323 return self.to_str()
325 def __eq__(self, other):
326 """Returns true if both objects are equal"""
327 if not isinstance(other, GrometFNModuleCollection):
328 return False
330 return self.__dict__ == other.__dict__
332 def __ne__(self, other):
333 """Returns true if both objects are not equal"""
334 return not self == other