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

1# coding: utf-8 

2 

3""" 

4 Grounded Model Exchange (GroMEt) schema for Function Networks 

5 

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 

7 

8 OpenAPI spec version: 0.1.10 

9 Contact: claytonm@arizona.edu 

10 Generated by: https://github.com/swagger-api/swagger-codegen.git 

11""" 

12 

13import pprint 

14import re # noqa: F401 

15 

16import six 

17 

18class TypedValue(object): 

19 """NOTE: This class is auto generated by the swagger code generator program. 

20 

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 } 

36 

37 attribute_map = { 

38 'type': 'type', 

39 'value': 'value', 

40 'index': 'index', 

41 'gromet_type': 'gromet_type' 

42 } 

43 

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 

59 

60 @property 

61 def type(self): 

62 """Gets the type of this TypedValue. # noqa: E501 

63 

64 The type of the value. # noqa: E501 

65 

66 :return: The type of this TypedValue. # noqa: E501 

67 :rtype: str 

68 """ 

69 return self._type 

70 

71 @type.setter 

72 def type(self, type): 

73 """Sets the type of this TypedValue. 

74 

75 The type of the value. # noqa: E501 

76 

77 :param type: The type of this TypedValue. # noqa: E501 

78 :type: str 

79 """ 

80 

81 self._type = type 

82 

83 @property 

84 def value(self): 

85 """Gets the value of this TypedValue. # noqa: E501 

86 

87 

88 :return: The value of this TypedValue. # noqa: E501 

89 :rtype: object 

90 """ 

91 return self._value 

92 

93 @value.setter 

94 def value(self, value): 

95 """Sets the value of this TypedValue. 

96 

97 

98 :param value: The value of this TypedValue. # noqa: E501 

99 :type: object 

100 """ 

101 

102 self._value = value 

103 

104 @property 

105 def index(self): 

106 """Gets the index of this TypedValue. # noqa: E501 

107 

108 Helper bookkeeping to facilitate keeping track of large list of TypedValues # noqa: E501 

109 

110 :return: The index of this TypedValue. # noqa: E501 

111 :rtype: int 

112 """ 

113 return self._index 

114 

115 @index.setter 

116 def index(self, index): 

117 """Sets the index of this TypedValue. 

118 

119 Helper bookkeeping to facilitate keeping track of large list of TypedValues # noqa: E501 

120 

121 :param index: The index of this TypedValue. # noqa: E501 

122 :type: int 

123 """ 

124 

125 self._index = index 

126 

127 @property 

128 def gromet_type(self): 

129 """Gets the gromet_type of this TypedValue. # noqa: E501 

130 

131 

132 :return: The gromet_type of this TypedValue. # noqa: E501 

133 :rtype: str 

134 """ 

135 return self._gromet_type 

136 

137 @gromet_type.setter 

138 def gromet_type(self, gromet_type): 

139 """Sets the gromet_type of this TypedValue. 

140 

141 

142 :param gromet_type: The gromet_type of this TypedValue. # noqa: E501 

143 :type: str 

144 """ 

145 

146 self._gromet_type = gromet_type 

147 

148 def to_dict(self): 

149 """Returns the model properties as a dict""" 

150 result = {} 

151 

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 

172 

173 return result 

174 

175 def to_str(self): 

176 """Returns the string representation of the model""" 

177 return pprint.pformat(self.to_dict()) 

178 

179 def __repr__(self): 

180 """For `print` and `pprint`""" 

181 return self.to_str() 

182 

183 def __eq__(self, other): 

184 """Returns true if both objects are equal""" 

185 if not isinstance(other, TypedValue): 

186 return False 

187 

188 return self.__dict__ == other.__dict__ 

189 

190 def __ne__(self, other): 

191 """Returns true if both objects are not equal""" 

192 return not self == other