Coverage for skema/program_analysis/CAST2FN/model/cast/source_code_data_type.py: 41%
61 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 SourceCodeDataType(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_language': 'str',
32 'source_language_version': 'str',
33 'data_type': 'str'
34 }
36 attribute_map = {
37 'source_language': 'source_language',
38 'source_language_version': 'source_language_version',
39 'data_type': 'data_type'
40 }
42 def __init__(self, source_language=None, source_language_version=None, data_type=None): # noqa: E501
43 """SourceCodeDataType - a model defined in Swagger""" # noqa: E501
44 self._source_language = None
45 self._source_language_version = None
46 self._data_type = None
47 self.discriminator = None
48 if source_language is not None:
49 self.source_language = source_language
50 if source_language_version is not None:
51 self.source_language_version = source_language_version
52 if data_type is not None:
53 self.data_type = data_type
55 @property
56 def source_language(self):
57 """Gets the source_language of this SourceCodeDataType. # noqa: E501
60 :return: The source_language of this SourceCodeDataType. # noqa: E501
61 :rtype: str
62 """
63 return self._source_language
65 @source_language.setter
66 def source_language(self, source_language):
67 """Sets the source_language of this SourceCodeDataType.
70 :param source_language: The source_language of this SourceCodeDataType. # noqa: E501
71 :type: str
72 """
74 self._source_language = source_language
76 @property
77 def source_language_version(self):
78 """Gets the source_language_version of this SourceCodeDataType. # noqa: E501
81 :return: The source_language_version of this SourceCodeDataType. # noqa: E501
82 :rtype: str
83 """
84 return self._source_language_version
86 @source_language_version.setter
87 def source_language_version(self, source_language_version):
88 """Sets the source_language_version of this SourceCodeDataType.
91 :param source_language_version: The source_language_version of this SourceCodeDataType. # noqa: E501
92 :type: str
93 """
95 self._source_language_version = source_language_version
97 @property
98 def data_type(self):
99 """Gets the data_type of this SourceCodeDataType. # noqa: E501
102 :return: The data_type of this SourceCodeDataType. # noqa: E501
103 :rtype: str
104 """
105 return self._data_type
107 @data_type.setter
108 def data_type(self, data_type):
109 """Sets the data_type of this SourceCodeDataType.
112 :param data_type: The data_type of this SourceCodeDataType. # noqa: E501
113 :type: str
114 """
116 self._data_type = data_type
118 def to_dict(self):
119 """Returns the model properties as a dict"""
120 result = {}
122 for attr, _ in six.iteritems(self.swagger_types):
123 value = getattr(self, attr)
124 if isinstance(value, list):
125 result[attr] = list(map(
126 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
127 value
128 ))
129 elif hasattr(value, "to_dict"):
130 result[attr] = value.to_dict()
131 elif isinstance(value, dict):
132 result[attr] = dict(map(
133 lambda item: (item[0], item[1].to_dict())
134 if hasattr(item[1], "to_dict") else item,
135 value.items()
136 ))
137 else:
138 result[attr] = value
139 if issubclass(SourceCodeDataType, dict):
140 for key, value in self.items():
141 result[key] = value
143 return result
145 def to_str(self):
146 """Returns the string representation of the model"""
147 return pprint.pformat(self.to_dict())
149 def __repr__(self):
150 """For `print` and `pprint`"""
151 return self.to_str()
153 def __eq__(self, other):
154 """Returns true if both objects are equal"""
155 if not isinstance(other, SourceCodeDataType):
156 return False
158 return self.__dict__ == other.__dict__
160 def __ne__(self, other):
161 """Returns true if both objects are not equal"""
162 return not self == other