cleanup/rm pylint ignores

This commit is contained in:
codey 2025-02-16 08:50:53 -05:00
parent 36975fa3f3
commit b24176b12f
17 changed files with 19 additions and 52 deletions

View File

@ -37,10 +37,6 @@ allow_credentials=True,
allow_methods=["POST", "GET", "HEAD"], allow_methods=["POST", "GET", "HEAD"],
allow_headers=["*"]) allow_headers=["*"])
# pylint: disable=missing-function-docstring
""" """
Blacklisted routes Blacklisted routes
""" """
@ -54,7 +50,7 @@ def base_head():
return return
@app.get("/{path}", include_in_schema=False) @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'] path = request.path_params['path']
if not ( if not (
isinstance(path, str) isinstance(path, str)
@ -74,9 +70,6 @@ def disallow_base_post():
End Blacklisted Routes End Blacklisted Routes
""" """
# pylint: enable=missing-function-docstring
""" """
Actionable Routes Actionable Routes
""" """

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-caught, invalid-name
import logging import logging
import regex import regex
@ -12,7 +11,7 @@ from fastapi.responses import JSONResponse
class AI(FastAPI): class AI(FastAPI):
"""AI Endpoints""" """AI Endpoints"""
def __init__(self, app: FastAPI, def __init__(self, app: FastAPI,
my_util, constants): # pylint: disable=super-init-not-called my_util, constants):
self.app: FastAPI = app self.app: FastAPI = app
self.util = my_util self.util = my_util
self.constants = constants self.constants = constants
@ -50,7 +49,7 @@ class AI(FastAPI):
timeout=ClientTimeout(connect=15, sock_read=30)) as out_request: timeout=ClientTimeout(connect=15, sock_read=30)) as out_request:
response = await out_request.json() response = await out_request.json()
return JSONResponse(content=response) return JSONResponse(content=response)
except Exception as e: # pylint: disable=broad-exception-caught except Exception as e:
logging.error("Error: %s", e) logging.error("Error: %s", e)
return JSONResponse(status_code=500, content={ return JSONResponse(status_code=500, content={
'err': True, 'err': True,
@ -84,7 +83,7 @@ class AI(FastAPI):
timeout=ClientTimeout(connect=15, sock_read=30)) as out_request: timeout=ClientTimeout(connect=15, sock_read=30)) as out_request:
response = await out_request.json() response = await out_request.json()
return JSONResponse(content=response) return JSONResponse(content=response)
except Exception as e: # pylint: disable=broad-exception-caught except Exception as e:
logging.error("Error: %s", e) logging.error("Error: %s", e)
return JSONResponse(status_code=500, content={ return JSONResponse(status_code=500, content={
'err': True, 'err': True,

View File

@ -50,7 +50,7 @@ class ValidArtistSearchRequest(BaseModel):
a: str a: str
class Config: # pylint: disable=missing-class-docstring class Config:
schema_extra = { schema_extra = {
"example": { "example": {
"a": "eminem" "a": "eminem"
@ -66,7 +66,7 @@ class ValidAlbumDetailRequest(BaseModel):
a: str a: str
release: str release: str
class Config: # pylint: disable=missing-class-docstring class Config:
schema_extra = { schema_extra = {
"example": { "example": {
"a": "eminem", "a": "eminem",
@ -83,7 +83,7 @@ class ValidTrackInfoRequest(BaseModel):
a: str a: str
t: str t: str
class Config: # pylint: disable=missing-class-docstring class Config:
schema_extra = { schema_extra = {
"example": { "example": {
"a": "eminem", "a": "eminem",

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-caught
import os import os
import logging import logging
@ -100,7 +99,7 @@ class Karma(FastAPI):
""" """
Karma Endpoints 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.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except
import importlib import importlib
import traceback import traceback
@ -12,7 +11,7 @@ from .constructors import ValidArtistSearchRequest, ValidAlbumDetailRequest,\
class LastFM(FastAPI): class LastFM(FastAPI):
"""Last.FM Endpoints""" """Last.FM Endpoints"""
def __init__(self, app: FastAPI, def __init__(self, app: FastAPI,
util, constants) -> None: # pylint: disable=super-init-not-called util, constants) -> None:
self.app: FastAPI = app self.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-raised, broad-exception-caught
import logging import logging
import os import os
@ -46,7 +45,7 @@ class LyricSearch(FastAPI):
Lyric Search Endpoint Lyric Search Endpoint
""" """
def __init__(self, app: FastAPI, def __init__(self, app: FastAPI,
util, constants) -> None: # pylint: disable=super-init-not-called util, constants) -> None:
self.app: FastAPI = app self.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-caught, invalid-name
import time import time
import logging import logging
@ -14,7 +13,7 @@ class Misc(FastAPI):
Misc Endpoints Misc Endpoints
""" """
def __init__(self, app: FastAPI, my_util, def __init__(self, app: FastAPI, my_util,
constants, radio) -> None: # pylint: disable=super-init-not-called constants, radio) -> None:
self.app: FastAPI = app self.app: FastAPI = app
self.util = my_util self.util = my_util
self.constants = constants self.constants = constants

View File

@ -12,8 +12,6 @@ from uuid import uuid4 as uuid
from typing import Optional from typing import Optional
from fastapi import FastAPI, BackgroundTasks, Request, Response, HTTPException from fastapi import FastAPI, BackgroundTasks, Request, Response, HTTPException
from fastapi.responses import RedirectResponse, JSONResponse from fastapi.responses import RedirectResponse, JSONResponse
# pylint: disable=bare-except, broad-exception-caught, invalid-name
""" """
TODO: TODO:
@ -23,7 +21,7 @@ TODO:
class Radio(FastAPI): class Radio(FastAPI):
"""Radio Endpoints""" """Radio Endpoints"""
def __init__(self, app: FastAPI, def __init__(self, app: FastAPI,
my_util, constants) -> None: # pylint: disable=super-init-not-called my_util, constants) -> None:
self.app: FastAPI = app self.app: FastAPI = app
self.util = my_util self.util = my_util
self.constants = constants self.constants = constants

View File

@ -13,7 +13,7 @@ class RandMsg(FastAPI):
Random Message Endpoint Random Message Endpoint
""" """
def __init__(self, app: FastAPI, def __init__(self, app: FastAPI,
util, constants) -> None: # pylint: disable=super-init-not-called util, constants) -> None:
self.app: FastAPI = app self.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants

View File

@ -11,7 +11,7 @@ class Transcriptions(FastAPI):
""" """
Transcription Endpoints 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.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants
@ -92,7 +92,7 @@ class Transcriptions(FastAPI):
""" """
show_id: int = int(data.s) show_id: int = int(data.s)
episode_id: int = int(data.e) episode_id: int = int(data.e)
# pylint: disable=line-too-long
match show_id: match show_id:
case 0: case 0:
db_path: Union[str, LiteralString] = os.path.join("/usr/local/share", db_path: Union[str, LiteralString] = os.path.join("/usr/local/share",

View File

@ -6,11 +6,10 @@ from fastapi import FastAPI, Request, HTTPException
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from aiohttp import ClientSession, ClientTimeout from aiohttp import ClientSession, ClientTimeout
from .constructors import ValidXCRequest from .constructors import ValidXCRequest
# pylint: disable=invalid-name
class XC(FastAPI): class XC(FastAPI):
"""XC (CrossComm) Endpoints""" """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.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants

View File

@ -11,7 +11,7 @@ class YT(FastAPI):
YT Endpoints YT Endpoints
""" """
def __init__(self, app: FastAPI, util, def __init__(self, app: FastAPI, util,
constants) -> None: # pylint: disable=super-init-not-called constants) -> None:
self.app: FastAPI = app self.app: FastAPI = app
self.util = util self.util = util
self.constants = constants self.constants = constants

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-caught, invalid-name
import traceback import traceback
import logging import logging
@ -8,15 +7,13 @@ import regex
from aiohttp import ClientSession, ClientTimeout from aiohttp import ClientSession, ClientTimeout
from constants import Constants from constants import Constants
class LastFM: class LastFM:
"""LastFM Endpoints""" """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.creds = Constants().LFM_CREDS
self.api_base_url: str = "https://ws.audioscrobbler.com/2.0/?method=" self.api_base_url: str = "https://ws.audioscrobbler.com/2.0/?method="
async def search_artist(self, artist: Optional[str] = None) -> dict: async def search_artist(self, artist: Optional[str] = None) -> dict:
"""Search LastFM for an artist""" """Search LastFM for an artist"""
try: try:

View File

@ -1,4 +0,0 @@
#!/usr/bin/env python3.12
# pylint: disable=empty-docstring
"""
"""

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=wrong-import-order, wrong-import-position bare-except, broad-exception-caught
import os import os
import time import time
@ -15,8 +14,6 @@ from . import redis_cache
from lyric_search import utils, notifier from lyric_search import utils, notifier
from lyric_search.constructors import LyricsResult from lyric_search.constructors import LyricsResult
logger = logging.getLogger() logger = logging.getLogger()
log_level = logging.getLevelName(logger.level) log_level = logging.getLevelName(logger.level)
@ -209,9 +206,6 @@ class Cache:
logging.critical("Cache storage error!") logging.critical("Cache storage error!")
traceback.print_exc() traceback.print_exc()
# pylint: disable=unused-argument
async def search(self, artist: str, song: str, **kwargs) -> Optional[LyricsResult]: async def search(self, artist: str, song: str, **kwargs) -> Optional[LyricsResult]:
""" """
Cache Search Cache Search
@ -222,7 +216,6 @@ class Cache:
Optional[LyricsResult]: The result, if found - None otherwise. Optional[LyricsResult]: The result, if found - None otherwise.
""" """
try: try:
# pylint: enable=unused-argument
artist: str = artist.strip().lower() artist: str = artist.strip().lower()
song: str = song.strip().lower() song: str = song.strip().lower()
input_track: str = f"{artist} - {song}" input_track: str = f"{artist} - {song}"

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-caught, wrong-import-order, wrong-import-position
import sys import sys
sys.path.insert(1,'..') sys.path.insert(1,'..')
@ -37,7 +36,6 @@ class Genius:
self.cache = cache.Cache() self.cache = cache.Cache()
self.redis_cache = redis_cache.RedisCache() self.redis_cache = redis_cache.RedisCache()
# pylint: disable=unused-argument
async def search(self, artist: str, song: str, async def search(self, artist: str, song: str,
**kwargs) -> Optional[LyricsResult]: **kwargs) -> Optional[LyricsResult]:
""" """
@ -49,7 +47,6 @@ class Genius:
Optional[LyricsResult]: The result, if found - None otherwise. Optional[LyricsResult]: The result, if found - None otherwise.
""" """
try: try:
# pylint: enable=unused-argument
artist: str = artist.strip().lower() artist: str = artist.strip().lower()
song: str = song.strip().lower() song: str = song.strip().lower()
time_start: float = time.time() time_start: float = time.time()

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
# pylint: disable=bare-except, broad-exception-caught, wrong-import-position
import sys import sys
import time import time