Coverage for skema/gromet/metadata/source_code_comment.py: 89%
121 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 GroMEt Metadata spec
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
8 OpenAPI spec version: 0.1.8
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.metadata.metadata import Metadata # noqa: F401,E501
19class SourceCodeComment(Metadata):
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 'gromet_type': 'str',
33 'comment': 'str',
34 'comment_type': 'CommentType',
35 'context_function_name': 'str',
36 'code_file_reference_uid': 'str',
37 'line_begin': 'int',
38 'line_end': 'int',
39 'col_begin': 'int',
40 'col_end': 'int'
41 }
42 if hasattr(Metadata, "swagger_types"):
43 swagger_types.update(Metadata.swagger_types)
45 attribute_map = {
46 'gromet_type': 'gromet_type',
47 'comment': 'comment',
48 'comment_type': 'comment_type',
49 'context_function_name': 'context_function_name',
50 'code_file_reference_uid': 'code_file_reference_uid',
51 'line_begin': 'line_begin',
52 'line_end': 'line_end',
53 'col_begin': 'col_begin',
54 'col_end': 'col_end'
55 }
56 if hasattr(Metadata, "attribute_map"):
57 attribute_map.update(Metadata.attribute_map)
59 def __init__(self, gromet_type='SourceCodeComment', comment=None, comment_type=None, context_function_name=None, code_file_reference_uid=None, line_begin=None, line_end=None, col_begin=None, col_end=None, *args, **kwargs): # noqa: E501
60 """SourceCodeComment - a model defined in Swagger""" # noqa: E501
61 self._gromet_type = None
62 self._comment = None
63 self._comment_type = None
64 self._context_function_name = None
65 self._code_file_reference_uid = None
66 self._line_begin = None
67 self._line_end = None
68 self._col_begin = None
69 self._col_end = None
70 self.discriminator = None
71 if gromet_type is not None:
72 self.gromet_type = gromet_type
73 if comment is not None:
74 self.comment = comment
75 if comment_type is not None:
76 self.comment_type = comment_type
77 if context_function_name is not None:
78 self.context_function_name = context_function_name
79 if code_file_reference_uid is not None:
80 self.code_file_reference_uid = code_file_reference_uid
81 if line_begin is not None:
82 self.line_begin = line_begin
83 if line_end is not None:
84 self.line_end = line_end
85 if col_begin is not None:
86 self.col_begin = col_begin
87 if col_end is not None:
88 self.col_end = col_end
89 Metadata.__init__(self, *args, **kwargs)
91 @property
92 def gromet_type(self):
93 """Gets the gromet_type of this SourceCodeComment. # noqa: E501
96 :return: The gromet_type of this SourceCodeComment. # noqa: E501
97 :rtype: str
98 """
99 return self._gromet_type
101 @gromet_type.setter
102 def gromet_type(self, gromet_type):
103 """Sets the gromet_type of this SourceCodeComment.
106 :param gromet_type: The gromet_type of this SourceCodeComment. # noqa: E501
107 :type: str
108 """
110 self._gromet_type = gromet_type
112 @property
113 def comment(self):
114 """Gets the comment of this SourceCodeComment. # noqa: E501
116 The comment string. # noqa: E501
118 :return: The comment of this SourceCodeComment. # noqa: E501
119 :rtype: str
120 """
121 return self._comment
123 @comment.setter
124 def comment(self, comment):
125 """Sets the comment of this SourceCodeComment.
127 The comment string. # noqa: E501
129 :param comment: The comment of this SourceCodeComment. # noqa: E501
130 :type: str
131 """
133 self._comment = comment
135 @property
136 def comment_type(self):
137 """Gets the comment_type of this SourceCodeComment. # noqa: E501
139 The comment type. # noqa: E501
141 :return: The comment_type of this SourceCodeComment. # noqa: E501
142 :rtype: CommentType
143 """
144 return self._comment_type
146 @comment_type.setter
147 def comment_type(self, comment_type):
148 """Sets the comment_type of this SourceCodeComment.
150 The comment type. # noqa: E501
152 :param comment_type: The comment_type of this SourceCodeComment. # noqa: E501
153 :type: CommentType
154 """
156 self._comment_type = comment_type
158 @property
159 def context_function_name(self):
160 """Gets the context_function_name of this SourceCodeComment. # noqa: E501
162 When the comment_type is \"DOCSTRING\", this represents the name of the function that the docstring is associated with. # noqa: E501
164 :return: The context_function_name of this SourceCodeComment. # noqa: E501
165 :rtype: str
166 """
167 return self._context_function_name
169 @context_function_name.setter
170 def context_function_name(self, context_function_name):
171 """Sets the context_function_name of this SourceCodeComment.
173 When the comment_type is \"DOCSTRING\", this represents the name of the function that the docstring is associated with. # noqa: E501
175 :param context_function_name: The context_function_name of this SourceCodeComment. # noqa: E501
176 :type: str
177 """
179 self._context_function_name = context_function_name
181 @property
182 def code_file_reference_uid(self):
183 """Gets the code_file_reference_uid of this SourceCodeComment. # noqa: E501
185 uid for the source code file CodeFileReference. # noqa: E501
187 :return: The code_file_reference_uid of this SourceCodeComment. # noqa: E501
188 :rtype: str
189 """
190 return self._code_file_reference_uid
192 @code_file_reference_uid.setter
193 def code_file_reference_uid(self, code_file_reference_uid):
194 """Sets the code_file_reference_uid of this SourceCodeComment.
196 uid for the source code file CodeFileReference. # noqa: E501
198 :param code_file_reference_uid: The code_file_reference_uid of this SourceCodeComment. # noqa: E501
199 :type: str
200 """
202 self._code_file_reference_uid = code_file_reference_uid
204 @property
205 def line_begin(self):
206 """Gets the line_begin of this SourceCodeComment. # noqa: E501
208 The line number where the comment begins. # noqa: E501
210 :return: The line_begin of this SourceCodeComment. # noqa: E501
211 :rtype: int
212 """
213 return self._line_begin
215 @line_begin.setter
216 def line_begin(self, line_begin):
217 """Sets the line_begin of this SourceCodeComment.
219 The line number where the comment begins. # noqa: E501
221 :param line_begin: The line_begin of this SourceCodeComment. # noqa: E501
222 :type: int
223 """
225 self._line_begin = line_begin
227 @property
228 def line_end(self):
229 """Gets the line_end of this SourceCodeComment. # noqa: E501
231 The line number where the comment ends. # noqa: E501
233 :return: The line_end of this SourceCodeComment. # noqa: E501
234 :rtype: int
235 """
236 return self._line_end
238 @line_end.setter
239 def line_end(self, line_end):
240 """Sets the line_end of this SourceCodeComment.
242 The line number where the comment ends. # noqa: E501
244 :param line_end: The line_end of this SourceCodeComment. # noqa: E501
245 :type: int
246 """
248 self._line_end = line_end
250 @property
251 def col_begin(self):
252 """Gets the col_begin of this SourceCodeComment. # noqa: E501
254 The start column of the comment. # noqa: E501
256 :return: The col_begin of this SourceCodeComment. # noqa: E501
257 :rtype: int
258 """
259 return self._col_begin
261 @col_begin.setter
262 def col_begin(self, col_begin):
263 """Sets the col_begin of this SourceCodeComment.
265 The start column of the comment. # noqa: E501
267 :param col_begin: The col_begin of this SourceCodeComment. # noqa: E501
268 :type: int
269 """
271 self._col_begin = col_begin
273 @property
274 def col_end(self):
275 """Gets the col_end of this SourceCodeComment. # noqa: E501
277 The end column of the comment. # noqa: E501
279 :return: The col_end of this SourceCodeComment. # noqa: E501
280 :rtype: int
281 """
282 return self._col_end
284 @col_end.setter
285 def col_end(self, col_end):
286 """Sets the col_end of this SourceCodeComment.
288 The end column of the comment. # noqa: E501
290 :param col_end: The col_end of this SourceCodeComment. # noqa: E501
291 :type: int
292 """
294 self._col_end = col_end
296 def to_dict(self):
297 """Returns the model properties as a dict"""
298 result = {}
300 for attr, _ in six.iteritems(self.swagger_types):
301 value = getattr(self, attr)
302 if isinstance(value, list):
303 result[attr] = list(map(
304 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
305 value
306 ))
307 elif hasattr(value, "to_dict"):
308 result[attr] = value.to_dict()
309 elif isinstance(value, dict):
310 result[attr] = dict(map(
311 lambda item: (item[0], item[1].to_dict())
312 if hasattr(item[1], "to_dict") else item,
313 value.items()
314 ))
315 else:
316 result[attr] = value
317 if issubclass(SourceCodeComment, dict):
318 for key, value in self.items():
319 result[key] = value
321 return result
323 def to_str(self):
324 """Returns the string representation of the model"""
325 return pprint.pformat(self.to_dict())
327 def __repr__(self):
328 """For `print` and `pprint`"""
329 return self.to_str()
331 def __eq__(self, other):
332 """Returns true if both objects are equal"""
333 if not isinstance(other, SourceCodeComment):
334 return False
336 return self.__dict__ == other.__dict__
338 def __ne__(self, other):
339 """Returns true if both objects are not equal"""
340 return not self == other