Coverage for skema/gromet/fn/gromet_box_loop.py: 81%

85 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1# coding: utf-8 

2 

3""" 

4 Grounded Model Exchange (GroMEt) schema for Function Networks 

5 

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 

7 

8 OpenAPI spec version: 0.1.10 

9 Contact: claytonm@arizona.edu 

10 Generated by: https://github.com/swagger-api/swagger-codegen.git 

11""" 

12 

13import pprint 

14import re # noqa: F401 

15 

16import six 

17from skema.gromet.fn.gromet_box import GrometBox # noqa: F401,E501 

18 

19class GrometBoxLoop(GrometBox): 

20 """NOTE: This class is auto generated by the swagger code generator program. 

21 

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 'pre': 'int', 

33 'condition': 'int', 

34 'body': 'int', 

35 'post': 'int', 

36 'gromet_type': 'str' 

37 } 

38 if hasattr(GrometBox, "swagger_types"): 

39 swagger_types.update(GrometBox.swagger_types) 

40 

41 attribute_map = { 

42 'pre': 'pre', 

43 'condition': 'condition', 

44 'body': 'body', 

45 'post': 'post', 

46 'gromet_type': 'gromet_type' 

47 } 

48 if hasattr(GrometBox, "attribute_map"): 

49 attribute_map.update(GrometBox.attribute_map) 

50 

51 def __init__(self, pre=None, condition=None, body=None, post=None, gromet_type='GrometBoxLoop', *args, **kwargs): # noqa: E501 

52 """GrometBoxLoop - a model defined in Swagger""" # noqa: E501 

53 self._pre = None 

54 self._condition = None 

55 self._body = None 

56 self._post = None 

57 self._gromet_type = None 

58 self.discriminator = None 

59 if pre is not None: 

60 self.pre = pre 

61 if condition is not None: 

62 self.condition = condition 

63 if body is not None: 

64 self.body = body 

65 if post is not None: 

66 self.post = post 

67 if gromet_type is not None: 

68 self.gromet_type = gromet_type 

69 GrometBox.__init__(self, *args, **kwargs) 

70 

71 @property 

72 def pre(self): 

73 """Gets the pre of this GrometBoxLoop. # noqa: E501 

74 

75 OPTIONAL. The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the pre (aka 'init') (Function) of the Loop. This enables support of for-loops, where many languages have provided an extension to loops that have an initialization that is only in the scope of the loop, but not part of the loop body. # noqa: E501 

76 

77 :return: The pre of this GrometBoxLoop. # noqa: E501 

78 :rtype: int 

79 """ 

80 return self._pre 

81 

82 @pre.setter 

83 def pre(self, pre): 

84 """Sets the pre of this GrometBoxLoop. 

85 

86 OPTIONAL. The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the pre (aka 'init') (Function) of the Loop. This enables support of for-loops, where many languages have provided an extension to loops that have an initialization that is only in the scope of the loop, but not part of the loop body. # noqa: E501 

87 

88 :param pre: The pre of this GrometBoxLoop. # noqa: E501 

89 :type: int 

90 """ 

91 

92 self._pre = pre 

93 

94 @property 

95 def condition(self): 

96 """Gets the condition of this GrometBoxLoop. # noqa: E501 

97 

98 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the condition (Predicate) of the Loop. # noqa: E501 

99 

100 :return: The condition of this GrometBoxLoop. # noqa: E501 

101 :rtype: int 

102 """ 

103 return self._condition 

104 

105 @condition.setter 

106 def condition(self, condition): 

107 """Sets the condition of this GrometBoxLoop. 

108 

109 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the condition (Predicate) of the Loop. # noqa: E501 

110 

111 :param condition: The condition of this GrometBoxLoop. # noqa: E501 

112 :type: int 

113 """ 

114 

115 self._condition = condition 

116 

117 @property 

118 def body(self): 

119 """Gets the body of this GrometBoxLoop. # noqa: E501 

120 

121 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the body (Function) of the Loop. # noqa: E501 

122 

123 :return: The body of this GrometBoxLoop. # noqa: E501 

124 :rtype: int 

125 """ 

126 return self._body 

127 

128 @body.setter 

129 def body(self, body): 

130 """Sets the body of this GrometBoxLoop. 

131 

132 The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the body (Function) of the Loop. # noqa: E501 

133 

134 :param body: The body of this GrometBoxLoop. # noqa: E501 

135 :type: int 

136 """ 

137 

138 self._body = body 

139 

140 @property 

141 def post(self): 

142 """Gets the post of this GrometBoxLoop. # noqa: E501 

143 

144 OPTIONAL. The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the post-loop (Function) just prior to exiting the Loop. This is useful for representing control structures such as in Fortran where loop variable update is advanced one more step than what Python-style iterators support, and where that updated value is available outside the loop. # noqa: E501 

145 

146 :return: The post of this GrometBoxLoop. # noqa: E501 

147 :rtype: int 

148 """ 

149 return self._post 

150 

151 @post.setter 

152 def post(self, post): 

153 """Sets the post of this GrometBoxLoop. 

154 

155 OPTIONAL. The index to the entry in the `fn_array` table of the GrometFNModule representing the GrometFN implementing the post-loop (Function) just prior to exiting the Loop. This is useful for representing control structures such as in Fortran where loop variable update is advanced one more step than what Python-style iterators support, and where that updated value is available outside the loop. # noqa: E501 

156 

157 :param post: The post of this GrometBoxLoop. # noqa: E501 

158 :type: int 

159 """ 

160 

161 self._post = post 

162 

163 @property 

164 def gromet_type(self): 

165 """Gets the gromet_type of this GrometBoxLoop. # noqa: E501 

166 

167 

168 :return: The gromet_type of this GrometBoxLoop. # noqa: E501 

169 :rtype: str 

170 """ 

171 return self._gromet_type 

172 

173 @gromet_type.setter 

174 def gromet_type(self, gromet_type): 

175 """Sets the gromet_type of this GrometBoxLoop. 

176 

177 

178 :param gromet_type: The gromet_type of this GrometBoxLoop. # noqa: E501 

179 :type: str 

180 """ 

181 

182 self._gromet_type = gromet_type 

183 

184 def to_dict(self): 

185 """Returns the model properties as a dict""" 

186 result = {} 

187 

188 for attr, _ in six.iteritems(self.swagger_types): 

189 value = getattr(self, attr) 

190 if isinstance(value, list): 

191 result[attr] = list(map( 

192 lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 

193 value 

194 )) 

195 elif hasattr(value, "to_dict"): 

196 result[attr] = value.to_dict() 

197 elif isinstance(value, dict): 

198 result[attr] = dict(map( 

199 lambda item: (item[0], item[1].to_dict()) 

200 if hasattr(item[1], "to_dict") else item, 

201 value.items() 

202 )) 

203 else: 

204 result[attr] = value 

205 if issubclass(GrometBoxLoop, dict): 

206 for key, value in self.items(): 

207 result[key] = value 

208 

209 return result 

210 

211 def to_str(self): 

212 """Returns the string representation of the model""" 

213 return pprint.pformat(self.to_dict()) 

214 

215 def __repr__(self): 

216 """For `print` and `pprint`""" 

217 return self.to_str() 

218 

219 def __eq__(self, other): 

220 """Returns true if both objects are equal""" 

221 if not isinstance(other, GrometBoxLoop): 

222 return False 

223 

224 return self.__dict__ == other.__dict__ 

225 

226 def __ne__(self, other): 

227 """Returns true if both objects are not equal""" 

228 return not self == other