Coverage for skema/gromet/fn/gromet_box_function.py: 88%

121 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 GrometBoxFunction(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 'function_type': 'FunctionType', 

33 'body': 'int', 

34 'import_type': 'ImportType', 

35 'import_version': 'str', 

36 'import_source': 'TypedValue', 

37 'source_language': 'str', 

38 'source_language_version': 'str', 

39 'value': 'LiteralValue', 

40 'gromet_type': 'str' 

41 } 

42 if hasattr(GrometBox, "swagger_types"): 

43 swagger_types.update(GrometBox.swagger_types) 

44 

45 attribute_map = { 

46 'function_type': 'function_type', 

47 'body': 'body', 

48 'import_type': 'import_type', 

49 'import_version': 'import_version', 

50 'import_source': 'import_source', 

51 'source_language': 'source_language', 

52 'source_language_version': 'source_language_version', 

53 'value': 'value', 

54 'gromet_type': 'gromet_type' 

55 } 

56 if hasattr(GrometBox, "attribute_map"): 

57 attribute_map.update(GrometBox.attribute_map) 

58 

59 def __init__(self, function_type=None, body=None, import_type=None, import_version=None, import_source=None, source_language=None, source_language_version=None, value=None, gromet_type='GrometBoxFunction', *args, **kwargs): # noqa: E501 

60 """GrometBoxFunction - a model defined in Swagger""" # noqa: E501 

61 self._function_type = None 

62 self._body = None 

63 self._import_type = None 

64 self._import_version = None 

65 self._import_source = None 

66 self._source_language = None 

67 self._source_language_version = None 

68 self._value = None 

69 self._gromet_type = None 

70 self.discriminator = None 

71 if function_type is not None: 

72 self.function_type = function_type 

73 if body is not None: 

74 self.body = body 

75 if import_type is not None: 

76 self.import_type = import_type 

77 if import_version is not None: 

78 self.import_version = import_version 

79 if import_source is not None: 

80 self.import_source = import_source 

81 if source_language is not None: 

82 self.source_language = source_language 

83 if source_language_version is not None: 

84 self.source_language_version = source_language_version 

85 if value is not None: 

86 self.value = value 

87 if gromet_type is not None: 

88 self.gromet_type = gromet_type 

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

90 

91 @property 

92 def function_type(self): 

93 """Gets the function_type of this GrometBoxFunction. # noqa: E501 

94 

95 

96 :return: The function_type of this GrometBoxFunction. # noqa: E501 

97 :rtype: FunctionType 

98 """ 

99 return self._function_type 

100 

101 @function_type.setter 

102 def function_type(self, function_type): 

103 """Sets the function_type of this GrometBoxFunction. 

104 

105 

106 :param function_type: The function_type of this GrometBoxFunction. # noqa: E501 

107 :type: FunctionType 

108 """ 

109 

110 self._function_type = function_type 

111 

112 @property 

113 def body(self): 

114 """Gets the body of this GrometBoxFunction. # noqa: E501 

115 

116 The index to the FN in the parent GrometFNCollection.function_networks array. # noqa: E501 

117 

118 :return: The body of this GrometBoxFunction. # noqa: E501 

119 :rtype: int 

120 """ 

121 return self._body 

122 

123 @body.setter 

124 def body(self, body): 

125 """Sets the body of this GrometBoxFunction. 

126 

127 The index to the FN in the parent GrometFNCollection.function_networks array. # noqa: E501 

128 

129 :param body: The body of this GrometBoxFunction. # noqa: E501 

130 :type: int 

131 """ 

132 

133 self._body = body 

134 

135 @property 

136 def import_type(self): 

137 """Gets the import_type of this GrometBoxFunction. # noqa: E501 

138 

139 

140 :return: The import_type of this GrometBoxFunction. # noqa: E501 

141 :rtype: ImportType 

142 """ 

143 return self._import_type 

144 

145 @import_type.setter 

146 def import_type(self, import_type): 

147 """Sets the import_type of this GrometBoxFunction. 

148 

149 

150 :param import_type: The import_type of this GrometBoxFunction. # noqa: E501 

151 :type: ImportType 

152 """ 

153 

154 self._import_type = import_type 

155 

156 @property 

157 def import_version(self): 

158 """Gets the import_version of this GrometBoxFunction. # noqa: E501 

159 

160 When function_type is IMPORTED: the version of the resource being imported (e.g., \"Numpy 1.23.0\") # noqa: E501 

161 

162 :return: The import_version of this GrometBoxFunction. # noqa: E501 

163 :rtype: str 

164 """ 

165 return self._import_version 

166 

167 @import_version.setter 

168 def import_version(self, import_version): 

