Coverage for skema/gromet/fn/typed_value.py: 81%
70 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 Grounded Model Exchange (GroMEt) schema for Function Networks
6 This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __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/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model 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.7`.) 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_FN_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/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` <automates>/automates/model_assembly/gromet/model/README.md ``` # noqa: E501
8 OpenAPI spec version: 0.1.10
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
18class TypedValue(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 'type': 'str',
32 'value': 'object',
33 'index': 'int',
34 'gromet_type': 'str'
35 }
37 attribute_map = {
38 'type': 'type',
39 'value': 'value',
40 'index': 'index',
41 'gromet_type': 'gromet_type'
42 }
44 def __init__(self, type=None, value=None, index=None, gromet_type='TypedValue'): # noqa: E501
45 """TypedValue - a model defined in Swagger""" # noqa: E501
46 self._type = None
47 self._value = None
48 self._index = None
49 self._gromet_type = None
50 self.discriminator = None
51 if type is not None:
52 self.type = type
53 if value is not None:
54 self.value = value
55 if index is not None:
56 self.index = index
57 if gromet_type is not None:
58 self.gromet_type = gromet_type
60 @property
61 def type(self):
62 """Gets the type of this TypedValue. # noqa: E501
64 The type of the value. # noqa: E501
66 :return: The type of this TypedValue. # noqa: E501
67 :rtype: str
68 """
69 return self._type
71 @type.setter
72 def type(self, type):
73 """Sets the type of this TypedValue.
75 The type of the value. # noqa: E501
77 :param type: The type of this TypedValue. # noqa: E501
78 :type: str
79 """
81 self._type = type
83 @property
84 def value(self):
85 """Gets the value of this TypedValue. # noqa: E501
88 :return: The value of this TypedValue. # noqa: E501
89 :rtype: object
90 """
91 return self._value
93 @value.setter
94 def value(self, value):
95 """Sets the value of this TypedValue.
98 :param value: The value of this TypedValue. # noqa: E501
99 :type: object
100 """
102 self._value = value
104 @property
105 def index(self):
106 """Gets the index of this TypedValue. # noqa: E501
108 Helper bookkeeping to facilitate keeping track of large list of TypedValues # noqa: E501
110 :return: The index of this TypedValue. # noqa: E501
111 :rtype: int
112 """
113 return self._index
115 @index.setter
116 def index(self, index):
117 """Sets the index of this TypedValue.
119 Helper bookkeeping to facilitate keeping track of large list of TypedValues # noqa: E501
121 :param index: The index of this TypedValue. # noqa: E501
122 :type: int
123 """
125 self._index = index
127 @property
128 def gromet_type(self):
129 """Gets the gromet_type of this TypedValue. # noqa: E501
132 :return: The gromet_type of this TypedValue. # noqa: E501
133 :rtype: str
134 """
135 return self._gromet_type
137 @gromet_type.setter
138 def gromet_type(self, gromet_type):
139 """Sets the gromet_type of this TypedValue.
142 :param gromet_type: The gromet_type of this TypedValue. # noqa: E501
143 :type: str
144 """
146 self._gromet_type = gromet_type
148 def to_dict(self):
149 """Returns the model properties as a dict"""
150 result = {}
152 for attr, _ in six.iteritems(self.swagger_types):
153 value = getattr(self, attr)
154 if isinstance(value, list):
155 result[attr] = list(map(
156 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
157 value
158 ))
159 elif hasattr(value, "to_dict"):
160 result[attr] = value.to_dict()
161 elif isinstance(value, dict):
162 result[attr] = dict(map(
163 lambda item: (item[0], item[1].to_dict())
164 if hasattr(item[1], "to_dict") else item,
165 value.items()
166 ))
167 else:
168 result[attr] = value
169 if issubclass(TypedValue, dict):
170 for key, value in self.items():
171 result[key] = value
173 return result
175 def to_str(self):
176 """Returns the string representation of the model"""
177 return pprint.pformat(self.to_dict())
179 def __repr__(self):
180 """For `print` and `pprint`"""
181 return self.to_str()
183 def __eq__(self, other):
184 """Returns true if both objects are equal"""
185 if not isinstance(other, TypedValue):
186 return False
188 return self.__dict__ == other.__dict__
190 def __ne__(self, other):
191 """Returns true if both objects are not equal"""
192 return not self == other