From dce10fcff1de54121fb8b440b883ef5d3fe2f96a Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Fri, 3 Aug 2018 22:14:57 +0200 Subject: Apply oitnb and mypy 0.620, then make everything work again --- nodes.py | 64 ++++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 24 deletions(-) (limited to 'nodes.py') 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 -- cgit v1.2.1