MCPcopy Create free account
hub / github.com/ablab/spades / process_directives

Method process_directives

ext/src/python_libs/pyyaml3/parser.py:217–246  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

215 return self.parse_block_node()
216
217 def process_directives(self):
218 self.yaml_version = None
219 self.tag_handles = {}
220 while self.check_token(DirectiveToken):
221 token = self.get_token()
222 if token.name == 'YAML':
223 if self.yaml_version is not None:
224 raise ParserError(None, None,
225 "found duplicate YAML directive", token.start_mark)
226 major, minor = token.value
227 if major != 1:
228 raise ParserError(None, None,
229 "found incompatible YAML document (version 1.* is required)",
230 token.start_mark)
231 self.yaml_version = token.value
232 elif token.name == 'TAG':
233 handle, prefix = token.value
234 if handle in self.tag_handles:
235 raise ParserError(None, None,
236 "duplicate tag handle %r" % handle,
237 token.start_mark)
238 self.tag_handles[handle] = prefix
239 if self.tag_handles:
240 value = self.yaml_version, self.tag_handles.copy()
241 else:
242 value = self.yaml_version, None
243 for key in self.DEFAULT_TAGS:
244 if key not in self.tag_handles:
245 self.tag_handles[key] = self.DEFAULT_TAGS[key]
246 return value
247
248 # block_node_or_indentless_sequence ::= ALIAS
249 # | properties (block_content | indentless_block_sequence)?

Callers 1

parse_document_startMethod · 0.95

Calls 4

ParserErrorClass · 0.85
check_tokenMethod · 0.80
get_tokenMethod · 0.80
copyMethod · 0.80

Tested by

no test coverage detected