Coverage for skema/program_analysis/CAST2FN/model/cast/source_ref.py: 91%
79 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 SKEMA Common Abstract Syntax Tree (CAST)
6 This document outlines the structure of the CAST that will be used as a generic representation of the semantics of a program written in any language. This will be used when creating functions networks from programs using the SKEMA Program Analysis pipeline. __Generating 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. 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/cast_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/` # noqa: E501
8 OpenAPI spec version: 1.2.6
10 Generated by: https://github.com/swagger-api/swagger-codegen.git
11"""
13import pprint
14import re # noqa: F401
16import six
18class SourceRef(object):
19 """NOTE: This class is auto generated by the swagger code generator program.
21 Do not edit the class manually.
22 """
23 """
24 Attributes:
25 swagger_types (dict): The key is attribute name
26 and the value is attribute type.
27 attribute_map (dict): The key is attribute name
28 and the value is json key in definition.
29 """
30 swagger_types = {
31 'source_file_name': 'str',
32 'col_start': 'float',
33 'col_end': 'float',
34 'row_start': 'float',
35 'row_end': 'float'
36 }
38 attribute_map = {
39 'source_file_name': 'source_file_name',
40 'col_start': 'col_start',
41 'col_end': 'col_end',
42 'row_start': 'row_start',
43 'row_end': 'row_end'
44 }
46 def __init__(self, source_file_name=None, col_start=None, col_end=None, row_start=None, row_end=None): # noqa: E501
47 """SourceRef - a model defined in Swagger""" # noqa: E501
48 self._source_file_name = None
49 self._col_start = None
50 self._col_end = None
51 self._row_start = None
52 self._row_end = None
53 self.discriminator = None
54 if source_file_name is not None:
55 self.source_file_name = source_file_name
56 if col_start is not None:
57 self.col_start = col_start
58 if col_end is not None:
59 self.col_end = col_end
60 if row_start is not None:
61 self.row_start = row_start
62 if row_end is not None:
63 self.row_end = row_end
65 @property
66 def source_file_name(self):
67 """Gets the source_file_name of this SourceRef. # noqa: E501
70 :return: The source_file_name of this SourceRef. # noqa: E501
71 :rtype: str
72 """
73 return self._source_file_name
75 @source_file_name.setter
76 def source_file_name(self, source_file_name):
77 """Sets the source_file_name of this SourceRef.
80 :param source_file_name: The source_file_name of this SourceRef. # noqa: E501
81 :type: str
82 """
84 self._source_file_name = source_file_name
86 @property
87 def col_start(self):
88 """Gets the col_start of this SourceRef. # noqa: E501
91 :return: The col_start of this SourceRef. # noqa: E501
92 :rtype: float
93 """
94 return self._col_start
96 @col_start.setter
97 def col_start(self, col_start):
98 """Sets the col_start of this SourceRef.
101 :param col_start: The col_start of this SourceRef. # noqa: E501
102 :type: float
103 """
105 self._col_start = col_start
107 @property
108 def col_end(self):
109 """Gets the col_end of this SourceRef. # noqa: E501
112 :return: The col_end of this SourceRef. # noqa: E501
113 :rtype: float
114 """
115 return self._col_end
117 @col_end.setter
118 def col_end(self, col_end):
119 """Sets the col_end of this SourceRef.
122 :param col_end: The col_end of this SourceRef. # noqa: E501
123 :type: float
124 """
126 self._col_end = col_end
128 @property
129 def row_start(self):
130 """Gets the row_start of this SourceRef. # noqa: E501
133 :return: The row_start of this SourceRef. # noqa: E501
134 :rtype: float
135 """
136 return self._row_start
138 @row_start.setter
139 def row_start(self, row_start):
140 """Sets the row_start of this SourceRef.
143 :param row_start: The row_start of this SourceRef. # noqa: E501
144 :type: float
145 """
147 self._row_start = row_start
149 @property
150 def row_end(self):
151 """Gets the row_end of this SourceRef. # noqa: E501
154 :return: The row_end of this SourceRef. # noqa: E501
155 :rtype: float
156 """
157 return self._row_end
159 @row_end.setter
160 def row_end(self, row_end):
161 """Sets the row_end of this SourceRef.
164 :param row_end: The row_end of this SourceRef. # noqa: E501
165 :type: float
166 """
168 self._row_end = row_end
170 def to_dict(self):
171 """Returns the model properties as a dict"""
172 result = {}
174 for attr, _ in six.iteritems(self.swagger_types):
175 value = getattr(self, attr)
176 if isinstance(value, list):
177 result[attr] = list(map(
178 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
179 value
180 ))
181 elif hasattr(value, "to_dict"):
182 result[attr] = value.to_dict()
183 elif isinstance(value, dict):
184 result[attr] = dict(map(
185 lambda item: (item[0], item[1].to_dict())
186 if hasattr(item[1], "to_dict") else item,
187 value.items()
188 ))
189 else:
190 result[attr] = value
191 if issubclass(SourceRef, dict):
192 for key, value in self.items():
193 result[key] = value
195 return result
197 def to_str(self):
198 """Returns the string representation of the model"""
199 return pprint.pformat(self.to_dict())
201 def __repr__(self):
202 """For `print` and `pprint`"""
203 return self.to_str()
205 def __eq__(self, other):
206 """Returns true if both objects are equal"""
207 if not isinstance(other, SourceRef):
208 return False
210 return self.__dict__ == other.__dict__
212 def __ne__(self, other):
213 """Returns true if both objects are not equal"""
214 return not self == other