summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-07-12 12:13:34 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-07-12 12:13:34 +0200
commit2ea4de43fe2e0160e27b605f2c65f33c5a2083d7 (patch)
treeddd268394e9fa05011585fd326cb4f635f0510a1 /emitter.py
parentae5b5638efc9f20c027aac28f52dbfe0fc955998 (diff)
downloadruamel.yaml-2ea4de43fe2e0160e27b605f2c65f33c5a2083d7.tar.gz
update to flake8==3.3.0 with --ignore F405
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py75
1 files changed, 37 insertions, 38 deletions
diff --git a/emitter.py b/emitter.py
index e9388bc..617d439 100644
--- a/emitter.py
+++ b/emitter.py
@@ -118,7 +118,7 @@ class Emitter(object):
# 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:
+ if width and width > self.best_indent * 2:
self.best_width = width
self.best_line_break = u'\n' # type: Any
if line_break in [u'\r', u'\n', u'\r\n']:
@@ -196,7 +196,7 @@ class Emitter(object):
level = -1
if level < 0:
return False
- return (len(self.events) < count+1)
+ return (len(self.events) < count + 1)
def increase_indent(self, flow=False, sequence=None, indentless=False):
# type: (bool, bool, bool) -> None
@@ -606,7 +606,7 @@ class Emitter(object):
if self.prepared_anchor is None:
self.prepared_anchor = self.prepare_anchor(self.event.anchor)
if self.prepared_anchor:
- self.write_indicator(indicator+self.prepared_anchor, True)
+ self.write_indicator(indicator + self.prepared_anchor, True)
self.prepared_anchor = None
def process_tag(self):
@@ -732,7 +732,7 @@ class Emitter(object):
else:
if start < end:
chunks.append(prefix[start:end])
- start = end = end+1
+ start = end = end + 1
data = utf8(ch)
for ch in data:
chunks.append(u'%%%02X' % ord(ch))
@@ -765,7 +765,7 @@ class Emitter(object):
else:
if start < end:
chunks.append(suffix[start:end])
- start = end = end+1
+ start = end = end + 1
data = utf8(ch)
for ch in data:
chunks.append(u'%%%02X' % ord(ch))
@@ -876,7 +876,7 @@ class Emitter(object):
if ch == u' ':
if index == 0:
leading_space = True
- if index == len(scalar)-1:
+ if index == len(scalar) - 1:
trailing_space = True
if previous_break:
break_space = True
@@ -885,7 +885,7 @@ class Emitter(object):
elif ch in u'\n\x85\u2028\u2029':
if index == 0:
leading_break = True
- if index == len(scalar)-1:
+ if index == len(scalar) - 1:
trailing_break = True
if previous_space:
space_break = True
@@ -899,8 +899,8 @@ class Emitter(object):
index += 1
preceeded_by_whitespace = (ch in u'\0 \t\r\n\x85\u2028\u2029')
followed_by_whitespace = (
- index+1 >= len(scalar) or
- scalar[index+1] in u'\0 \t\r\n\x85\u2028\u2029')
+ index + 1 >= len(scalar) or
+ scalar[index + 1] in u'\0 \t\r\n\x85\u2028\u2029')
# Let's decide what styles are allowed.
allow_flow_plain = True
@@ -975,7 +975,7 @@ class Emitter(object):
if self.whitespace or not need_whitespace:
data = indicator
else:
- data = u' '+indicator
+ data = u' ' + indicator
self.whitespace = whitespace
self.indention = self.indention and indention
self.column += len(data)
@@ -995,7 +995,7 @@ class Emitter(object):
self.write_line_break()
if self.column < indent:
self.whitespace = True
- data = u' '*(indent-self.column)
+ data = u' ' * (indent - self.column)
self.column = indent
if self.encoding:
data = data.encode(self.encoding)
@@ -1048,7 +1048,7 @@ class Emitter(object):
ch = text[end]
if spaces:
if ch is None or ch != u' ':
- if start+1 == end and self.column > self.best_width and split \
+ if start + 1 == end and self.column > self.best_width and split \
and start != 0 and end != len(text):
self.write_indent()
else:
@@ -1092,21 +1092,21 @@ class Emitter(object):
self.write_indicator(u'\'', False)
ESCAPE_REPLACEMENTS = {
- u'\0': u'0',
- u'\x07': u'a',
- u'\x08': u'b',
- u'\x09': u't',
- u'\x0A': u'n',
- u'\x0B': u'v',
- u'\x0C': u'f',
- u'\x0D': u'r',
- u'\x1B': u'e',
- u'\"': u'\"',
- u'\\': u'\\',
- u'\x85': u'N',
- u'\xA0': u'_',
- u'\u2028': u'L',
- u'\u2029': u'P',
+ u'\0': u'0',
+ u'\x07': u'a',
+ u'\x08': u'b',
+ u'\x09': u't',
+ u'\x0A': u'n',
+ u'\x0B': u'v',
+ u'\x0C': u'f',
+ u'\x0D': u'r',
+ u'\x1B': u'e',
+ u'\"': u'\"',
+ u'\\': u'\\',
+ u'\x85': u'N',
+ u'\xA0': u'_',
+ u'\u2028': u'L',
+ u'\u2029': u'P',
}
def write_double_quoted(self, text, split=True):
@@ -1135,7 +1135,7 @@ class Emitter(object):
start = end
if ch is not None:
if ch in self.ESCAPE_REPLACEMENTS:
- data = u'\\'+self.ESCAPE_REPLACEMENTS[ch]
+ data = u'\\' + self.ESCAPE_REPLACEMENTS[ch]
elif ch <= u'\xFF':
data = u'\\x%02X' % ord(ch)
elif ch <= u'\uFFFF':
@@ -1146,10 +1146,10 @@ class Emitter(object):
if bool(self.encoding):
data = data.encode(self.encoding)
self.stream.write(data)
- start = end+1
- if 0 < end < len(text)-1 and (ch == u' ' or start >= end) \
- and self.column+(end-start) > self.best_width and split:
- data = text[start:end]+u'\\'
+ start = end + 1
+ if 0 < end < len(text) - 1 and (ch == u' ' or start >= end) \
+ and self.column + (end - start) > self.best_width and split:
+ data = text[start:end] + u'\\'
if start < end:
start = end
self.column += len(data)
@@ -1183,7 +1183,7 @@ class Emitter(object):
def write_folded(self, text):
# type: (Any) -> None
hints = self.determine_block_hints(text)
- self.write_indicator(u'>'+hints, True)
+ self.write_indicator(u'>' + hints, True)
if hints[-1:] == u'+':
self.open_ended = True
self.write_line_break()
@@ -1211,7 +1211,7 @@ class Emitter(object):
start = end
elif spaces:
if ch != u' ':
- if start+1 == end and self.column > self.best_width:
+ if start + 1 == end and self.column > self.best_width:
self.write_indent()
else:
data = text[start:end]
@@ -1238,7 +1238,7 @@ class Emitter(object):
def write_literal(self, text):
# type: (Any) -> None
hints = self.determine_block_hints(text)
- self.write_indicator(u'|'+hints, True)
+ self.write_indicator(u'|' + hints, True)
if hints[-1:] == u'+':
self.open_ended = True
self.write_line_break()
@@ -1299,8 +1299,7 @@ class Emitter(object):
ch = text[end]
if spaces:
if ch != u' ':
- if start+1 == end and self.column > self.best_width \
- and split:
+ if start + 1 == end and self.column > self.best_width and split:
self.write_indent()
self.whitespace = False
self.indention = False
@@ -1384,7 +1383,7 @@ class Emitter(object):
if isinstance(event, MappingStartEvent):
comment.pre_done = True
except TypeError:
- print ('eventtt', type(event), event)
+ print('eventtt', type(event), event)
raise
def write_post_comment(self, event):