Пример #1
0
 def construct_mapping(self, node, deep=False):
     if not isinstance(node, yaml.nodes.MappingNode):
         raise ConstructorError(
             None, None, "expected a mapping node, but found %s" % node.id,
             node.start_mark)
     keys = set([])
     for key_node, value_node in node.value:
         key = self.construct_object(key_node, deep=deep)
         if key in keys:
             raise ConstructorError("while constructing a mapping",
                                    node.start_mark,
                                    "found duplicate key (%s)" % key,
                                    key_node.start_mark)
         keys.add(key)
     return SafeConstructor.construct_mapping(self, node, deep)
Пример #2
0
 def construct_mapping(self, node, deep=False):
     if not isinstance(node, yaml.nodes.MappingNode):
         raise ConstructorError(
             None, None,
             "expected a mapping node, but found %s" % node.id,
             node.start_mark)
     keys = set([])
     for key_node, value_node in node.value:
         key = self.construct_object(key_node, deep=deep)
         if key in keys:
             raise ConstructorError(
                 "while constructing a mapping", node.start_mark,
                 "found duplicate key (%s)" % key, key_node.start_mark)
         keys.add(key)
     return SafeConstructor.construct_mapping(self, node, deep)
 def construct_mapping(node, deep=False):
     mapping = SafeConstructor.construct_mapping(loader, node, deep=deep)
     mapping["__line__"] = LineTracker(filename, node.__line__)
     return mapping