From ea2d76864da2448152428a62fe5c7daaea6ab0d3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 21 Jul 2018 17:09:52 +0200 Subject: yapf -rip --- poezio/xhtml.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'poezio/xhtml.py') diff --git a/poezio/xhtml.py b/poezio/xhtml.py index 29a87ca2..7de048ae 100644 --- a/poezio/xhtml.py +++ b/poezio/xhtml.py @@ -208,8 +208,7 @@ def get_body_from_message_stanza(message, xhtml_body = xhtml.find('{http://www.w3.org/1999/xhtml}body') if xhtml_body is None: return message['body'] - content = xhtml_to_poezio_colors( - xhtml_body, tmp_dir=extract_images_to) + content = xhtml_to_poezio_colors(xhtml_body, tmp_dir=extract_images_to) content = content if content else message['body'] return content or " " @@ -356,7 +355,8 @@ class XHTMLHandler(sax.ContentHandler): elif name == 'em': self.append_formatting('\x19i') elif name == 'img': - if re.match(xhtml_data_re, attrs['src']) and self.tmp_image_dir is not None: + if re.match(xhtml_data_re, + attrs['src']) and self.tmp_image_dir is not None: type_, data = [ i for i in re.split(xhtml_data_re, attrs['src']) if i ] @@ -441,8 +441,7 @@ def xhtml_to_poezio_colors(xml, force=False, tmp_dir=None): elif not isinstance(xml, bytes): xml = ET.tostring(xml) - handler = XHTMLHandler( - force_ns=force, tmp_image_dir=tmp_dir) + handler = XHTMLHandler(force_ns=force, tmp_image_dir=tmp_dir) parser = sax.make_parser() parser.setFeature(sax.handler.feature_namespaces, True) parser.setContentHandler(handler) @@ -561,8 +560,8 @@ def poezio_colors_to_html(string): check_property('font-style', 'italic') if attr_char in digits: - number_str = string[next_attr_char + 1:string.find( - '}', next_attr_char)] + number_str = string[next_attr_char + + 1:string.find('}', next_attr_char)] number = int(number_str) if number in number_to_color_names: check_property('color', -- cgit v1.2.3