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
« 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 SourceCodeReference(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 '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)
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)
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)
76 @property
77 def gromet_type(self):
78 """Gets the gromet_type of this SourceCodeReference. # noqa: E501
81 :return: The gromet_type of this SourceCodeReference. # noqa: E501
82 :rtype: str
83 """
84 return self._gromet_type
86 @gromet_type.setter
87 def gromet_type(self, gromet_type):
88 """Sets the gromet_type of this SourceCodeReference.
91 :param gromet_type: The gromet_type of this SourceCodeReference. # noqa: E501
92 :type: str
93 """
95 self._gromet_type = gromet_type
97 @property
98 def code_file_reference_uid(self):
99 """Gets the code_file_reference_uid of this SourceCodeReference. # noqa: E501
101 uid for the source code file CodeFileReference # noqa: E501
103 :return: The code_file_reference_uid of this SourceCodeReference. # noqa: E501
104 :rtype: str
105 """
106 return self._code_file_reference_uid
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.
112 uid for the source code file CodeFileReference # noqa: E501
114 :param code_file_reference_uid: The code_file_reference_uid of this SourceCodeReference. # noqa: E501
115 :type: str
116 """
118 self._code_file_reference_uid = code_file_reference_uid
120 @property
121 def line_begin(self):
122 """Gets the line_begin of this SourceCodeReference. # noqa: E501
124 The line number where the identifier name string occurs # noqa: E501
126 :return: The line_begin of this SourceCodeReference. # noqa: E501
127 :rtype: int
128 """
129 return self._line_begin
131 @line_begin.setter
132 def line_begin(self, line_begin):
133 """Sets the line_begin of this SourceCodeReference.
135 The line number where the identifier name string occurs # noqa: E501
137 :param line_begin: The line_begin of this SourceCodeReference. # noqa: E501
138 :type: int
139 """
141 self._line_begin = line_begin
143 @property
144 def line_end(self):
145 """Gets the line_end of this SourceCodeReference. # noqa: E501
147 The line number where the identifier name string occurs # noqa: E501
149 :return: The line_end of this SourceCodeReference. # noqa: E501
150 :rtype: int
151 """
152 return self._line_end
154 @line_end.setter
155 def line_end(self, line_end):
156 """Sets the line_end of this SourceCodeReference.
158 The line number where the identifier name string occurs # noqa: E501
160 :param line_end: The line_end of this SourceCodeReference. # noqa: E501
161 :type: int
162 """
164 self._line_end = line_end
166 @property
167 def col_begin(self):
168 """Gets the col_begin of this SourceCodeReference. # noqa: E501
170 The start column of the identifier name string instance # noqa: E501
172 :return: The col_begin of this SourceCodeReference. # noqa: E501
173 :rtype: int
174 """
175 return self._col_begin
177 @col_begin.setter
178 def col_begin(self, col_begin):
179 """Sets the col_begin of this SourceCodeReference.
181 The start column of the identifier name string instance # noqa: E501
183 :param col_begin: The col_begin of this SourceCodeReference. # noqa: E501
184 :type: int
185 """
187 self._col_begin = col_begin
189 @property
190 def col_end(self):
191 """Gets the col_end of this SourceCodeReference. # noqa: E501
193 The end column of the identifier name string instance # noqa: E501
195 :return: The col_end of this SourceCodeReference. # noqa: E501
196 :rtype: int
197 """
198 return self._col_end
200 @col_end.setter
201 def col_end(self, col_end):
202 """Sets the col_end of this SourceCodeReference.
204 The end column of the identifier name string instance # noqa: E501
206 :param col_end: The col_end of this SourceCodeReference. # noqa: E501
207 :type: int
208 """
210 self._col_end = col_end
212 def to_dict(self):
213 """Returns the model properties as a dict"""
214 result = {}
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
237 return result
239 def to_str(self):
240 """Returns the string representation of the model"""
241 return pprint.pformat(self.to_dict())
243 def __repr__(self):
244 """For `print` and `pprint`"""
245 return self.to_str()
247 def __eq__(self, other):
248 """Returns true if both objects are equal"""
249 if not isinstance(other, SourceCodeReference):
250 return False
252 return self.__dict__ == other.__dict__
254 def __ne__(self, other):
255 """Returns true if both objects are not equal"""
256 return not self == other