From 533df80ce98c40b0a2424ecc17bd395e0dbcdfa7 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Wed, 5 Sep 2018 13:56:06 +0300 Subject: [PATCH] Resolving pylint warnings --- src/api.py | 7 ++++--- src/bitmessagemain.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api.py b/src/api.py index 0fa97578..fa2a126a 100644 --- a/src/api.py +++ b/src/api.py @@ -68,6 +68,7 @@ class StoppableXMLRPCServer(SimpleXMLRPCServer): # This thread, of which there is only one, runs the API. class singleAPI(threading.Thread, helper_threading.StoppableThread): + """API thread""" def __init__(self): threading.Thread.__init__(self, name="singleAPI") self.initStop() @@ -88,8 +89,8 @@ class singleAPI(threading.Thread, helper_threading.StoppableThread): def run(self): port = BMConfigParser().getint('bitmessagesettings', 'apiport') try: - from errno import WSAEADDRINUSE - except (ImportError, AttributeError): + getattr(errno, 'WSAEADDRINUSE') + except AttributeError: errno.WSAEADDRINUSE = errno.EADDRINUSE for attempt in range(50): try: @@ -133,7 +134,7 @@ class singleAPI(threading.Thread, helper_threading.StoppableThread): # Modified by Jonathan Warren (Atheros). # http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): - + """The main API handler""" def do_POST(self): # Handles the HTTP POST request. # Attempts to interpret all HTTP POST requests as XML-RPC calls, diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index d6094f0d..a063261d 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -288,7 +288,7 @@ class Main: # API is also objproc dependent if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'): - import api + import api # pylint: disable=relative-import singleAPIThread = api.singleAPI() # close the main program even if there are threads left singleAPIThread.daemon = True