Updated flake8 indentation changes & added return None to queryHTTP exceptions

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-09-08 19:41:23 +05:30
parent 2821f0f667
commit da7f5102d6
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A

View File

@ -53,15 +53,15 @@ class namecoinConnection(object):
""" """
if options is None: if options is None:
self.nmctype = BMConfigParser().get( self.nmctype = BMConfigParser().get(
configSection, "namecoinrpctype") configSection, "namecoinrpctype")
self.host = BMConfigParser().get( self.host = BMConfigParser().get(
configSection, "namecoinrpchost") configSection, "namecoinrpchost")
self.port = int(BMConfigParser().get( self.port = int(BMConfigParser().get(
configSection, "namecoinrpcport")) configSection, "namecoinrpcport"))
self.user = BMConfigParser().get( self.user = BMConfigParser().get(
configSection, "namecoinrpcuser") configSection, "namecoinrpcuser")
self.password = BMConfigParser().get( self.password = BMConfigParser().get(
configSection, "namecoinrpcpassword") configSection, "namecoinrpcpassword")
else: else:
self.nmctype = options["type"] self.nmctype = options["type"]
self.host = options["host"] self.host = options["host"]
@ -176,8 +176,8 @@ class namecoinConnection(object):
_translate( _translate(
"MainWindow", "MainWindow",
"Success! NMControll is up and running." "Success! NMControll is up and running."
)
) )
)
logger.error("Unexpected nmcontrol reply: %s", res) logger.error("Unexpected nmcontrol reply: %s", res)
message = ( message = (
@ -185,8 +185,8 @@ class namecoinConnection(object):
_translate( _translate(
"MainWindow", "MainWindow",
"Couldn\'t understand NMControl." "Couldn\'t understand NMControl."
)
) )
)
else: else:
sys.exit("Unsupported Namecoin type") sys.exit("Unsupported Namecoin type")
@ -247,6 +247,7 @@ class namecoinConnection(object):
self.con.send(data) self.con.send(data)
except: # noqa:E722 except: # noqa:E722
logger.info("HTTP connection error") logger.info("HTTP connection error")
return None
try: try:
resp = self.con.getresponse() resp = self.con.getresponse()
@ -257,6 +258,7 @@ class namecoinConnection(object):
" %i: %s" % (resp.status, resp.reason)) " %i: %s" % (resp.status, resp.reason))
except: # noqa:E722 except: # noqa:E722
logger.info("HTTP receive error") logger.info("HTTP receive error")
return None
return result return result