Coverage for skema/gromet/metadata/code_file_reference.py: 84%

79 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1# coding: utf-8 

2 

3""" 

4 GroMEt Metadata spec 

5 

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 

7 

8 OpenAPI spec version: 0.1.8 

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 CodeFileReference(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 'gromet_type': 'str', 

32 'uid': 'str', 

33 'name': 'str', 

34 'path': 'str', 

35 'source_string': 'str' 

36 } 

37 

38 attribute_map = { 

39 'gromet_type': 'gromet_type', 

40 'uid': 'uid', 

41 'name': 'name', 

42 'path': 'path', 

43 'source_string': 'source_string' 

44 } 

45 

46 def __init__(self, gromet_type='CodeFileReference', uid=None, name=None, path=None, source_string=None): # noqa: E501 

47 """CodeFileReference - a model defined in Swagger""" # noqa: E501 

48 self._gromet_type = None 

49 self._uid = None 

50 self._name = None 

51 self._path = None 

52 self._source_string = None 

53 self.discriminator = None 

54 if gromet_type is not None: 

55 self.gromet_type = gromet_type 

56 if uid is not None: 

57 self.uid = uid 

58 if name is not None: 

59 self.name = name 

60 if path is not None: 

61 self.path = path 

62 if source_string is not None: 

63 self.source_string = source_string 

64 

65 @property 

66 def gromet_type(self): 

67 """Gets the gromet_type of this CodeFileReference. # noqa: E501 

68 

69 

70 :return: The gromet_type of this CodeFileReference. # noqa: E501 

71 :rtype: str 

72 """ 

73 return self._gromet_type 

74 

75 @gromet_type.setter 

76 def gromet_type(self, gromet_type): 

77 """Sets the gromet_type of this CodeFileReference. 

78 

79 

80 :param gromet_type: The gromet_type of this CodeFileReference. # noqa: E501 

81 :type: str 

82 """ 

83 

84 self._gromet_type = gromet_type 

85 

86 @property 

87 def uid(self): 

88 """Gets the uid of this CodeFileReference. # noqa: E501 

89 

90 uid for CodeFileReference # noqa: E501 

91 

92 :return: The uid of this CodeFileReference. # noqa: E501 

93 :rtype: str 

94 """ 

95 return self._uid 

96 

97 @uid.setter 

98 def uid(self, uid): 

99 """Sets the uid of this CodeFileReference. 

100 

101 uid for CodeFileReference # noqa: E501 

102 

103 :param uid: The uid of this CodeFileReference. # noqa: E501 

104 :type: str 

105 """ 

106 

107 self._uid = uid 

108 

109 @property 

110 def name(self): 

111 """Gets the name of this CodeFileReference. # noqa: E501 

112 

113 File name # noqa: E501 

114 

115 :return: The name of this CodeFileReference. # noqa: E501 

116 :rtype: str 

117 """ 

118 return self._name 

119 

120 @name.setter 

121 def name(self, name): 

122 """Sets the name of this CodeFileReference. 

123 

124 File name # noqa: E501 

125 

126 :param name: The name of this CodeFileReference. # noqa: E501 

127 :type: str 

128 """ 

129 

130 self._name = name 

131 

132 @property 

133 def path(self): 

134 """Gets the path of this CodeFileReference. # noqa: E501 

135 

136 File path, assume starting from root of code collection # noqa: E501 

137 

138 :return: The path of this CodeFileReference. # noqa: E501 

139 :rtype: str 

140 """ 

141 return self._path 

142 

143 @path.setter 

144 def path(self, path): 

145 """Sets the path of this CodeFileReference. 

146 

147 File path, assume starting from root of code collection # noqa: E501 

148 

149 :param path: The path of this CodeFileReference. # noqa: E501 

150 :type: str 

151 """ 

152 

153 self._path = path 

154 

155 @property 

156 def source_string(self): 

157 """Gets the source_string of this CodeFileReference. # noqa: E501 

158 

159 Optional string containing the contents of the source file # noqa: E501 

160 

161 :return: The source_string of this CodeFileReference. # noqa: E501 

162 :rtype: str 

163 """ 

164 return self._source_string 

165 

166 @source_string.setter 

167 def source_string(self, source_string): 

168 """Sets the source_string of this CodeFileReference. 

169 

170 Optional string containing the contents of the source file # noqa: E501 

171 

172 :param source_string: The source_string of this CodeFileReference. # noqa: E501 

173 :type: str 

174 """ 

175 

176 self._source_string = source_string 

177 

178 def to_dict(self): 

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

180 result = {} 

181 

182 for attr, _ in six.iteritems(self.swagger_types): 

183 value = getattr(self, attr) 

184 if isinstance(value, list): 

185 result[attr] = list(map( 

186 lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 

187 value 

188 )) 

189 elif hasattr(value, "to_dict"): 

190 result[attr] = value.to_dict() 

191 elif isinstance(value, dict): 

192 result[attr] = dict(map( 

193 lambda item: (item[0], item[1].to_dict()) 

194 if hasattr(item[1], "to_dict") else item, 

195 value.items() 

196 )) 

197 else: 

198 result[attr] = value 

199 if issubclass(CodeFileReference, dict): 

200 for key, value in self.items(): 

201 result[key] = value 

202 

203 return result 

204 

205 def to_str(self): 

206 """Returns the string representation of the model""" 

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

208 

209 def __repr__(self): 

210 """For `print` and `pprint`""" 

211 return self.to_str() 

212 

213 def __eq__(self, other): 

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

215 if not isinstance(other, CodeFileReference): 

216 return False 

217 

218 return self.__dict__ == other.__dict__ 

219 

220 def __ne__(self, other): 

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

222 return not self == other