From 4148daa8a446917e26eb67f3e64976d12ca00b8d Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Wed, 25 Aug 2021 20:08:46 +0530 Subject: [PATCH] Updated code quality ignored bare except warnings & replaced unicode by decode function changes in namecoin.py Replaced unicode by decode function --- src/namecoin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/namecoin.py b/src/namecoin.py index c6afdb24..f3d4eaea 100644 --- a/src/namecoin.py +++ b/src/namecoin.py @@ -94,7 +94,7 @@ class namecoinConnection(object): if not res: return (tr._translate( "MainWindow", 'The name %1 was not found.' - ).arg(unicode(string)), None) + ).arg(string.decode('utf-8')), None) else: assert False except RPCError as exc: @@ -105,11 +105,11 @@ class namecoinConnection(object): errmsg = exc.error return (tr._translate( "MainWindow", 'The namecoin query failed (%1)' - ).arg(unicode(errmsg)), None) + ).arg(errmsg.decode('utf-8')), None) except AssertionError: return (tr._translate( "MainWindow", 'Unknown namecoin interface type: %1' - ).arg(unicode(self.nmctype)), None) + ).arg(self.nmctype.decode('utf-8')), None) except Exception: logger.exception("Namecoin query exception") return (tr._translate( @@ -133,7 +133,7 @@ class namecoinConnection(object): tr._translate( "MainWindow", 'The name %1 has no associated Bitmessage address.' - ).arg(unicode(string)), None) + ).arg(string.decode('utf-8')), None) def test(self): """ @@ -162,7 +162,7 @@ class namecoinConnection(object): tr._translate( "MainWindow", 'Success! Namecoind version %1 running.').arg( - unicode(versStr))) + versStr.decode('utf-8'))) elif self.nmctype == "nmcontrol": res = self.callRPC("data", ["status"]) @@ -235,9 +235,9 @@ class namecoinConnection(object): result = resp.read() if resp.status != 200: raise Exception("Namecoin returned status %i: %s" % (resp.status, resp.reason)) - except: + except: # noqa:E722 logger.info("HTTP receive error") - except: + except: # noqa:E722 logger.info("HTTP connection error") return result