Coverage for skema/gromet/fn/gromet_box_conditional.py: 68%
76 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_box import GrometBox # noqa: F401,E501
19class GrometBoxConditional(GrometBox):
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 'condition': 'int',
33 'body_if': 'int',
34 'body_else': 'int',
35 'gromet_type': 'str'
36 }
37 if hasattr(GrometBox, "swagger_types"):
38 swagger_types.update(GrometBox.swagger_types)
40 attribute_map = {
41 'condition': 'condition',
42 'body_if': 'body_if',
43 'body_else': 'body_else',
44 'gromet_type': 'gromet_type'
45 }
46 if hasattr(GrometBox, "attribute_map"):
47 attribute_map.update(GrometBox.attribute_map)
49 def __init__(self, condition=None, body_if=None, body_else=None, gromet_type='GrometBoxConditional', *args, **kwargs): # noqa: E501
50 """GrometBoxConditional - a model defined in Swagger""" # noqa: E501
51 self._condition = None
52 self._body_if = None
53 self._body_else = None
54 self._gromet_type = None
55 self.discriminator = None
56 if condition is not None:
57 self.condition = condition
58 if body_if is not None:
59 self.body_if = body_if
60 if body_else is not None:
61 self.body_else = body_else
62 if gromet_type is not None:
63 self.gromet_type = gromet_type
64 GrometBox.__init__(self, *args, **kwargs)
66 @property
67 def condition(self):
68 """Gets the condition of this GrometBoxConditional. # noqa: E501
70 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the conditional condition. # noqa: E501
72 :return: The condition of this GrometBoxConditional. # noqa: E501
73 :rtype: int
74 """
75 return self._condition
77 @condition.setter
78 def condition(self, condition):
79 """Sets the condition of this GrometBoxConditional.
81 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the conditional condition. # noqa: E501
83 :param condition: The condition of this GrometBoxConditional. # noqa: E501
84 :type: int
85 """
87 self._condition = condition
89 @property
90 def body_if(self):
91 """Gets the body_if of this GrometBoxConditional. # noqa: E501
93 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the IF-branch of the conditional. # noqa: E501
95 :return: The body_if of this GrometBoxConditional. # noqa: E501
96 :rtype: int
97 """
98 return self._body_if
100 @body_if.setter
101 def body_if(self, body_if):
102 """Sets the body_if of this GrometBoxConditional.
104 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the IF-branch of the conditional. # noqa: E501
106 :param body_if: The body_if of this GrometBoxConditional. # noqa: E501
107 :type: int
108 """
110 self._body_if = body_if
112 @property
113 def body_else(self):
114 """Gets the body_else of this GrometBoxConditional. # noqa: E501
116 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the ELSE-branch of the conditional. # noqa: E501
118 :return: The body_else of this GrometBoxConditional. # noqa: E501
119 :rtype: int
120 """
121 return self._body_else
123 @body_else.setter
124 def body_else(self, body_else):
125 """Sets the body_else of this GrometBoxConditional.
127 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the ELSE-branch of the conditional. # noqa: E501
129 :param body_else: The body_else of this GrometBoxConditional. # noqa: E501
130 :type: int
131 """
133 self._body_else = body_else
135 @property
136 def gromet_type(self):
137 """Gets the gromet_type of this GrometBoxConditional. # noqa: E501
140 :return: The gromet_type of this GrometBoxConditional. # noqa: E501
141 :rtype: str
142 """
143 return self._gromet_type
145 @gromet_type.setter
146 def gromet_type(self, gromet_type):
147 """Sets the gromet_type of this GrometBoxConditional.
150 :param gromet_type: The gromet_type of this GrometBoxConditional. # noqa: E501
151 :type: str
152 """
154 self._gromet_type = gromet_type
156 def to_dict(self):
157 """Returns the model properties as a dict"""
158 result = {}
160 for attr, _ in six.iteritems(self.swagger_types):
161 value = getattr(self, attr)
162 if isinstance(value, list):
163 result[attr] = list(map(
164 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
165 value
166 ))
167 elif hasattr(value, "to_dict"):
168 result[attr] = value.to_dict()
169 elif isinstance(value, dict):
170 result[attr] = dict(map(
171 lambda item: (item[0], item[1].to_dict())
172 if hasattr(item[1], "to_dict") else item,
173 value.items()
174 ))
175 else:
176 result[attr] = value
177 if issubclass(GrometBoxConditional, dict):
178 for key, value in self.items():
179 result[key] = value
181 return result
183 def to_str(self):
184 """Returns the string representation of the model"""
185 return pprint.pformat(self.to_dict())
187 def __repr__(self):
188 """For `print` and `pprint`"""
189 return self.to_str()
191 def __eq__(self, other):
192 """Returns true if both objects are equal"""
193 if not isinstance(other, GrometBoxConditional):
194 return False
196 return self.__dict__ == other.__dict__
198 def __ne__(self, other):
199 """Returns true if both objects are not equal"""
200 return not self == other