From b12c7cd9bb7b0de05d65a1bd60bcf44fc4969c76 Mon Sep 17 00:00:00 2001 From: Kashiko Koibumi Date: Wed, 22 May 2024 10:08:47 +0900 Subject: [PATCH] replace remained arg() with format() --- src/bitmessageqt/dialogs.py | 4 ++-- src/namecoin.py | 18 +++++++++--------- src/network/tcp.py | 4 ++-- src/upnp.py | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bitmessageqt/dialogs.py b/src/bitmessageqt/dialogs.py index 9cea3fd8..fd4d8ede 100644 --- a/src/bitmessageqt/dialogs.py +++ b/src/bitmessageqt/dialogs.py @@ -64,8 +64,8 @@ class IconGlossaryDialog(QtWidgets.QDialog): self.labelPortNumber.setText(_translate( "iconGlossaryDialog", - "You are using TCP port %1. (This can be changed in the settings)." - ).arg(config.getint('bitmessagesettings', 'port'))) + "You are using TCP port {0}. (This can be changed in the settings)." + ).format(config.getint('bitmessagesettings', 'port'))) self.setFixedSize(QtWidgets.QWidget.sizeHint(self)) diff --git a/src/namecoin.py b/src/namecoin.py index c7307cb0..4996c92d 100644 --- a/src/namecoin.py +++ b/src/namecoin.py @@ -96,8 +96,8 @@ class namecoinConnection(object): res = res["reply"] if not res: return (_translate( - "MainWindow", "The name %1 was not found." - ).arg(identity.decode("utf-8", "ignore")), None) + "MainWindow", "The name {0} was not found." + ).format(identity.decode("utf-8", "ignore")), None) else: assert False except RPCError as exc: @@ -107,12 +107,12 @@ class namecoinConnection(object): else: errmsg = exc.error return (_translate( - "MainWindow", "The namecoin query failed (%1)" - ).arg(errmsg.decode("utf-8", "ignore")), None) + "MainWindow", "The namecoin query failed ({0})" + ).format(errmsg.decode("utf-8", "ignore")), None) except AssertionError: return (_translate( - "MainWindow", "Unknown namecoin interface type: %1" - ).arg(self.nmctype.decode("utf-8", "ignore")), None) + "MainWindow", "Unknown namecoin interface type: {0}" + ).format(self.nmctype.decode("utf-8", "ignore")), None) except Exception: logger.exception("Namecoin query exception") return (_translate( @@ -135,8 +135,8 @@ class namecoinConnection(object): ) if valid else ( _translate( "MainWindow", - "The name %1 has no associated Bitmessage address." - ).arg(identity.decode("utf-8", "ignore")), None) + "The name {0} has no associated Bitmessage address." + ).format(identity.decode("utf-8", "ignore")), None) def test(self): """ @@ -164,7 +164,7 @@ class namecoinConnection(object): "success", _translate( "MainWindow", - "Success! Namecoind version %1 running.").arg( + "Success! Namecoind version {0} running.").format( versStr.decode("utf-8", "ignore"))) elif self.nmctype == "nmcontrol": diff --git a/src/network/tcp.py b/src/network/tcp.py index a49804a6..dc10c41f 100644 --- a/src/network/tcp.py +++ b/src/network/tcp.py @@ -138,9 +138,9 @@ class TCPConnection(BMProto, TLSDispatcher): 'updateStatusBar', _translate( "MainWindow", - "The time on your computer, %1, may be wrong. " + "The time on your computer, {0}, may be wrong. " "Please verify your settings." - ).arg(l10n.formatTimestamp()))) + ).format(l10n.formatTimestamp()))) def state_connection_fully_established(self): """ diff --git a/src/upnp.py b/src/upnp.py index 4168b38d..f2172bb2 100644 --- a/src/upnp.py +++ b/src/upnp.py @@ -269,8 +269,8 @@ class uPnPThread(StoppableThread): knownnodes.addKnownNode( 1, self_peer, is_self=True) queues.UISignalQueue.put(('updateStatusBar', tr._translate( - "MainWindow", 'UPnP port mapping established on port %1' - ).arg(str(self.extPort)))) + "MainWindow", 'UPnP port mapping established on port {0}' + ).format(self.extPort))) break except socket.timeout: pass