169 """Sets the import_version of this GrometBoxFunction. 

170 

171 When function_type is IMPORTED: the version of the resource being imported (e.g., \"Numpy 1.23.0\") # noqa: E501 

172 

173 :param import_version: The import_version of this GrometBoxFunction. # noqa: E501 

174 :type: str 

175 """ 

176 

177 self._import_version = import_version 

178 

179 @property 

180 def import_source(self): 

181 """Gets the import_source of this GrometBoxFunction. # noqa: E501 

182 

183 

184 :return: The import_source of this GrometBoxFunction. # noqa: E501 

185 :rtype: TypedValue 

186 """ 

187 return self._import_source 

188 

189 @import_source.setter 

190 def import_source(self, import_source): 

191 """Sets the import_source of this GrometBoxFunction. 

192 

193 

194 :param import_source: The import_source of this GrometBoxFunction. # noqa: E501 

195 :type: TypedValue 

196 """ 

197 

198 self._import_source = import_source 

199 

200 @property 

201 def source_language(self): 

202 """Gets the source_language of this GrometBoxFunction. # noqa: E501 

203 

204 When function_type is SOURCE or IMPORTED: The source language base name (e.g., \"Python\", \"C\", \"Fortran\") # noqa: E501 

205 

206 :return: The source_language of this GrometBoxFunction. # noqa: E501 

207 :rtype: str 

208 """ 

209 return self._source_language 

210 

211 @source_language.setter 

212 def source_language(self, source_language): 

213 """Sets the source_language of this GrometBoxFunction. 

214 

215 When function_type is SOURCE or IMPORTED: The source language base name (e.g., \"Python\", \"C\", \"Fortran\") # noqa: E501 

216 

217 :param source_language: The source_language of this GrometBoxFunction. # noqa: E501 

218 :type: str 

219 """ 

220 

221 self._source_language = source_language 

222 

223 @property 

224 def source_language_version(self): 

225 """Gets the source_language_version of this GrometBoxFunction. # noqa: E501 

226 

227 When function_type is SOURCE or IMPORTED: The version of the source language (e.g., \"3.10.9\") # noqa: E501 

228 

229 :return: The source_language_version of this GrometBoxFunction. # noqa: E501 

230 :rtype: str 

231 """ 

232 return self._source_language_version 

233 

234 @source_language_version.setter 

235 def source_language_version(self, source_language_version): 

236 """Sets the source_language_version of this GrometBoxFunction. 

237 

238 When function_type is SOURCE or IMPORTED: The version of the source language (e.g., \"3.10.9\") # noqa: E501 

239 

240 :param source_language_version: The source_language_version of this GrometBoxFunction. # noqa: E501 

241 :type: str 

242 """ 

243 

244 self._source_language_version = source_language_version 

245 

246 @property 

247 def value(self): 

248 """Gets the value of this GrometBoxFunction. # noqa: E501 

249 

250 

251 :return: The value of this GrometBoxFunction. # noqa: E501 

252 :rtype: LiteralValue 

253 """ 

254 return self._value 

255 

256 @value.setter 

257 def value(self, value): 

258 """Sets the value of this GrometBoxFunction. 

259 

260 

261 :param value: The value of this GrometBoxFunction. # noqa: E501 

262 :type: LiteralValue 

263 """ 

264 

265 self._value = value 

266 

267 @property 

268 def gromet_type(self): 

269 """Gets the gromet_type of this GrometBoxFunction. # noqa: E501 

270 

271 

272 :return: The gromet_type of this GrometBoxFunction. # noqa: E501 

273 :rtype: str 

274 """ 

275 return self._gromet_type 

276 

277 @gromet_type.setter 

278 def gromet_type(self, gromet_type): 

279 """Sets the gromet_type of this GrometBoxFunction. 

280 

281 

282 :param gromet_type: The gromet_type of this GrometBoxFunction. # noqa: E501 

283 :type: str 

284 """ 

285 

286 self._gromet_type = gromet_type 

287 

288 def to_dict(self): 

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

290 result = {} 

291 

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

293 value = getattr(self, attr) 

294 if isinstance(value, list): 

295 result[attr] = list(map( 

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

297 value 

298 )) 

299 elif hasattr(value, "to_dict"): 

300 result[attr] = value.to_dict() 

301 elif isinstance(value, dict): 

302 result[attr] = dict(map( 

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

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

305 value.items() 

306 )) 

307 else: 

308 result[attr] = value 

309 if issubclass(GrometBoxFunction, dict): 

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

311 result[key] = value 

312 

313 return result 

314 

315 def to_str(self): 

316 """Returns the string representation of the model""" 

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

318 

319 def __repr__(self): 

320 """For `print` and `pprint`""" 

321 return self.to_str() 

322 

323 def __eq__(self, other): 

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

325 if not isinstance(other, GrometBoxFunction): 

326 return False 

327 

328 return self.__dict__ == other.__dict__ 

329 

330 def __ne__(self, other): 

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

332 return not self == other