Coverage for skema/gromet/metadata/source_code_reference.py: 93%

94 statements  

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

1# coding: utf-8 

2 

3""" 

4 GroMEt Metadata spec 

5 

6 Grounded Model Exchange (GroMEt) Metadata schema specification __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/). We can use this to generate client code based off of this spec that will also generate the 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.4`.) 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_metadata_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/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt Metadata schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` <automates>/automates/model_assembly/gromet/metadata/README.md ``` # noqa: E501 

7 

8 OpenAPI spec version: 0.1.8 

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.metadata.metadata import Metadata # noqa: F401,E501 

18 

19class SourceCodeReference(Metadata): 

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

33 'code_file_reference_uid': 'str', 

34 'line_begin': 'int', 

35 'line_end': 'int', 

36 'col_begin': 'int', 

37 'col_end': 'int' 

38 } 

39 if hasattr(Metadata, "swagger_types"): 

40 swagger_types.update(Metadata.swagger_types) 

41 

42 attribute_map = { 

43 'gromet_type': 'gromet_type', 

44 'code_file_reference_uid': 'code_file_reference_uid', 

45 'line_begin': 'line_begin', 

46 'line_end': 'line_end', 

47 'col_begin': 'col_begin', 

48 'col_end': 'col_end' 

49 } 

50 if hasattr(Metadata, "attribute_map"): 

51 attribute_map.update(Metadata.attribute_map) 

52 

53 def __init__(self, gromet_type='SourceCodeReference', code_file_reference_uid=None, line_begin=None, line_end=None, col_begin=None, col_end=None, *args, **kwargs): # noqa: E501 

54 """SourceCodeReference - a model defined in Swagger""" # noqa: E501 

55 self._gromet_type = None 

56 self._code_file_reference_uid = None 

57 self._line_begin = None 

58 self._line_end = None 

59 self._col_begin = None 

60 self._col_end = None 

61 self.discriminator = None 

62 if gromet_type is not None: 

63 self.gromet_type = gromet_type 

64 if code_file_reference_uid is not None: 

65 self.code_file_reference_uid = code_file_reference_uid 

66 if line_begin is not None: 

67 self.line_begin = line_begin 

68 if line_end is not None: 

69 self.line_end = line_end 

70 if col_begin is not None: 

71 self.col_begin = col_begin 

72 if col_end is not None: 

73 self.col_end = col_end 

74 Metadata.__init__(self, *args, **kwargs) 

75 

76 @property 

77 def gromet_type(self): 

78 """Gets the gromet_type of this SourceCodeReference. # noqa: E501 

79 

80 

81 :return: The gromet_type of this SourceCodeReference. # noqa: E501 

82 :rtype: str 

83 """ 

84 return self._gromet_type 

85 

86 @gromet_type.setter 

87 def gromet_type(self, gromet_type): 

88 """Sets the gromet_type of this SourceCodeReference. 

89 

90 

91 :param gromet_type: The gromet_type of this SourceCodeReference. # noqa: E501 

92 :type: str 

93 """ 

94 

95 self._gromet_type = gromet_type 

96 

97 @property 

98 def code_file_reference_uid(self): 

99 """Gets the code_file_reference_uid of this SourceCodeReference. # noqa: E501 

100 

101 uid for the source code file CodeFileReference # noqa: E501 

102 

103 :return: The code_file_reference_uid of this SourceCodeReference. # noqa: E501 

104 :rtype: str 

105 """ 

106 return self._code_file_reference_uid 

107 

108 @code_file_reference_uid.setter 

109 def code_file_reference_uid(self, code_file_reference_uid): 

110 """Sets the code_file_reference_uid of this SourceCodeReference. 

111 

112 uid for the source code file CodeFileReference # noqa: E501 

113 

114 :param code_file_reference_uid: The code_file_reference_uid of this SourceCodeReference. # noqa: E501 

115 :type: str 

