chore(lint): make ruff happy
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
GeoIP dependency for FastAPI
|
||||
"""
|
||||
import ipaddress
|
||||
from functools import lru_cache
|
||||
from app.helpers.geoip_helper import GeoIPHelper
|
||||
from app.config import settings
|
||||
|
||||
@lru_cache()
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
import ipaddress
|
||||
|
||||
from app.config import settings
|
||||
from app.helpers.geoip_helper import GeoIPHelper
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_geoip_helper() -> GeoIPHelper:
|
||||
"""
|
||||
获取 GeoIP 帮助类实例
|
||||
@@ -18,7 +22,7 @@ def get_geoip_helper() -> GeoIPHelper:
|
||||
license_key=settings.maxmind_license_key,
|
||||
editions=["City", "ASN"],
|
||||
max_age_days=8,
|
||||
timeout=60.0
|
||||
timeout=60.0,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -89,8 +89,7 @@ async def get_client_user(
|
||||
user = (await db.exec(select(User).where(User.id == token_record.user_id))).first()
|
||||
if not user:
|
||||
raise HTTPException(status_code=401, detail="Invalid or expired token")
|
||||
|
||||
|
||||
|
||||
await db.refresh(user)
|
||||
return user
|
||||
|
||||
@@ -128,7 +127,6 @@ async def get_current_user(
|
||||
user = (await db.exec(select(User).where(User.id == token_record.user_id))).first()
|
||||
if not user:
|
||||
raise HTTPException(status_code=401, detail="Invalid or expired token")
|
||||
|
||||
|
||||
|
||||
await db.refresh(user)
|
||||
return user
|
||||
|
||||
Reference in New Issue
Block a user