diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-02-27 10:15:02 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-02-27 10:15:02 +0100 |
commit | 2f9cdc98cc0adea615cb2180481c7780eef48f97 (patch) | |
tree | ff710ad0913ced7c241f0445e95e6eefeb24ae1b /serializer.py | |
parent | acc0b296466c5364569b1df8402d2cb95ca01915 (diff) | |
download | ruamel.yaml-2f9cdc98cc0adea615cb2180481c7780eef48f97.tar.gz |
pep8 compliance, util.load_yaml_guess_indent0.11.2
Diffstat (limited to 'serializer.py')
-rw-r--r-- | serializer.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/serializer.py b/serializer.py index b461ca6..317cf4e 100644 --- a/serializer.py +++ b/serializer.py @@ -1,6 +1,6 @@ -from __future__ import absolute_import +# coding: utf-8 -__all__ = ['Serializer', 'SerializerError'] +from __future__ import absolute_import import re @@ -15,6 +15,8 @@ except (ImportError, ValueError): # for Jython from ruamel.yaml.nodes import * # NOQA from ruamel.yaml.compat import nprint, DBG_NODE, dbg +__all__ = ['Serializer', 'SerializerError'] + class SerializerError(YAMLError): pass @@ -114,17 +116,13 @@ class Serializer(object): self.serialized_nodes[node] = True self.descend_resolver(parent, index) if isinstance(node, ScalarNode): - detected_tag = self.resolve(ScalarNode, node.value, - (True, False)) - default_tag = self.resolve(ScalarNode, node.value, - (False, True)) - implicit = \ - (node.tag == detected_tag), (node.tag == default_tag) + detected_tag = self.resolve(ScalarNode, node.value, (True, False)) + default_tag = self.resolve(ScalarNode, node.value, (False, True)) + implicit = (node.tag == detected_tag), (node.tag == default_tag) self.emit(ScalarEvent(alias, node.tag, implicit, node.value, style=node.style, comment=node.comment)) elif isinstance(node, SequenceNode): - implicit = (node.tag - == self.resolve(SequenceNode, node.value, True)) + implicit = (node.tag == self.resolve(SequenceNode, node.value, True)) comment = node.comment # print('comment >>>>>>>>>>>>>.', comment, node.flow_style) end_comment = None @@ -146,8 +144,7 @@ class Serializer(object): index += 1 self.emit(SequenceEndEvent(comment=[seq_comment, end_comment])) elif isinstance(node, MappingNode): - implicit = (node.tag - == self.resolve(MappingNode, node.value, True)) + implicit = (node.tag == self.resolve(MappingNode, node.value, True)) comment = node.comment end_comment = None map_comment = None |