Resolving pylint warnings

This commit is contained in:
Dmitri Bogomolov 2018-09-05 13:56:06 +03:00
parent bd5bdda009
commit 533df80ce9
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 5 additions and 4 deletions

View File

@ -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,

View File

@ -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