summaryrefslogtreecommitdiff
path: root/nodes.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-08-18 09:47:28 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-08-18 09:47:28 +0200
commitba6beb48c620f861fcc120e272bf4b6798aff919 (patch)
treeac02a25c3745ea967fa61b4b2d02dad4c0cc9874 /nodes.py
parentdeeb75a3efb4a7ae0ab4b28c8b081d41329865f3 (diff)
downloadruamel.yaml-ba6beb48c620f861fcc120e272bf4b6798aff919.tar.gz
updates for mypy and remove print statements
Diffstat (limited to 'nodes.py')
-rw-r--r--nodes.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/nodes.py b/nodes.py
index df90be7..0c39abd 100644
--- a/nodes.py
+++ b/nodes.py
@@ -2,6 +2,7 @@
from __future__ import print_function
+import sys
from .compat import string_types
if False: # MYPY
@@ -41,17 +42,18 @@ class Node(object):
def dump(self, indent=0):
# type: (int) -> None
if isinstance(self.value, string_types):
- print(
- '{}{}(tag={!r}, value={!r})'.format(
+ sys.stdout.write(
+ '{}{}(tag={!r}, value={!r})\n'.format(
' ' * indent, self.__class__.__name__, self.tag, self.value
)
)
if self.comment:
- print(' {}comment: {})'.format(' ' * indent, self.comment))
+ sys.stdout.write(' {}comment: {})\n'.format(' ' * indent, self.comment))
return
- print('{}{}(tag={!r})'.format(' ' * indent, self.__class__.__name__, self.tag))
+ sys.stdout.write(
+ '{}{}(tag={!r})\n'.format(' ' * indent, self.__class__.__name__, self.tag))
if self.comment:
- print(' {}comment: {})'.format(' ' * indent, self.comment))
+ sys.stdout.write(' {}comment: {})\n'.format(' ' * indent, self.comment))
for v in self.value:
if isinstance(v, tuple):
for v1 in v:
@@ -59,7 +61,7 @@ class Node(object):
elif isinstance(v, Node):
v.dump(indent + 1)
else:
- print('Node value type?', type(v))
+ sys.stdout.write('Node value type? {}\n'.format(type(v)))
class ScalarNode(Node):