Updated code quality ignored bare except warnings & replaced unicode by decode function changes in namecoin.py

Replaced unicode by decode function
This commit is contained in:
kuldeep.k@cisinlabs.com 2021-08-25 20:08:46 +05:30
parent 4a2222aacd
commit 4148daa8a4
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A

View File

@ -94,7 +94,7 @@ class namecoinConnection(object):
if not res: if not res:
return (tr._translate( return (tr._translate(
"MainWindow", 'The name %1 was not found.' "MainWindow", 'The name %1 was not found.'
).arg(unicode(string)), None) ).arg(string.decode('utf-8')), None)
else: else:
assert False assert False
except RPCError as exc: except RPCError as exc:
@ -105,11 +105,11 @@ class namecoinConnection(object):
errmsg = exc.error errmsg = exc.error
return (tr._translate( return (tr._translate(
"MainWindow", 'The namecoin query failed (%1)' "MainWindow", 'The namecoin query failed (%1)'
).arg(unicode(errmsg)), None) ).arg(errmsg.decode('utf-8')), None)
except AssertionError: except AssertionError:
return (tr._translate( return (tr._translate(
"MainWindow", 'Unknown namecoin interface type: %1' "MainWindow", 'Unknown namecoin interface type: %1'
).arg(unicode(self.nmctype)), None) ).arg(self.nmctype.decode('utf-8')), None)
except Exception: except Exception:
logger.exception("Namecoin query exception") logger.exception("Namecoin query exception")
return (tr._translate( return (tr._translate(
@ -133,7 +133,7 @@ class namecoinConnection(object):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
'The name %1 has no associated Bitmessage address.' 'The name %1 has no associated Bitmessage address.'
).arg(unicode(string)), None) ).arg(string.decode('utf-8')), None)
def test(self): def test(self):
""" """
@ -162,7 +162,7 @@ class namecoinConnection(object):
tr._translate( tr._translate(
"MainWindow", "MainWindow",
'Success! Namecoind version %1 running.').arg( 'Success! Namecoind version %1 running.').arg(
unicode(versStr))) versStr.decode('utf-8')))
elif self.nmctype == "nmcontrol": elif self.nmctype == "nmcontrol":
res = self.callRPC("data", ["status"]) res = self.callRPC("data", ["status"])
@ -235,9 +235,9 @@ class namecoinConnection(object):
result = resp.read() result = resp.read()
if resp.status != 200: if resp.status != 200:
raise Exception("Namecoin returned status %i: %s" % (resp.status, resp.reason)) raise Exception("Namecoin returned status %i: %s" % (resp.status, resp.reason))
except: except: # noqa:E722
logger.info("HTTP receive error") logger.info("HTTP receive error")
except: except: # noqa:E722
logger.info("HTTP connection error") logger.info("HTTP connection error")
return result return result