Function get_single_node

Synopsis

def get_single_node(self)

Description

No description yet.

Source

Lines 29-49 in lib3/yaml/composer.py.

def get_single_node(self):
    # Drop the STREAM-START event.
    self.get_event()
    # Compose a document if the stream is not empty.
    document = None
    if not self.check_event(StreamEndEvent):
        document = self.compose_document()
    # Ensure that the stream contains no more documents.
    if not self.check_event(StreamEndEvent):
        event = self.get_event()
        raise ComposerError("expected a single document in the stream",
                document.start_mark, "but found another document",
                event.start_mark)
    # Drop the STREAM-END event.
    self.get_event()
    return document





Add Discussion as Guest

Log in