116 """ 

117 

118 self._code_file_reference_uid = code_file_reference_uid 

119 

120 @property 

121 def line_begin(self): 

122 """Gets the line_begin of this SourceCodeReference. # noqa: E501 

123 

124 The line number where the identifier name string occurs # noqa: E501 

125 

126 :return: The line_begin of this SourceCodeReference. # noqa: E501 

127 :rtype: int 

128 """ 

129 return self._line_begin 

130 

131 @line_begin.setter 

132 def line_begin(self, line_begin): 

133 """Sets the line_begin of this SourceCodeReference. 

134 

135 The line number where the identifier name string occurs # noqa: E501 

136 

137 :param line_begin: The line_begin of this SourceCodeReference. # noqa: E501 

138 :type: int 

139 """ 

140 

141 self._line_begin = line_begin 

142 

143 @property 

144 def line_end(self): 

145 """Gets the line_end of this SourceCodeReference. # noqa: E501 

146 

147 The line number where the identifier name string occurs # noqa: E501 

148 

149 :return: The line_end of this SourceCodeReference. # noqa: E501 

150 :rtype: int 

151 """ 

152 return self._line_end 

153 

154 @line_end.setter 

155 def line_end(self, line_end): 

156 """Sets the line_end of this SourceCodeReference. 

157 

158 The line number where the identifier name string occurs # noqa: E501 

159 

160 :param line_end: The line_end of this SourceCodeReference. # noqa: E501 

161 :type: int 

162 """ 

163 

164 self._line_end = line_end 

165 

166 @property 

167 def col_begin(self): 

168 """Gets the col_begin of this SourceCodeReference. # noqa: E501 

169 

170 The start column of the identifier name string instance # noqa: E501 

171 

172 :return: The col_begin of this SourceCodeReference. # noqa: E501 

173 :rtype: int 

174 """ 

175 return self._col_begin 

176 

177 @col_begin.setter 

178 def col_begin(self, col_begin): 

179 """Sets the col_begin of this SourceCodeReference. 

180 

181 The start column of the identifier name string instance # noqa: E501 

182 

183 :param col_begin: The col_begin of this SourceCodeReference. # noqa: E501 

184 :type: int 

185 """ 

186 

187 self._col_begin = col_begin 

188 

189 @property 

190 def col_end(self): 

191 """Gets the col_end of this SourceCodeReference. # noqa: E501 

192 

193 The end column of the identifier name string instance # noqa: E501 

194 

195 :return: The col_end of this SourceCodeReference. # noqa: E501 

196 :rtype: int 

197 """ 

198 return self._col_end 

199 

200 @col_end.setter 

201 def col_end(self, col_end): 

202 """Sets the col_end of this SourceCodeReference. 

203 

204 The end column of the identifier name string instance # noqa: E501 

205 

206 :param col_end: The col_end of this SourceCodeReference. # noqa: E501 

207 :type: int 

208 """ 

209 

210 self._col_end = col_end 

211 

212 def to_dict(self): 

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

214 result = {} 

215 

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

217 value = getattr(self, attr) 

218 if isinstance(value, list): 

219 result[attr] = list(map( 

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

221 value 

222 )) 

223 elif hasattr(value, "to_dict"): 

224 result[attr] = value.to_dict() 

225 elif isinstance(value, dict): 

226 result[attr] = dict(map( 

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

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

229 value.items() 

230 )) 

231 else: 

232 result[attr] = value 

233 if issubclass(SourceCodeReference, dict): 

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

235 result[key] = value 

236 

237 return result 

238 

239 def to_str(self): 

240 """Returns the string representation of the model""" 

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

242 

243 def __repr__(self): 

244 """For `print` and `pprint`""" 

245 return self.to_str() 

246 

247 def __eq__(self, other): 

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

249 if not isinstance(other, SourceCodeReference): 

250 return False 

251 

252 return self.__dict__ == other.__dict__ 

253 

254 def __ne__(self, other): 

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

256 return not self == other