From f3a751b3953032a8eb73af96a725cef902bde020 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Aug 2022 17:34:07 +0200 Subject: mypy: Type some more things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets us pass under mypy 0.971, and is yet another step towards mypyc compatibility perhaps. --- poezio/core/handlers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'poezio/core/handlers.py') diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index a75ecc52..e92e4aac 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -1180,25 +1180,26 @@ class HandlerCore: We are sending a new stanza, write it in the xml buffer if needed. """ if self.core.xml_tab: + stanza_str = str(stanza) if PYGMENTS: - xhtml_text = highlight(str(stanza), LEXER, FORMATTER) + xhtml_text = highlight(stanza_str, LEXER, FORMATTER) poezio_colored = xhtml.xhtml_to_poezio_colors( xhtml_text, force=True).rstrip('\x19o').strip() else: - poezio_colored = str(stanza) + poezio_colored = stanza_str self.core.xml_buffer.add_message( XMLLog(txt=poezio_colored, incoming=False), ) try: if self.core.xml_tab.match_stanza( - ElementBase(ET.fromstring(stanza))): + ElementBase(ET.fromstring(stanza_str))): self.core.xml_tab.filtered_buffer.add_message( XMLLog(txt=poezio_colored, incoming=False), ) except: # Most of the time what gets logged is whitespace pings. Skip. # And also skip tab updates. - if stanza.strip() == '': + if stanza_str.strip() == '': return None log.debug('', exc_info=True) -- cgit v1.2.3