summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-06-07 11:46:23 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-06-07 11:46:23 +0200
commit90583069b7efd3744e46ba65499d7090e09d70c3 (patch)
treef8ab1d58fd1492d9c8a4510dadf78b6fbbc0117a /emitter.py
parent0cd057811100327978829dcef723d11e78c8efc2 (diff)
downloadruamel.yaml-90583069b7efd3744e46ba65499d7090e09d70c3.tar.gz
fix issue # 123: type annotations0.15.2
mypy needed updating from 0.501 to 0.511, with may different warnings/errors then before
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/emitter.py b/emitter.py
index 70407bd..f2a4ad3 100644
--- a/emitter.py
+++ b/emitter.py
@@ -106,17 +106,17 @@ class Emitter(object):
# Formatting details.
self.canonical = canonical
self.allow_unicode = allow_unicode
- self.block_seq_indent = block_seq_indent if block_seq_indent else 0 # type: ignore
+ self.block_seq_indent = block_seq_indent if block_seq_indent else 0
self.top_level_colon_align = top_level_colon_align
self.best_indent = 2
- if indent and 1 < indent < 10: # type: ignore
+ if indent and 1 < indent < 10:
self.best_indent = indent
# if self.best_indent < self.block_seq_indent + 1:
# self.best_indent = self.block_seq_indent + 1
self.best_width = 80
- if width and width > self.best_indent*2: # type: ignore
+ if width and width > self.best_indent*2:
self.best_width = width
- self.best_line_break = u'\n'
+ self.best_line_break = u'\n' # type: Any
if line_break in [u'\r', u'\n', u'\r\n']:
self.best_line_break = line_break
@@ -953,7 +953,7 @@ class Emitter(object):
def write_stream_start(self):
# type: () -> None
# Write BOM if needed.
- if self.encoding and self.encoding.startswith('utf-16'): # type: ignore
+ if self.encoding and self.encoding.startswith('utf-16'):
self.stream.write(u'\uFEFF'.encode(self.encoding))
def write_stream_end(self):
@@ -988,7 +988,7 @@ class Emitter(object):
self.whitespace = True
data = u' '*(indent-self.column)
self.column = indent
- if self.encoding: # type: ignore
+ if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
@@ -1007,7 +1007,7 @@ class Emitter(object):
def write_version_directive(self, version_text):
# type: (Any) -> None
data = u'%%YAML %s' % version_text
- if self.encoding: # type: ignore
+ if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
self.write_line_break()
@@ -1015,7 +1015,7 @@ class Emitter(object):
def write_tag_directive(self, handle_text, prefix_text):
# type: (Any, Any) -> None
data = u'%%TAG %s %s' % (handle_text, prefix_text)
- if self.encoding: # type: ignore
+ if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
self.write_line_break()
@@ -1261,7 +1261,7 @@ class Emitter(object):
if not self.whitespace:
data = u' '
self.column += len(data)
- if self.encoding: # type: ignore
+ if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
self.whitespace = False
@@ -1283,7 +1283,7 @@ class Emitter(object):
else:
data = text[start:end]
self.column += len(data)
- if self.encoding: # type: ignore
+ if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
start = end
@@ -1304,7 +1304,7 @@ class Emitter(object):
if ch is None or ch in u' \n\x85\u2028\u2029':
data = text[start:end]
self.column += len(data)
- if self.encoding: # type: ignore
+ if self.encoding:
data = data.encode(self.encoding)
self.stream.write(data)
start = end