summaryrefslogtreecommitdiff
path: root/nodes.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-08-03 22:14:57 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-08-03 22:14:57 +0200
commitdce10fcff1de54121fb8b440b883ef5d3fe2f96a (patch)
tree072b4bd247e6f1cd95c08c7b67fea0fc96f0578e /nodes.py
parent2966a4f215861fa05e0dc7e0cd53350766e794c6 (diff)
downloadruamel.yaml-dce10fcff1de54121fb8b440b883ef5d3fe2f96a.tar.gz
Apply oitnb and mypy 0.620, then make everything work again0.15.48
Diffstat (limited to 'nodes.py')
-rw-r--r--nodes.py64
1 files changed, 40 insertions, 24 deletions
diff --git a/nodes.py b/nodes.py
index 781df94..df90be7 100644
--- a/nodes.py
+++ b/nodes.py
@@ -5,11 +5,11 @@ from __future__ import print_function
from .compat import string_types
if False: # MYPY
- from typing import Dict, Any, Text # NOQA
+ from typing import Dict, Any, Text # NOQA
class Node(object):
- __slots__ = 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor',
+ __slots__ = 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor'
def __init__(self, tag, value, start_mark, end_mark, comment=None):
# type: (Any, Any, Any, Any, Any) -> None
@@ -36,23 +36,22 @@ class Node(object):
# else:
# value = repr(value)
value = repr(value)
- return '%s(tag=%r, value=%s)' % (self.__class__.__name__,
- self.tag, value)
+ return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value)
def dump(self, indent=0):
# type: (int) -> None
if isinstance(self.value, string_types):
- print('{}{}(tag={!r}, value={!r})'.format(
- ' ' * indent, self.__class__.__name__, self.tag, self.value))
+ print(
+ '{}{}(tag={!r}, value={!r})'.format(
+ ' ' * indent, self.__class__.__name__, self.tag, self.value
+ )
+ )
if self.comment:
- print(' {}comment: {})'.format(
- ' ' * indent, self.comment))
+ print(' {}comment: {})'.format(' ' * indent, self.comment))
return
- print('{}{}(tag={!r})'.format(
- ' ' * indent, self.__class__.__name__, self.tag))
+ print('{}{}(tag={!r})'.format(' ' * indent, self.__class__.__name__, self.tag))
if self.comment:
- print(' {}comment: {})'.format(
- ' ' * indent, self.comment))
+ print(' {}comment: {})'.format(' ' * indent, self.comment))
for v in self.value:
if isinstance(v, tuple):
for v1 in v:
@@ -72,21 +71,29 @@ class ScalarNode(Node):
| -> literal style
> -> folding style
"""
- __slots__ = 'style',
+
+ __slots__ = ('style',)
id = 'scalar'
- def __init__(self, tag, value, start_mark=None, end_mark=None, style=None,
- comment=None):
+ def __init__(self, tag, value, start_mark=None, end_mark=None, style=None, comment=None):
# type: (Any, Any, Any, Any, Any, Any) -> None
Node.__init__(self, tag, value, start_mark, end_mark, comment=comment)
self.style = style
class CollectionNode(Node):
- __slots__ = 'flow_style', 'anchor',
-
- def __init__(self, tag, value, start_mark=None, end_mark=None,
- flow_style=None, comment=None, anchor=None):
+ __slots__ = 'flow_style', 'anchor'
+
+ def __init__(
+ self,
+ tag,
+ value,
+ start_mark=None,
+ end_mark=None,
+ flow_style=None,
+ comment=None,
+ anchor=None,
+ ):
# type: (Any, Any, Any, Any, Any, Any, Any) -> None
Node.__init__(self, tag, value, start_mark, end_mark, comment=comment)
self.flow_style = flow_style
@@ -99,12 +106,21 @@ class SequenceNode(CollectionNode):
class MappingNode(CollectionNode):
- __slots__ = ('merge', )
+ __slots__ = ('merge',)
id = 'mapping'
- def __init__(self, tag, value, start_mark=None, end_mark=None,
- flow_style=None, comment=None, anchor=None):
+ def __init__(
+ self,
+ tag,
+ value,
+ start_mark=None,
+ end_mark=None,
+ flow_style=None,
+ comment=None,
+ anchor=None,
+ ):
# type: (Any, Any, Any, Any, Any, Any, Any) -> None
- CollectionNode.__init__(self, tag, value, start_mark, end_mark,
- flow_style, comment, anchor)
+ CollectionNode.__init__(
+ self, tag, value, start_mark, end_mark, flow_style, comment, anchor
+ )
self.merge = None