diff --git a/base.py b/base.py index 8c409b6..167327d 100644 --- a/base.py +++ b/base.py @@ -37,10 +37,6 @@ allow_credentials=True, allow_methods=["POST", "GET", "HEAD"], allow_headers=["*"]) - - -# pylint: disable=missing-function-docstring - """ Blacklisted routes """ @@ -54,7 +50,7 @@ def base_head(): return @app.get("/{path}", include_in_schema=False) -def disallow_get_any(request: Request, var: Any = None): # pylint: disable=unused-argument +def disallow_get_any(request: Request, var: Any = None): path = request.path_params['path'] if not ( isinstance(path, str) @@ -74,9 +70,6 @@ def disallow_base_post(): End Blacklisted Routes """ -# pylint: enable=missing-function-docstring - - """ Actionable Routes """ diff --git a/endpoints/ai.py b/endpoints/ai.py index b76f336..92701e1 100644 --- a/endpoints/ai.py +++ b/endpoints/ai.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-caught, invalid-name import logging import regex @@ -12,7 +11,7 @@ from fastapi.responses import JSONResponse class AI(FastAPI): """AI Endpoints""" def __init__(self, app: FastAPI, - my_util, constants): # pylint: disable=super-init-not-called + my_util, constants): self.app: FastAPI = app self.util = my_util self.constants = constants @@ -50,7 +49,7 @@ class AI(FastAPI): timeout=ClientTimeout(connect=15, sock_read=30)) as out_request: response = await out_request.json() return JSONResponse(content=response) - except Exception as e: # pylint: disable=broad-exception-caught + except Exception as e: logging.error("Error: %s", e) return JSONResponse(status_code=500, content={ 'err': True, @@ -84,7 +83,7 @@ class AI(FastAPI): timeout=ClientTimeout(connect=15, sock_read=30)) as out_request: response = await out_request.json() return JSONResponse(content=response) - except Exception as e: # pylint: disable=broad-exception-caught + except Exception as e: logging.error("Error: %s", e) return JSONResponse(status_code=500, content={ 'err': True, diff --git a/endpoints/constructors.py b/endpoints/constructors.py index 58c7fdd..7151f05 100644 --- a/endpoints/constructors.py +++ b/endpoints/constructors.py @@ -50,7 +50,7 @@ class ValidArtistSearchRequest(BaseModel): a: str - class Config: # pylint: disable=missing-class-docstring + class Config: schema_extra = { "example": { "a": "eminem" @@ -66,7 +66,7 @@ class ValidAlbumDetailRequest(BaseModel): a: str release: str - class Config: # pylint: disable=missing-class-docstring + class Config: schema_extra = { "example": { "a": "eminem", @@ -83,7 +83,7 @@ class ValidTrackInfoRequest(BaseModel): a: str t: str - class Config: # pylint: disable=missing-class-docstring + class Config: schema_extra = { "example": { "a": "eminem", diff --git a/endpoints/karma.py b/endpoints/karma.py index 15986d4..2476599 100644 --- a/endpoints/karma.py +++ b/endpoints/karma.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-caught import os import logging @@ -100,7 +99,7 @@ class Karma(FastAPI): """ Karma Endpoints """ - def __init__(self, app: FastAPI, util, constants) -> None: # pylint: disable=super-init-not-called + def __init__(self, app: FastAPI, util, constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants diff --git a/endpoints/lastfm.py b/endpoints/lastfm.py index e8bdb75..f6a2e25 100644 --- a/endpoints/lastfm.py +++ b/endpoints/lastfm.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except import importlib import traceback @@ -12,7 +11,7 @@ from .constructors import ValidArtistSearchRequest, ValidAlbumDetailRequest,\ class LastFM(FastAPI): """Last.FM Endpoints""" def __init__(self, app: FastAPI, - util, constants) -> None: # pylint: disable=super-init-not-called + util, constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants diff --git a/endpoints/lyric_search.py b/endpoints/lyric_search.py index 02293e4..8420c80 100644 --- a/endpoints/lyric_search.py +++ b/endpoints/lyric_search.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-raised, broad-exception-caught import logging import os @@ -46,7 +45,7 @@ class LyricSearch(FastAPI): Lyric Search Endpoint """ def __init__(self, app: FastAPI, - util, constants) -> None: # pylint: disable=super-init-not-called + util, constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants diff --git a/endpoints/misc.py b/endpoints/misc.py index 179de5d..5de65c2 100644 --- a/endpoints/misc.py +++ b/endpoints/misc.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-caught, invalid-name import time import logging @@ -14,7 +13,7 @@ class Misc(FastAPI): Misc Endpoints """ def __init__(self, app: FastAPI, my_util, - constants, radio) -> None: # pylint: disable=super-init-not-called + constants, radio) -> None: self.app: FastAPI = app self.util = my_util self.constants = constants diff --git a/endpoints/radio.py b/endpoints/radio.py index 9f8678d..737e5b9 100644 --- a/endpoints/radio.py +++ b/endpoints/radio.py @@ -12,8 +12,6 @@ from uuid import uuid4 as uuid from typing import Optional from fastapi import FastAPI, BackgroundTasks, Request, Response, HTTPException from fastapi.responses import RedirectResponse, JSONResponse -# pylint: disable=bare-except, broad-exception-caught, invalid-name - """ TODO: @@ -23,7 +21,7 @@ TODO: class Radio(FastAPI): """Radio Endpoints""" def __init__(self, app: FastAPI, - my_util, constants) -> None: # pylint: disable=super-init-not-called + my_util, constants) -> None: self.app: FastAPI = app self.util = my_util self.constants = constants diff --git a/endpoints/rand_msg.py b/endpoints/rand_msg.py index d1aa7c0..acc8779 100644 --- a/endpoints/rand_msg.py +++ b/endpoints/rand_msg.py @@ -13,7 +13,7 @@ class RandMsg(FastAPI): Random Message Endpoint """ def __init__(self, app: FastAPI, - util, constants) -> None: # pylint: disable=super-init-not-called + util, constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants diff --git a/endpoints/transcriptions.py b/endpoints/transcriptions.py index 4b5c762..0156ea7 100644 --- a/endpoints/transcriptions.py +++ b/endpoints/transcriptions.py @@ -11,7 +11,7 @@ class Transcriptions(FastAPI): """ Transcription Endpoints """ - def __init__(self, app: FastAPI, util, constants) -> None: # pylint: disable=super-init-not-called + def __init__(self, app: FastAPI, util, constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants @@ -92,7 +92,7 @@ class Transcriptions(FastAPI): """ show_id: int = int(data.s) episode_id: int = int(data.e) - # pylint: disable=line-too-long + match show_id: case 0: db_path: Union[str, LiteralString] = os.path.join("/usr/local/share", diff --git a/endpoints/xc.py b/endpoints/xc.py index 8c68834..cffb0e7 100644 --- a/endpoints/xc.py +++ b/endpoints/xc.py @@ -6,11 +6,10 @@ from fastapi import FastAPI, Request, HTTPException from fastapi.responses import JSONResponse from aiohttp import ClientSession, ClientTimeout from .constructors import ValidXCRequest -# pylint: disable=invalid-name class XC(FastAPI): """XC (CrossComm) Endpoints""" - def __init__(self, app: FastAPI, util, constants) -> None: # pylint: disable=super-init-not-called + def __init__(self, app: FastAPI, util, constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants diff --git a/endpoints/yt.py b/endpoints/yt.py index 099905d..29439d3 100644 --- a/endpoints/yt.py +++ b/endpoints/yt.py @@ -11,7 +11,7 @@ class YT(FastAPI): YT Endpoints """ def __init__(self, app: FastAPI, util, - constants) -> None: # pylint: disable=super-init-not-called + constants) -> None: self.app: FastAPI = app self.util = util self.constants = constants diff --git a/lastfm_wrapper.py b/lastfm_wrapper.py index ccdda5c..4d125d6 100644 --- a/lastfm_wrapper.py +++ b/lastfm_wrapper.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-caught, invalid-name import traceback import logging @@ -8,15 +7,13 @@ import regex from aiohttp import ClientSession, ClientTimeout from constants import Constants - - class LastFM: """LastFM Endpoints""" - def __init__(self, noInit: Optional[bool] = False) -> None: # pylint: disable=unused-argument + def __init__(self, + noInit: Optional[bool] = False) -> None: self.creds = Constants().LFM_CREDS self.api_base_url: str = "https://ws.audioscrobbler.com/2.0/?method=" - async def search_artist(self, artist: Optional[str] = None) -> dict: """Search LastFM for an artist""" try: diff --git a/lyric_search/__init__.py b/lyric_search/__init__.py index 6a78490..e69de29 100644 --- a/lyric_search/__init__.py +++ b/lyric_search/__init__.py @@ -1,4 +0,0 @@ -#!/usr/bin/env python3.12 -# pylint: disable=empty-docstring -""" -""" \ No newline at end of file diff --git a/lyric_search/sources/cache.py b/lyric_search/sources/cache.py index eb64065..adaf02a 100644 --- a/lyric_search/sources/cache.py +++ b/lyric_search/sources/cache.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=wrong-import-order, wrong-import-position bare-except, broad-exception-caught import os import time @@ -15,8 +14,6 @@ from . import redis_cache from lyric_search import utils, notifier from lyric_search.constructors import LyricsResult - - logger = logging.getLogger() log_level = logging.getLevelName(logger.level) @@ -209,9 +206,6 @@ class Cache: logging.critical("Cache storage error!") traceback.print_exc() - - - # pylint: disable=unused-argument async def search(self, artist: str, song: str, **kwargs) -> Optional[LyricsResult]: """ Cache Search @@ -222,7 +216,6 @@ class Cache: Optional[LyricsResult]: The result, if found - None otherwise. """ try: - # pylint: enable=unused-argument artist: str = artist.strip().lower() song: str = song.strip().lower() input_track: str = f"{artist} - {song}" diff --git a/lyric_search/sources/genius.py b/lyric_search/sources/genius.py index d47c411..d3eb68e 100644 --- a/lyric_search/sources/genius.py +++ b/lyric_search/sources/genius.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-caught, wrong-import-order, wrong-import-position import sys sys.path.insert(1,'..') @@ -37,7 +36,6 @@ class Genius: self.cache = cache.Cache() self.redis_cache = redis_cache.RedisCache() - # pylint: disable=unused-argument async def search(self, artist: str, song: str, **kwargs) -> Optional[LyricsResult]: """ @@ -49,7 +47,6 @@ class Genius: Optional[LyricsResult]: The result, if found - None otherwise. """ try: - # pylint: enable=unused-argument artist: str = artist.strip().lower() song: str = song.strip().lower() time_start: float = time.time() diff --git a/lyric_search/sources/lrclib.py b/lyric_search/sources/lrclib.py index 7948280..cc49916 100644 --- a/lyric_search/sources/lrclib.py +++ b/lyric_search/sources/lrclib.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3.12 -# pylint: disable=bare-except, broad-exception-caught, wrong-import-position import sys import time