Coverage for skema/gromet/metadata/text_extraction.py: 42%

88 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 TextExtraction(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 'document_reference_uid': 'str', 

33 'page': 'int', 

34 'block': 'int', 

35 'char_begin': 'int', 

36 'char_end': 'int' 

37 } 

38 

39 attribute_map = { 

40 'gromet_type': 'gromet_type', 

41 'document_reference_uid': 'document_reference_uid', 

42 'page': 'page', 

43 'block': 'block', 

44 'char_begin': 'char_begin', 

45 'char_end': 'char_end' 

46 } 

47 

48 def __init__(self, gromet_type='TextExtraction', document_reference_uid=None, page=None, block=None, char_begin=None, char_end=None): # noqa: E501 

49 """TextExtraction - a model defined in Swagger""" # noqa: E501 

50 self._gromet_type = None 

51 self._document_reference_uid = None 

52 self._page = None 

53 self._block = None 

54 self._char_begin = None 

55 self._char_end = None 

56 self.discriminator = None 

57 if gromet_type is not None: 

58 self.gromet_type = gromet_type 

59 if document_reference_uid is not None: 

60 self.document_reference_uid = document_reference_uid 

61 if page is not None: 

62 self.page = page 

63 if block is not None: 

64 self.block = block 

65 if char_begin is not None: 

66 self.char_begin = char_begin 

67 if char_end is not None: 

68 self.char_end = char_end 

69 

70 @property 

71 def gromet_type(self): 

72 """Gets the gromet_type of this TextExtraction. # noqa: E501 

73 

74 

75 :return: The gromet_type of this TextExtraction. # noqa: E501 

76 :rtype: str 

77 """ 

78 return self._gromet_type 

79 

80 @gromet_type.setter 

81 def gromet_type(self, gromet_type): 

82 """Sets the gromet_type of this TextExtraction. 

83 

84 

85 :param gromet_type: The gromet_type of this TextExtraction. # noqa: E501 

86 :type: str 

87 """ 

88 

89 self._gromet_type = gromet_type 

90 

91 @property 

92 def document_reference_uid(self): 

93 """Gets the document_reference_uid of this TextExtraction. # noqa: E501 

94 

95 uid of \\<document_reference> # noqa: E501 

96 

97 :return: The document_reference_uid of this TextExtraction. # noqa: E501 

98 :rtype: str 

99 """ 

100 return self._document_reference_uid 

101 

102 @document_reference_uid.setter 

103 def document_reference_uid(self, document_reference_uid): 

104 """Sets the document_reference_uid of this TextExtraction. 

105 

106 uid of \\<document_reference> # noqa: E501 

107 

108 :param document_reference_uid: The document_reference_uid of this TextExtraction. # noqa: E501 

109 :type: str 

110 """ 

111 

112 self._document_reference_uid = document_reference_uid 

113 

114 @property 

115 def page(self): 

116 """Gets the page of this TextExtraction. # noqa: E501 

117 

118 The COSMOS-assigned page number # noqa: E501 

119 

120 :return: The page of this TextExtraction. # noqa: E501 

121 :rtype: int 

122 """ 

123 return self._page 

124 

125 @page.setter 

126 def page(self, page): 

127 """Sets the page of this TextExtraction. 

128 

129 The COSMOS-assigned page number # noqa: E501 

130 

131 :param page: The page of this TextExtraction. # noqa: E501 

132 :type: int 

133 """ 

134 

135 self._page = page 

136 

137 @property 

138 def block(self): 

139 """Gets the block of this TextExtraction. # noqa: E501 

140 

141 The COSMOS-extracted text block from the page # noqa: E501 

142 

143 :return: The block of this TextExtraction. # noqa: E501 

144 :rtype: int 

145 """ 

146 return self._block 

147 

148 @block.setter 

149 def block(self, block): 

150 """Sets the block of this TextExtraction. 

151 

152 The COSMOS-extracted text block from the page # noqa: E501 

153 

154 :param block: The block of this TextExtraction. # noqa: E501 

155 :type: int 

156 """ 

157 

158 self._block = block 

159 

160 @property 

161 def char_begin(self): 

162 """Gets the char_begin of this TextExtraction. # noqa: E501 

163 

164 Character coordinate within a text block where span begins # noqa: E501 

165 

166 :return: The char_begin of this TextExtraction. # noqa: E501 

167 :rtype: int 

168 """ 

169 return self._char_begin 

170 

171 @char_begin.setter 

172 def char_begin(self, char_begin): 

173 """Sets the char_begin of this TextExtraction. 

174 

175 Character coordinate within a text block where span begins # noqa: E501 

176 

177 :param char_begin: The char_begin of this TextExtraction. # noqa: E501 

178 :type: int 

179 """ 

180 

181 self._char_begin = char_begin 

182 

183 @property 

184 def char_end(self): 

185 """Gets the char_end of this TextExtraction. # noqa: E501 

186 

187 Character coordinate within a text block where span ends # noqa: E501 

188 

189 :return: The char_end of this TextExtraction. # noqa: E501 

190 :rtype: int 

191 """ 

192 return self._char_end 

193 

194 @char_end.setter 

195 def char_end(self, char_end): 

196 """Sets the char_end of this TextExtraction. 

197 

198 Character coordinate within a text block where span ends # noqa: E501 

199 

200 :param char_end: The char_end of this TextExtraction. # noqa: E501 

201 :type: int 

202 """ 

203 

204 self._char_end = char_end 

205 

206 def to_dict(self): 

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

208 result = {} 

209 

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

211 value = getattr(self, attr) 

212 if isinstance(value, list): 

213 result[attr] = list(map( 

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

215 value 

216 )) 

217 elif hasattr(value, "to_dict"): 

218 result[attr] = value.to_dict() 

219 elif isinstance(value, dict): 

220 result[attr] = dict(map( 

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

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

223 value.items() 

224 )) 

225 else: 

226 result[attr] = value 

227 if issubclass(TextExtraction, dict): 

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

229 result[key] = value 

230 

231 return result 

232 

233 def to_str(self): 

234 """Returns the string representation of the model""" 

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

236 

237 def __repr__(self): 

238 """For `print` and `pprint`""" 

239 return self.to_str() 

240 

241 def __eq__(self, other): 

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

243 if not isinstance(other, TextExtraction): 

244 return False 

245 

246 return self.__dict__ == other.__dict__ 

247 

248 def __ne__(self, other): 

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

250 return not self == other