From 7b3a116d7602a25dd71b16133be44a35cb3d7cf1 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 28 Jun 2018 14:49:54 +0200 Subject: Replace the '%s' % var pattern with str(var). --- poezio/connection.py | 2 +- poezio/core/commands.py | 2 +- poezio/core/core.py | 10 +++++----- poezio/core/handlers.py | 10 +++++----- poezio/windows/roster_win.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/poezio/connection.py b/poezio/connection.py index 69259690..8a74635d 100644 --- a/poezio/connection.py +++ b/poezio/connection.py @@ -43,7 +43,7 @@ class Connection(slixmpp.ClientXMPP): # many features will be handled differently # depending on this setting self.anon = False - jid = '%s' % config.get('jid') + jid = config.get('jid') password = config.get('password') eval_password = config.get('eval_password') if not password and not eval_password and not (keyfile diff --git a/poezio/core/commands.py b/poezio/core/commands.py index 8c7cbcd2..7d503fff 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -895,7 +895,7 @@ class CommandCore: def iqfunc(iq): "handler for an iq reply" - self.core.information('%s' % iq, 'Iq') + self.core.information(str(iq), 'Iq') self.core.xmpp.remove_handler('Iq %s' % iq_id) self.core.xmpp.register_handler( diff --git a/poezio/core/core.py b/poezio/core/core.py index 7c6ad886..b708e2cf 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -810,7 +810,7 @@ class Core(object): 'Could not execute command (%s)', repr(command), exc_info=True) - self.information('%s' % exc, 'Error') + self.information(str(exc), 'Error') def do_command(self, key, raw): """ @@ -1179,7 +1179,7 @@ class Core(object): def go_to_previous_tab(self): "Go to the previous tab" - self.command.win('%s' % (self.previous_tab_nb, )) + self.command.win(str(self.previous_tab_nb)) def go_to_important_room(self): """ @@ -1207,7 +1207,7 @@ class Core(object): if (tab.nb < self.current_tab_nb and tab_refs[state][-1].nb > self.current_tab_nb): continue - self.command.win('%s' % tab.nb) + self.command.win(str(tab.nb)) return return @@ -1216,7 +1216,7 @@ class Core(object): for tab in self.tabs: if tab.name == tab_name: if (type_ and (isinstance(tab, type_))) or not type_: - self.command.win('%s' % (tab.nb, )) + self.command.win(str(tab.nb)) return True return False @@ -1267,7 +1267,7 @@ class Core(object): # if the room exists, focus it and return for tab in self.get_tabs(tabs.PrivateTab): if tab.name == complete_jid: - self.command.win('%s' % tab.nb) + self.command.win(str(tab.nb)) return tab # create the new tab tab = self.get_tab_by_name(room_name, tabs.MucTab) diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 268c9733..d34534d0 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -1404,7 +1404,7 @@ class HandlerCore: """ When a data form is received """ - self.core.information('%s' % message) + self.core.information(str(message)) def on_attention(self, message): """ @@ -1430,11 +1430,11 @@ class HandlerCore: """ if self.core.xml_tab: if PYGMENTS: - xhtml_text = highlight('%s' % stanza, LEXER, FORMATTER) + xhtml_text = highlight(str(stanza), LEXER, FORMATTER) poezio_colored = xhtml.xhtml_to_poezio_colors( xhtml_text, force=True).rstrip('\x19o').strip() else: - poezio_colored = '%s' % stanza + poezio_colored = str(stanza) self.core.add_message_to_text_buffer( self.core.xml_buffer, poezio_colored, @@ -1459,11 +1459,11 @@ class HandlerCore: """ if self.core.xml_tab: if PYGMENTS: - xhtml_text = highlight('%s' % stanza, LEXER, FORMATTER) + xhtml_text = highlight(str(stanza), LEXER, FORMATTER) poezio_colored = xhtml.xhtml_to_poezio_colors( xhtml_text, force=True).rstrip('\x19o').strip() else: - poezio_colored = '%s' % stanza + poezio_colored = str(stanza) self.core.add_message_to_text_buffer( self.core.xml_buffer, poezio_colored, diff --git a/poezio/windows/roster_win.py b/poezio/windows/roster_win.py index 0906d1e9..36c41ae6 100644 --- a/poezio/windows/roster_win.py +++ b/poezio/windows/roster_win.py @@ -274,11 +274,11 @@ class RosterWin(Win): contact.subscription, keep=show_roster_sub)) if not show_roster_jids and contact.name: - display_name = '%s' % contact.name + display_name = contact.name elif contact.name and contact.name != contact.bare_jid: display_name = '%s (%s)' % (contact.name, contact.bare_jid) else: - display_name = '%s' % (contact.bare_jid, ) + display_name = contact.bare_jid display_name = self.truncate_name(display_name, added) + nb -- cgit v1.2.3