From a5f5028c7d5623a13b392d8e9bdb9be622476f8c Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Tue, 16 Feb 2016 21:16:30 +0100 Subject: - make sure there is a space before # if scalar pushes (through indent) a comment from its original column - flake 8 --- serializer.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'serializer.py') diff --git a/serializer.py b/serializer.py index 125729e..b461ca6 100644 --- a/serializer.py +++ b/serializer.py @@ -6,17 +6,16 @@ import re try: from .error import YAMLError - from .events import * - from .nodes import * + from .events import * # NOQA + from .nodes import * # NOQA from .compat import nprint, DBG_NODE, dbg except (ImportError, ValueError): # for Jython from ruamel.yaml.error import YAMLError - from ruamel.yaml.events import * - from ruamel.yaml.nodes import * + from ruamel.yaml.events import * # NOQA + from ruamel.yaml.nodes import * # NOQA from ruamel.yaml.compat import nprint, DBG_NODE, dbg - class SerializerError(YAMLError): pass @@ -27,7 +26,6 @@ class Serializer(object): ANCHOR_TEMPLATE = u'id%03d' ANCHOR_RE = re.compile(u'id(?!000$)\\d{3,}') - def __init__(self, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None): self.use_encoding = encoding @@ -168,5 +166,6 @@ class Serializer(object): self.emit(MappingEndEvent(comment=[map_comment, end_comment])) self.ascend_resolver() + def templated_id(s): return Serializer.ANCHOR_RE.match(s) -- cgit v1.2.1