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_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
"""

View File

@ -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,

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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:

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
# 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}"

View File

@ -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()

View File

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