From 0e0118d4b0291dc941e2241185fb63785243f33e Mon Sep 17 00:00:00 2001 From: cmyui Date: Sun, 24 Sep 2023 00:21:21 -0400 Subject: [PATCH] type defs --- app/repositories/ingame_logins.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/repositories/ingame_logins.py b/app/repositories/ingame_logins.py index 46cb8cd2..fa65045f 100644 --- a/app/repositories/ingame_logins.py +++ b/app/repositories/ingame_logins.py @@ -2,6 +2,7 @@ import textwrap from datetime import datetime +from typing import Any from typing import cast from typing import TypedDict @@ -54,7 +55,7 @@ async def create( INSERT INTO ingame_logins (userid, ip, osu_ver, osu_stream, datetime) VALUES (:userid, :ip, :osu_ver, :osu_stream, NOW()) """ - params = { + params: dict[str, Any] = { "userid": user_id, "ip": ip, "osu_ver": osu_ver, @@ -76,16 +77,14 @@ async def create( return cast(IngameLogin, dict(ingame_login._mapping)) -async def fetch_one( - id: int, -) -> IngameLogin | None: +async def fetch_one(id: int) -> IngameLogin | None: """Fetch a login entry from the database.""" query = f"""\ SELECT {READ_PARAMS} FROM ingame_logins WHERE id = :id """ - params = { + params: dict[str, Any] = { "id": id, } ingame_login = await app.state.services.database.fetch_one(query, params) @@ -104,7 +103,7 @@ async def fetch_count( WHERE userid = COALESCE(:userid, userid) AND ip = COALESCE(:ip, ip) """ - params = { + params: dict[str, Any] = { "userid": user_id, "ip": ip, } @@ -130,7 +129,7 @@ async def fetch_many( AND osu_ver = COALESCE(:osu_ver, osu_ver) AND osu_stream = COALESCE(:osu_stream, osu_stream) """ - params = { + params: dict[str, Any] = { "userid": user_id, "ip": ip, "osu_ver": osu_ver,