Beispiel #1
0
 def __init__(self, stream):
     Reader.__init__(self, stream)
     Scanner.__init__(self)
     Parser.__init__(self)
     MkdvYamlComposer.__init__(self)
     FullConstructor.__init__(self)
     Resolver.__init__(self)
Beispiel #2
0
    def construct_object(self, node, deep=False):
        ret = FullConstructor.construct_object(self, node, deep=deep)

        if hasattr(node, "__lineno__"):
            ret.lineno = node.__lineno__
            ret.linepos = node.__linepos__
        else:
            ret.lineno = -1
            ret.linepos = -11

        return ret
Beispiel #3
0
    def _from_yaml(cls, constructor: FullConstructor, node):
        """A low-level interface required by :mod:`pyyaml` load interface

        .. warning::
            This function should not be used directly, please use :meth:`load_config`.

        :param constructor: the class that will construct
        :param node: the node to traverse
        :return: the parser associated with the class
        """
        data = constructor.construct_mapping(node, deep=True)
        from .parsers import get_parser
        return get_parser(cls, version=data.get('version', None)).parse(cls, data)