Coverage for skema/gromet/fn/gromet_fn_module.py: 93%

103 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_object import GrometObject # noqa: F401,E501 

18 

19class GrometFNModule(GrometObject): 

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 'schema': 'str', 

33 'schema_version': 'str', 

34 'name': 'str', 

35 'fn': 'GrometFN', 

36 'fn_array': 'list[GrometFN]', 

37 'metadata_collection': 'list[list[Metadata]]', 

38 'gromet_type': 'str' 

39 } 

40 if hasattr(GrometObject, "swagger_types"): 

41 swagger_types.update(GrometObject.swagger_types) 

42 

43 attribute_map = { 

44 'schema': 'schema', 

45 'schema_version': 'schema_version', 

46 'name': 'name', 

47 'fn': 'fn', 

48 'fn_array': 'fn_array', 

49 'metadata_collection': 'metadata_collection', 

50 'gromet_type': 'gromet_type' 

51 } 

52 if hasattr(GrometObject, "attribute_map"): 

53 attribute_map.update(GrometObject.attribute_map) 

54 

55 def __init__(self, schema='FN', schema_version=None, name=None, fn=None, fn_array=None, metadata_collection=None, gromet_type='GrometFNModule', *args, **kwargs): # noqa: E501 

56 """GrometFNModule - a model defined in Swagger""" # noqa: E501 

57 self._schema = None 

58 self._schema_version = None 

59 self._name = None 

60 self._fn = None 

61 self._fn_array = None 

62 self._metadata_collection = None 

63 self._gromet_type = None 

64 self.discriminator = None 

65 if schema is not None: 

66 self.schema = schema 

67 if schema_version is not None: 

68 self.schema_version = schema_version 

69 if name is not None: 

70 self.name = name 

71 if fn is not None: 

72 self.fn = fn 

73 if fn_array is not None: 

74 self.fn_array = fn_array 

75 if metadata_collection is not None: 

76 self.metadata_collection = metadata_collection 

77 if gromet_type is not None: 

78 self.gromet_type = gromet_type 

79 GrometObject.__init__(self, *args, **kwargs) 

80 

81 @property 

82 def schema(self): 

83 """Gets the schema of this GrometFNModule. # noqa: E501 

84 

85 

86 :return: The schema of this GrometFNModule. # noqa: E501 

87 :rtype: str 

88 """ 

89 return self._schema 

90 

91 @schema.setter 

92 def schema(self, schema): 

93 """Sets the schema of this GrometFNModule. 

94 

95 

96 :param schema: The schema of this GrometFNModule. # noqa: E501 

97 :type: str 

98 """ 

99 

100 self._schema = schema 

101 

102 @property 

103 def schema_version(self): 

104 """Gets the schema_version of this GrometFNModule. # noqa: E501 

105 

106 

107 :return: The schema_version of this GrometFNModule. # noqa: E501 

108 :rtype: str 

109 """ 

110 return self._schema_version 

111 

112 @schema_version.setter 

113 def schema_version(self, schema_version): 

114 """Sets the schema_version of this GrometFNModule. 

115 

116 

117 :param schema_version: The schema_version of this GrometFNModule. # noqa: E501 

118 :type: str 

119 """ 

120 

121 self._schema_version = schema_version 

122 

123 @property 

124 def name(self): 

125 """Gets the name of this GrometFNModule. # noqa: E501 

126 

127 The name of the Function Network Module. # noqa: E501 

128 

129 :return: The name of this GrometFNModule. # noqa: E501 

130 :rtype: str 

131 """ 

132 return self._name 

133 

134 @name.setter 

135 def name(self, name): 

136 """Sets the name of this GrometFNModule. 

137 

138 The name of the Function Network Module. # noqa: E501 

139 

140 :param name: The name of this GrometFNModule. # noqa: E501 

141 :type: str 

142 """ 

143 

144 self._name = name 

145 

146 @property 

147 def fn(self): 

