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. # This thread, of which there is only one, runs the API.
class singleAPI(threading.Thread, helper_threading.StoppableThread): class singleAPI(threading.Thread, helper_threading.StoppableThread):
"""API thread"""
def __init__(self): def __init__(self):
threading.Thread.__init__(self, name="singleAPI") threading.Thread.__init__(self, name="singleAPI")
self.initStop() self.initStop()
@ -88,8 +89,8 @@ class singleAPI(threading.Thread, helper_threading.StoppableThread):
def run(self): def run(self):
port = BMConfigParser().getint('bitmessagesettings', 'apiport') port = BMConfigParser().getint('bitmessagesettings', 'apiport')
try: try:
from errno import WSAEADDRINUSE getattr(errno, 'WSAEADDRINUSE')
except (ImportError, AttributeError): except AttributeError:
errno.WSAEADDRINUSE = errno.EADDRINUSE errno.WSAEADDRINUSE = errno.EADDRINUSE
for attempt in range(50): for attempt in range(50):
try: try:
@ -133,7 +134,7 @@ class singleAPI(threading.Thread, helper_threading.StoppableThread):
# Modified by Jonathan Warren (Atheros). # Modified by Jonathan Warren (Atheros).
# http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/ # http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/
class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
"""The main API handler"""
def do_POST(self): def do_POST(self):
# Handles the HTTP POST request. # Handles the HTTP POST request.
# Attempts to interpret all HTTP POST requests as XML-RPC calls, # Attempts to interpret all HTTP POST requests as XML-RPC calls,

View File

@ -288,7 +288,7 @@ class Main:
# API is also objproc dependent # API is also objproc dependent
if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'): if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'):
import api import api # pylint: disable=relative-import
singleAPIThread = api.singleAPI() singleAPIThread = api.singleAPI()
# close the main program even if there are threads left # close the main program even if there are threads left
singleAPIThread.daemon = True singleAPIThread.daemon = True