chore(linter): make ruff happy
This commit is contained in:
@@ -115,9 +115,14 @@ class GeoIPHelper:
|
|||||||
age_days = (time.time() - os.path.getmtime(path)) / 86400
|
age_days = (time.time() - os.path.getmtime(path)) / 86400
|
||||||
if age_days >= self.max_age_days:
|
if age_days >= self.max_age_days:
|
||||||
need = True
|
need = True
|
||||||
logger.info(f"[GeoIP] {eid} database is {age_days:.1f} days old (max: {self.max_age_days}), will download new version")
|
logger.info(
|
||||||
|
f"[GeoIP] {eid} database is {age_days:.1f} days old "
|
||||||
|
f"(max: {self.max_age_days}), will download new version"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
logger.info(f"[GeoIP] {eid} database is {age_days:.1f} days old, still fresh (max: {self.max_age_days})")
|
logger.info(
|
||||||
|
f"[GeoIP] {eid} database is {age_days:.1f} days old, still fresh (max: {self.max_age_days})"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
logger.info(f"[GeoIP] {eid} database not found, will download")
|
logger.info(f"[GeoIP] {eid} database not found, will download")
|
||||||
|
|
||||||
|
|||||||
@@ -436,5 +436,3 @@ async def get_user_scores(
|
|||||||
# 处理资源代理
|
# 处理资源代理
|
||||||
processed_scores = await process_response_assets(score_responses, request)
|
processed_scores = await process_response_assets(score_responses, request)
|
||||||
return processed_scores
|
return processed_scores
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class AssetProxyService:
|
|||||||
r"https://a\.ppy\.sh/", f"https://{self.avatar_proxy_prefix}.{self.custom_asset_domain}/", result
|
r"https://a\.ppy\.sh/", f"https://{self.avatar_proxy_prefix}.{self.custom_asset_domain}/", result
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
return data
|
return data
|
||||||
|
|||||||
6
main.py
6
main.py
@@ -39,7 +39,7 @@ from app.service.osu_rx_statistics import create_rx_statistics
|
|||||||
from app.service.redis_message_system import redis_message_system
|
from app.service.redis_message_system import redis_message_system
|
||||||
from app.utils import bg_tasks, utcnow
|
from app.utils import bg_tasks, utcnow
|
||||||
|
|
||||||
from fastapi import Depends, FastAPI, HTTPException, Request
|
from fastapi import FastAPI, HTTPException, Request
|
||||||
from fastapi.exceptions import RequestValidationError
|
from fastapi.exceptions import RequestValidationError
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import JSONResponse, RedirectResponse
|
from fastapi.responses import JSONResponse, RedirectResponse
|
||||||
@@ -196,9 +196,7 @@ async def get_user_avatar_root(
|
|||||||
user_id: int,
|
user_id: int,
|
||||||
session: Database,
|
session: Database,
|
||||||
):
|
):
|
||||||
"""用户头像重定向端点 (根路径)
|
"""用户头像重定向端点 (根路径)"""
|
||||||
|
|
||||||
"""
|
|
||||||
user = await session.get(User, user_id)
|
user = await session.get(User, user_id)
|
||||||
if not user:
|
if not user:
|
||||||
raise HTTPException(status_code=404, detail="User not found")
|
raise HTTPException(status_code=404, detail="User not found")
|
||||||
|
|||||||
Reference in New Issue
Block a user