From d55cc5872503567775f0d7a7731d6f489bf2299b Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 12 Nov 2017 15:03:09 +0100 Subject: yapf -ir --- poezio/windows/funcs.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'poezio/windows/funcs.py') diff --git a/poezio/windows/funcs.py b/poezio/windows/funcs.py index ea2941c8..3648bac3 100644 --- a/poezio/windows/funcs.py +++ b/poezio/windows/funcs.py @@ -7,6 +7,7 @@ DIGITS = string.digits + '-' from poezio.windows.base_wins import FORMAT_CHAR, format_chars + def find_first_format_char(text, chars=None): if chars is None: chars = format_chars @@ -19,13 +20,15 @@ def find_first_format_char(text, chars=None): pos = p return pos + def truncate_nick(nick, size=10): if size < 1: size = 1 if nick and len(nick) > size: - return nick[:size]+'…' + return nick[:size] + '…' return nick + def parse_attrs(text, previous=None): next_attr_char = text.find(FORMAT_CHAR) if previous: @@ -34,7 +37,7 @@ def parse_attrs(text, previous=None): attrs = [] while next_attr_char != -1 and text: if next_attr_char + 1 < len(text): - attr_char = text[next_attr_char+1].lower() + attr_char = text[next_attr_char + 1].lower() else: attr_char = '\0' if attr_char == 'o': @@ -46,12 +49,11 @@ def parse_attrs(text, previous=None): elif attr_char == 'i': attrs.append('i') if attr_char in DIGITS and attr_char: - color_str = text[next_attr_char+1:text.find('}', next_attr_char)] + color_str = text[next_attr_char + 1:text.find('}', next_attr_char)] if color_str: attrs.append(color_str + '}') - text = text[next_attr_char+len(color_str)+2:] + text = text[next_attr_char + len(color_str) + 2:] else: - text = text[next_attr_char+2:] + text = text[next_attr_char + 2:] next_attr_char = text.find(FORMAT_CHAR) return attrs - -- cgit v1.2.3