diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2022-08-21 17:34:07 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2022-08-21 20:57:26 +0200 |
commit | f3a751b3953032a8eb73af96a725cef902bde020 (patch) | |
tree | 7eb9173caaec479ab124be24ed605814ae5d23b0 /poezio/core/handlers.py | |
parent | 940f5e0c8a695048e6b7dfd3dd13e49e0c3476a5 (diff) | |
download | poezio-f3a751b3953032a8eb73af96a725cef902bde020.tar.gz poezio-f3a751b3953032a8eb73af96a725cef902bde020.tar.bz2 poezio-f3a751b3953032a8eb73af96a725cef902bde020.tar.xz poezio-f3a751b3953032a8eb73af96a725cef902bde020.zip |
mypy: Type some more things
This lets us pass under mypy 0.971, and is yet another step towards
mypyc compatibility perhaps.
Diffstat (limited to 'poezio/core/handlers.py')
-rw-r--r-- | poezio/core/handlers.py | 9 |
1 files changed, 5 insertions, 4 deletions
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) |