From 7a86406746d98fd440502868de5eb15add0ea9d7 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Thu, 16 Jun 2022 08:52:40 -0400 Subject: [PATCH] Fix and enable lint no-self-use & try-except-raise. --- lbry/extras/daemon/component.py | 2 +- lbry/extras/daemon/daemon.py | 3 ++- lbry/stream/background_downloader.py | 1 + lbry/stream/stream_manager.py | 3 ++- setup.cfg | 2 -- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lbry/extras/daemon/component.py b/lbry/extras/daemon/component.py index cce380f85..80c92de53 100644 --- a/lbry/extras/daemon/component.py +++ b/lbry/extras/daemon/component.py @@ -37,7 +37,7 @@ class Component(metaclass=ComponentType): def running(self): return self._running - async def get_status(self): + async def get_status(self): # pylint: disable=no-self-use return async def start(self): diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 5d16812bf..240582c81 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -614,7 +614,8 @@ class Daemon(metaclass=JSONRPCServerType): content_type='application/json' ) - async def handle_metrics_get_request(self, request: web.Request): + @staticmethod + async def handle_metrics_get_request(request: web.Request): try: return web.Response( text=prom_generate_latest().decode(), diff --git a/lbry/stream/background_downloader.py b/lbry/stream/background_downloader.py index 64848ac3a..c76d02582 100644 --- a/lbry/stream/background_downloader.py +++ b/lbry/stream/background_downloader.py @@ -23,6 +23,7 @@ class BackgroundDownloader: except ValueError: return except asyncio.CancelledError: + log.debug("Cancelled background downloader") raise except Exception: log.error("Unexpected download error on background downloader") diff --git a/lbry/stream/stream_manager.py b/lbry/stream/stream_manager.py index 0e4c1e248..bc37a1cc9 100644 --- a/lbry/stream/stream_manager.py +++ b/lbry/stream/stream_manager.py @@ -224,7 +224,8 @@ class StreamManager(SourceManager): ) return task - async def _retriable_reflect_stream(self, stream, host, port): + @staticmethod + async def _retriable_reflect_stream(stream, host, port): sent = await stream.upload_to_reflector(host, port) while not stream.is_fully_reflected and stream.reflector_progress > 0 and len(sent) > 0: stream.reflector_progress = 0 diff --git a/setup.cfg b/setup.cfg index 9c8ebe60b..d3a1c9e0b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,8 +29,6 @@ disable= cyclic-import, missing-docstring, consider-using-f-string, - no-self-use, - try-except-raise, duplicate-code, expression-not-assigned, inconsistent-return-statements,