Add pylint local excludes to silence false positives

This commit is contained in:
Kristóf Tóth 2018-03-30 18:11:38 +02:00
parent 3ae0995b95
commit d850f55b86
9 changed files with 17 additions and 5 deletions

View File

@ -1 +1 @@
from .envvars import * from .envvars import * # pylint: disable=wildcard-import

View File

@ -50,6 +50,7 @@ class HistoryMonitor(CallbackMixin, ABC):
raise NotImplementedError raise NotImplementedError
def sanitize_command(self, command): def sanitize_command(self, command):
# pylint: disable=no-self-use
return command return command
def _invoke_callbacks(self): def _invoke_callbacks(self):

View File

@ -105,7 +105,7 @@ class SourceCodeEventHandler(TriggerlessEventHandler):
data['content'] = 'You have no permission to open that file :(' data['content'] = 'You have no permission to open that file :('
except FileNotFoundError: except FileNotFoundError:
data['content'] = 'This file was removed :(' data['content'] = 'This file was removed :('
except Exception: except Exception: # pylint: disable=broad-except
data['content'] = 'Failed to read file :(' data['content'] = 'Failed to read file :('
return data return data
@ -113,7 +113,7 @@ class SourceCodeEventHandler(TriggerlessEventHandler):
self.monitor.ignore = self.monitor.ignore + 1 self.monitor.ignore = self.monitor.ignore + 1
try: try:
self.filemanager.file_contents = data['content'] self.filemanager.file_contents = data['content']
except Exception: except Exception: # pylint: disable=broad-except
LOG.exception('Error writing file!') LOG.exception('Error writing file!')
del data['content'] del data['content']
return data return data

View File

@ -29,7 +29,7 @@ class TerminadoMiniServer:
def pty(self): def pty(self):
return self.term_manager.terminal.ptyproc return self.term_manager.terminal.ptyproc
class ResetterTermSocket(TermSocket): class ResetterTermSocket(TermSocket): # pylint: disable=abstract-method
def check_origin(self, origin): def check_origin(self, origin):
return True return True

View File

@ -25,6 +25,7 @@ class EventHandlerBase(ABC):
raise NotImplementedError raise NotImplementedError
def _dispatch_handling(self, key, message): def _dispatch_handling(self, key, message):
# pylint: disable=no-else-return
if key != 'reset': if key != 'reset':
return self.handle_event(key, message) return self.handle_event(key, message)
else: else:
@ -35,6 +36,7 @@ class EventHandlerBase(ABC):
raise NotImplementedError raise NotImplementedError
def handle_reset(self, message): def handle_reset(self, message):
# pylint: disable=unused-argument,no-self-use
return None return None
def cleanup(self): def cleanup(self):
@ -66,11 +68,13 @@ class EventHandlerBase(ABC):
class TriggerlessEventHandler(EventHandlerBase, ABC): class TriggerlessEventHandler(EventHandlerBase, ABC):
# pylint: disable=abstract-method
def dispatch_handling(self, key, message): def dispatch_handling(self, key, message):
return self._dispatch_handling(key, message) return self._dispatch_handling(key, message)
class TriggeredEventHandler(EventHandlerBase, ABC): class TriggeredEventHandler(EventHandlerBase, ABC):
# pylint: disable=abstract-method
def __init__(self, key, trigger): def __init__(self, key, trigger):
super().__init__(key) super().__init__(key)
self.trigger = trigger self.trigger = trigger
@ -78,3 +82,4 @@ class TriggeredEventHandler(EventHandlerBase, ABC):
def dispatch_handling(self, key, message): def dispatch_handling(self, key, message):
if message.get('trigger') == self.trigger: if message.get('trigger') == self.trigger:
return self._dispatch_handling(key, message) return self._dispatch_handling(key, message)
return None

View File

@ -23,4 +23,4 @@ class FSMBase(CallbackMixin):
self._execute_callbacks(event_data.kwargs) self._execute_callbacks(event_data.kwargs)
def is_solved(self): def is_solved(self):
return self.state in self.accepted_states return self.state in self.accepted_states # pylint: disable=no-member

View File

@ -20,6 +20,7 @@ class ControllerResponder:
stream.send_multipart(serialize_all(self.token, response)) stream.send_multipart(serialize_all(self.token, response))
def handle_test_request(self, data): def handle_test_request(self, data):
# pylint: disable=unused-argument,no-self-use
return 'OK' return 'OK'
def handle_token_request(self, data): def handle_token_request(self, data):
@ -28,6 +29,7 @@ class ControllerResponder:
return {'token': self.token} return {'token': self.token}
def handle_solution_check_request(self, data): def handle_solution_check_request(self, data):
# pylint: disable=unused-argument
return { return {
'solved': self.fsm.is_solved(), 'solved': self.fsm.is_solved(),
'message': 'solved' if self.fsm.is_solved() else 'not solved' 'message': 'solved' if self.fsm.is_solved() else 'not solved'

View File

@ -40,6 +40,7 @@ class TFWServer:
return message return message
def proxy_filter(self, message): def proxy_filter(self, message):
# pylint: disable=unused-argument,no-self-use
return True return True
def listen(self, port): def listen(self, port):
@ -83,6 +84,7 @@ class FSMUpdater:
self.uplink = ServerUplinkConnector() self.uplink = ServerUplinkConnector()
def update(self, kwargs_dict): def update(self, kwargs_dict):
# pylint: disable=unused-argument
self.uplink.send(*self.generate_fsm_update()) self.uplink.send(*self.generate_fsm_update())
def generate_fsm_update(self): def generate_fsm_update(self):

View File

@ -61,7 +61,9 @@ class ZMQWebSocketHandler(WebSocketHandler, ABC):
class ZMQWebSocketProxy(ZMQWebSocketHandler): class ZMQWebSocketProxy(ZMQWebSocketHandler):
# pylint: disable=abstract-method
def initialize(self, make_response, proxy_filter): def initialize(self, make_response, proxy_filter):
# pylint: disable=arguments-differ
self._make_response = make_response self._make_response = make_response
self._proxy_filter = proxy_filter self._proxy_filter = proxy_filter