Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.pyaml_transliterate(
'_-_'.join(map(op.attrgetter('value'), hint)) ) )
else:
self.anchors[node] = None
if isinstance(node, yaml.nodes.SequenceNode):
for item in node.value:
self.anchor_node(item)
elif isinstance(node, yaml.nodes.MappingNode):
for key, value in node.value:
self.anchor_node(key)
self.anchor_node(value, hint=hint+[key])
PrettyYAMLDumper.add_representer(dict, PrettyYAMLDumper.represent_dict)
PrettyYAMLDumper.add_representer(defaultdict, PrettyYAMLDumper.represent_dict)
PrettyYAMLDumper.add_representer(OrderedDict, PrettyYAMLDumper.represent_odict)
PrettyYAMLDumper.add_representer(set, PrettyYAMLDumper.represent_list)
PrettyYAMLDumper.add_representer(None, PrettyYAMLDumper.represent_undefined)
if sys.version_info.major >= 3:
try: import pathlib
except ImportError: pass
else:
PrettyYAMLDumper.add_representer(
type(pathlib.Path('')), lambda cls,o: cls.represent_data(str(o)) )
class UnsafePrettyYAMLDumper(PrettyYAMLDumper):
def expect_block_sequence(self):
self.increase_indent(flow=False, indentless=False)
self.state = self.expect_first_block_sequence_item