148 """Gets the fn of this GrometFNModule. # noqa: E501 

149 

150 

151 :return: The fn of this GrometFNModule. # noqa: E501 

152 :rtype: GrometFN 

153 """ 

154 return self._fn 

155 

156 @fn.setter 

157 def fn(self, fn): 

158 """Sets the fn of this GrometFNModule. 

159 

160 

161 :param fn: The fn of this GrometFNModule. # noqa: E501 

162 :type: GrometFN 

163 """ 

164 

165 self._fn = fn 

166 

167 @property 

168 def fn_array(self): 

169 """Gets the fn_array of this GrometFNModule. # noqa: E501 

170 

171 Array of GrometFNs # noqa: E501 

172 

173 :return: The fn_array of this GrometFNModule. # noqa: E501 

174 :rtype: list[GrometFN] 

175 """ 

176 return self._fn_array 

177 

178 @fn_array.setter 

179 def fn_array(self, fn_array): 

180 """Sets the fn_array of this GrometFNModule. 

181 

182 Array of GrometFNs # noqa: E501 

183 

184 :param fn_array: The fn_array of this GrometFNModule. # noqa: E501 

185 :type: list[GrometFN] 

186 """ 

187 

188 self._fn_array = fn_array 

189 

190 @property 

191 def metadata_collection(self): 

192 """Gets the metadata_collection of this GrometFNModule. # noqa: E501 

193 

194 Table (array) of lists (arrays) of metadata, where each list in the Table-array represents the collection of metadata associated with a GrometFNModule object. # noqa: E501 

195 

196 :return: The metadata_collection of this GrometFNModule. # noqa: E501 

197 :rtype: list[list[Metadata]] 

198 """ 

199 return self._metadata_collection 

200 

201 @metadata_collection.setter 

202 def metadata_collection(self, metadata_collection): 

203 """Sets the metadata_collection of this GrometFNModule. 

204 

205 Table (array) of lists (arrays) of metadata, where each list in the Table-array represents the collection of metadata associated with a GrometFNModule object. # noqa: E501 

206 

207 :param metadata_collection: The metadata_collection of this GrometFNModule. # noqa: E501 

208 :type: list[list[Metadata]] 

209 """ 

210 

211 self._metadata_collection = metadata_collection 

212 

213 @property 

214 def gromet_type(self): 

215 """Gets the gromet_type of this GrometFNModule. # noqa: E501 

216 

217 

218 :return: The gromet_type of this GrometFNModule. # noqa: E501 

219 :rtype: str 

220 """ 

221 return self._gromet_type 

222 

223 @gromet_type.setter 

224 def gromet_type(self, gromet_type): 

225 """Sets the gromet_type of this GrometFNModule. 

226 

227 

228 :param gromet_type: The gromet_type of this GrometFNModule. # noqa: E501 

229 :type: str 

230 """ 

231 

232 self._gromet_type = gromet_type 

233 

234 def to_dict(self): 

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

236 result = {} 

237 

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

239 value = getattr(self, attr) 

240 if isinstance(value, list): 

241 result[attr] = list(map( 

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

243 value 

244 )) 

245 elif hasattr(value, "to_dict"): 

246 result[attr] = value.to_dict() 

247 elif isinstance(value, dict): 

248 result[attr] = dict(map( 

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

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

251 value.items() 

252 )) 

253 else: 

254 result[attr] = value 

255 if issubclass(GrometFNModule, dict): 

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

257 result[key] = value 

258 

259 return result 

260 

261 def to_str(self): 

262 """Returns the string representation of the model""" 

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

264 

265 def __repr__(self): 

266 """For `print` and `pprint`""" 

267 return self.to_str() 

268 

269 def __eq__(self, other): 

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

271 if not isinstance(other, GrometFNModule): 

272 return False 

273 

274 return self.__dict__ == other.__dict__ 

275 

276 def __ne__(self, other): 

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

278 return not self == other