pydantic docstrings
This commit is contained in:
@ -10,7 +10,9 @@ import redis.asyncio as redis
|
||||
from lyric_search.sources import private, cache as LyricsCache, redis_cache
|
||||
|
||||
class Misc(FastAPI):
|
||||
"""Misc Endpoints"""
|
||||
"""
|
||||
Misc Endpoints
|
||||
"""
|
||||
def __init__(self, app: FastAPI, my_util,
|
||||
constants, radio) -> None: # pylint: disable=super-init-not-called
|
||||
self.app: FastAPI = app
|
||||
@ -47,8 +49,9 @@ class Misc(FastAPI):
|
||||
|
||||
|
||||
async def homepage_redis_widget(self) -> JSONResponse:
|
||||
"""Homepage Redis Widget Handler"""
|
||||
|
||||
"""
|
||||
Homepage Redis Widget Handler
|
||||
"""
|
||||
# Measure response time w/ test lyric search
|
||||
time_start: float = time.time() # Start time for response_time
|
||||
test_lyrics_result = await self.redis_client.ft().search("@artist: test @song: test")
|
||||
@ -68,8 +71,9 @@ class Misc(FastAPI):
|
||||
})
|
||||
|
||||
async def homepage_sqlite_widget(self) -> JSONResponse:
|
||||
"""Homepage SQLite Widget Handler"""
|
||||
|
||||
"""
|
||||
Homepage SQLite Widget Handler
|
||||
"""
|
||||
row_count: int = await self.lyr_cache.sqlite_rowcount()
|
||||
distinct_artists: int = await self.lyr_cache.sqlite_distinct("artist")
|
||||
lyrics_length: int = await self.lyr_cache.sqlite_lyrics_length()
|
||||
@ -80,7 +84,9 @@ class Misc(FastAPI):
|
||||
})
|
||||
|
||||
async def homepage_lyrics_widget(self) -> dict:
|
||||
"""Homepage Lyrics Widget Handler"""
|
||||
"""
|
||||
Homepage Lyrics Widget Handler
|
||||
"""
|
||||
found_counts: dict = await self.redis_cache.get_found_counts()
|
||||
if not isinstance(found_counts, dict):
|
||||
return {
|
||||
@ -90,7 +96,9 @@ class Misc(FastAPI):
|
||||
return found_counts
|
||||
|
||||
async def homepage_radio_widget(self) -> JSONResponse:
|
||||
"""Homepage Radio Widget Handler"""
|
||||
"""
|
||||
Homepage Radio Widget Handler
|
||||
"""
|
||||
radio_np: str = await self.get_radio_np()
|
||||
if not radio_np:
|
||||
return JSONResponse(status_code=500, content={
|
||||
|
Reference in New Issue
Block a user