osbuild-mpp: ConstructorError was undefined
ConstructorError is part of the yaml.constructor module.
This commit is contained in:
parent
03af8c632a
commit
76c1b5cf25
1 changed files with 5 additions and 5 deletions
|
|
@ -281,15 +281,15 @@ from osbuild.util.rhsm import Subscriptions
|
|||
class YamlOrderedLoader(yaml.Loader):
|
||||
def construct_mapping(self, node, deep=False):
|
||||
if not isinstance(node, yaml.MappingNode):
|
||||
raise ConstructorError(None, None,
|
||||
"expected a mapping node, but found %s" % node.id,
|
||||
node.start_mark)
|
||||
raise yaml.constructor.ConstructorError(None, None,
|
||||
"expected a mapping node, but found %s" % node.id,
|
||||
node.start_mark)
|
||||
mapping = collections.OrderedDict()
|
||||
for key_node, value_node in node.value:
|
||||
key = self.construct_object(key_node, deep=deep)
|
||||
if not isinstance(key, collections.abc.Hashable):
|
||||
raise ConstructorError("while constructing a mapping", node.start_mark,
|
||||
"found unhashable key", key_node.start_mark)
|
||||
raise yaml.constructor.ConstructorError("while constructing a mapping", node.start_mark,
|
||||
"found unhashable key", key_node.start_mark)
|
||||
value = self.construct_object(value_node, deep=deep)
|
||||
mapping[key] = value
|
||||
return mapping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue