style(project): remove from __future__ import annotations
This commit is contained in:
2
.github/scripts/generate_config_doc.py
vendored
2
.github/scripts/generate_config_doc.py
vendored
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from enum import Enum
|
||||
import importlib.util
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
|
||||
from app.database.daily_challenge import DailyChallengeStats
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from app.database.beatmap import calculate_beatmap_attributes
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
|
||||
from app.database.score import Beatmap, Score
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
|
||||
from app.database.score import Beatmap, Score
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
|
||||
from app.database import UserStatistics
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
from typing import Literal, cast
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
|
||||
from app.database.score import Beatmap, Score
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import hashlib
|
||||
import re
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from copy import deepcopy
|
||||
from enum import Enum
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# ruff: noqa: I002
|
||||
from enum import Enum
|
||||
from typing import Annotated, Any
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
BANCHOBOT_ID = 2
|
||||
|
||||
BACKUP_CODE_LENGTH = 10
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.database.beatmapset import Beatmapset
|
||||
from app.database.user import User
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
密码重置相关数据库模型
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from app.utils import utcnow
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends, Header
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from app.service.beatmap_download_service import BeatmapDownloadService, download_service
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from app.dependencies.database import Redis
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncIterator, Callable
|
||||
from contextlib import asynccontextmanager
|
||||
from contextvars import ContextVar
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from app.config import settings
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
GeoIP dependency for FastAPI
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
import ipaddress
|
||||
from typing import Annotated
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Request
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.config import settings
|
||||
|
||||
from fastapi import Depends
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import UTC
|
||||
from typing import cast
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated, cast
|
||||
|
||||
from app.config import (
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from app.auth import get_token_by_access_token
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from app.models.model import UserAgentInfo as UserAgentInfoModel
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
用户页面相关的异常类
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
class UserpageError(Exception):
|
||||
"""用户页面处理错误基类"""
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .beatmap import BeatmapFetcher
|
||||
from .beatmap_raw import BeatmapRawFetcher
|
||||
from .beatmapset import BeatmapsetFetcher
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
from urllib.parse import quote
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.database.beatmap import BeatmapResp
|
||||
from app.log import fetcher_logger
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.log import fetcher_logger
|
||||
|
||||
from ._base import BaseFetcher
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""资源代理辅助方法与路由装饰器。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Callable
|
||||
from functools import wraps
|
||||
import re
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
GeoLite2 Helper Class (asynchronous)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from contextlib import suppress
|
||||
import os
|
||||
|
||||
@@ -6,8 +6,6 @@ Rate limiter for osu! API requests to avoid abuse detection.
|
||||
- 建议:每分钟不超过 60 次请求以避免滥用检测
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections import deque
|
||||
import time
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import http
|
||||
import inspect
|
||||
import logging
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .verify_session import SessionState, VerifySessionMiddleware
|
||||
|
||||
__all__ = ["SessionState", "VerifySessionMiddleware"]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.config import settings
|
||||
from app.middleware.verify_session import VerifySessionMiddleware
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ FastAPI会话验证中间件
|
||||
基于osu-web的会话验证系统,适配FastAPI框架
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
@@ -28,6 +26,96 @@ from starlette.middleware.base import BaseHTTPMiddleware
|
||||
logger = log("Middleware")
|
||||
|
||||
|
||||
class SessionState:
|
||||
"""会话状态类
|
||||
|
||||
简化版本的会话状态管理
|
||||
"""
|
||||
|
||||
def __init__(self, session: LoginSession, user: User, redis: Redis, db: AsyncSession, api_version: int = 0) -> None:
|
||||
self.session = session
|
||||
self.user = user
|
||||
self.redis = redis
|
||||
self.db = db
|
||||
self.api_version = api_version
|
||||
self._verification_method: str | None = None
|
||||
|
||||
def is_verified(self) -> bool:
|
||||
"""检查会话是否已验证"""
|
||||
return self.session.is_verified
|
||||
|
||||
async def get_method(self) -> str:
|
||||
"""获取验证方法"""
|
||||
if self._verification_method is None:
|
||||
# 从Redis获取已设置的方法
|
||||
token_id = self.session.token_id
|
||||
if token_id is not None:
|
||||
self._verification_method = await LoginSessionService.get_login_method(
|
||||
self.user.id, token_id, self.redis
|
||||
)
|
||||
|
||||
if self._verification_method is None:
|
||||
if self.api_version < SUPPORT_TOTP_VERIFICATION_VER:
|
||||
self._verification_method = "mail"
|
||||
return self._verification_method
|
||||
|
||||
await self.user.awaitable_attrs.totp_key
|
||||
totp_key = self.user.totp_key
|
||||
self._verification_method = "totp" if totp_key else "mail"
|
||||
|
||||
token_id = self.session.token_id
|
||||
if token_id is not None:
|
||||
await LoginSessionService.set_login_method(
|
||||
self.user.id, token_id, self._verification_method, self.redis
|
||||
)
|
||||
|
||||
return self._verification_method
|
||||
|
||||
async def mark_verified(self) -> None:
|
||||
"""标记会话为已验证"""
|
||||
try:
|
||||
token_id = self.session.token_id
|
||||
if token_id is not None:
|
||||
await LoginSessionService.mark_session_verified(
|
||||
self.db,
|
||||
self.redis,
|
||||
self.user.id,
|
||||
token_id,
|
||||
self.session.ip_address,
|
||||
extract_user_agent(self.session.user_agent),
|
||||
self.session.web_uuid,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error marking verified: {e}")
|
||||
|
||||
async def issue_mail_if_needed(self) -> None:
|
||||
"""如果需要,发送验证邮件"""
|
||||
try:
|
||||
if await self.get_method() == "mail":
|
||||
from app.service.verification_service import EmailVerificationService
|
||||
|
||||
# 这里可以触发邮件发送
|
||||
await EmailVerificationService.send_verification_email(
|
||||
self.db, self.redis, self.user.id, self.user.username, self.user.email, None, None
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error issuing mail: {e}")
|
||||
|
||||
def get_key(self) -> str:
|
||||
"""获取会话密钥"""
|
||||
return str(self.session.id) if self.session.id else ""
|
||||
|
||||
@property
|
||||
def key_for_event(self) -> str:
|
||||
"""获取用于事件广播的会话密钥"""
|
||||
return LoginSessionService.get_key_for_event(self.get_key())
|
||||
|
||||
@property
|
||||
def user_id(self) -> int:
|
||||
"""获取用户ID"""
|
||||
return self.user.id
|
||||
|
||||
|
||||
class VerifySessionMiddleware(BaseHTTPMiddleware):
|
||||
"""会话验证中间件
|
||||
|
||||
@@ -192,93 +280,3 @@ class VerifySessionMiddleware(BaseHTTPMiddleware):
|
||||
return JSONResponse(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content={"error": "Verification initiation failed"}
|
||||
)
|
||||
|
||||
|
||||
class SessionState:
|
||||
"""会话状态类
|
||||
|
||||
简化版本的会话状态管理
|
||||
"""
|
||||
|
||||
def __init__(self, session: LoginSession, user: User, redis: Redis, db: AsyncSession, api_version: int = 0) -> None:
|
||||
self.session = session
|
||||
self.user = user
|
||||
self.redis = redis
|
||||
self.db = db
|
||||
self.api_version = api_version
|
||||
self._verification_method: str | None = None
|
||||
|
||||
def is_verified(self) -> bool:
|
||||
"""检查会话是否已验证"""
|
||||
return self.session.is_verified
|
||||
|
||||
async def get_method(self) -> str:
|
||||
"""获取验证方法"""
|
||||
if self._verification_method is None:
|
||||
# 从Redis获取已设置的方法
|
||||
token_id = self.session.token_id
|
||||
if token_id is not None:
|
||||
self._verification_method = await LoginSessionService.get_login_method(
|
||||
self.user.id, token_id, self.redis
|
||||
)
|
||||
|
||||
if self._verification_method is None:
|
||||
if self.api_version < SUPPORT_TOTP_VERIFICATION_VER:
|
||||
self._verification_method = "mail"
|
||||
return self._verification_method
|
||||
|
||||
await self.user.awaitable_attrs.totp_key
|
||||
totp_key = self.user.totp_key
|
||||
self._verification_method = "totp" if totp_key else "mail"
|
||||
|
||||
token_id = self.session.token_id
|
||||
if token_id is not None:
|
||||
await LoginSessionService.set_login_method(
|
||||
self.user.id, token_id, self._verification_method, self.redis
|
||||
)
|
||||
|
||||
return self._verification_method
|
||||
|
||||
async def mark_verified(self) -> None:
|
||||
"""标记会话为已验证"""
|
||||
try:
|
||||
token_id = self.session.token_id
|
||||
if token_id is not None:
|
||||
await LoginSessionService.mark_session_verified(
|
||||
self.db,
|
||||
self.redis,
|
||||
self.user.id,
|
||||
token_id,
|
||||
self.session.ip_address,
|
||||
extract_user_agent(self.session.user_agent),
|
||||
self.session.web_uuid,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error marking verified: {e}")
|
||||
|
||||
async def issue_mail_if_needed(self) -> None:
|
||||
"""如果需要,发送验证邮件"""
|
||||
try:
|
||||
if await self.get_method() == "mail":
|
||||
from app.service.verification_service import EmailVerificationService
|
||||
|
||||
# 这里可以触发邮件发送
|
||||
await EmailVerificationService.send_verification_email(
|
||||
self.db, self.redis, self.user.id, self.user.username, self.user.email, None, None
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error issuing mail: {e}")
|
||||
|
||||
def get_key(self) -> str:
|
||||
"""获取会话密钥"""
|
||||
return str(self.session.id) if self.session.id else ""
|
||||
|
||||
@property
|
||||
def key_for_event(self) -> str:
|
||||
"""获取用于事件广播的会话密钥"""
|
||||
return LoginSessionService.get_key_for_event(self.get_key())
|
||||
|
||||
@property
|
||||
def user_id(self) -> int:
|
||||
"""获取用户ID"""
|
||||
return self.user.id
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import TYPE_CHECKING, NamedTuple
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import IntEnum
|
||||
from typing import Annotated, Any, Literal
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
扩展的 OAuth 响应模型,支持二次验证
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
from typing import Any, Literal, NotRequired, TypedDict
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ruff: noqa: ARG002
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from enum import Enum
|
||||
@@ -161,7 +160,7 @@ class ChannelMessageTeam(ChannelMessageBase):
|
||||
cls,
|
||||
message: "ChatMessage",
|
||||
user: "User",
|
||||
) -> ChannelMessageTeam:
|
||||
) -> Self:
|
||||
from app.database import ChannelType
|
||||
|
||||
return super().init(message, user, [], ChannelType.TEAM)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# OAuth 相关模型 # noqa: I002
|
||||
# OAuth 相关模型
|
||||
from typing import Annotated, Any, cast
|
||||
from typing_extensions import Doc
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from app.models.mods import APIMod
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, Literal, TypedDict, cast
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from app.log import log
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import NotRequired, TypedDict
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
用户页面编辑相关的API模型
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""V1 API 用户相关模型"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
STATIC_DIR = Path(__file__).parent.parent / "static"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .room import create_playlist_room, create_playlist_room_from_api
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
提供从osu!官方获取beatmapset音频预览并缓存的功能
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.log import logger
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
@@ -4,8 +4,6 @@ BBCode处理服务
|
||||
支持所有 osu! 官方 BBCode 标签
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import html
|
||||
import re
|
||||
from typing import ClassVar
|
||||
|
||||
@@ -3,8 +3,6 @@ Beatmap缓存预取服务
|
||||
用于提前缓存热门beatmap,减少成绩计算时的获取延迟
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
@@ -3,8 +3,6 @@ Beatmapset缓存服务
|
||||
用于缓存beatmapset数据,减少数据库查询频率
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
from enum import Enum
|
||||
import math
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
数据库清理服务 - 清理过期的验证码和会话
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from app.database.auth import OAuthToken
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
用于异步发送邮件
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import concurrent.futures
|
||||
from datetime import datetime
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
邮件验证服务
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
import secrets
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
用户登录记录服务
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
|
||||
from app.database.user_login_log import UserLoginLog
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
密码重置服务
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
import json
|
||||
import secrets
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
用于缓存用户排行榜数据,减轻数据库压力
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
- 支持消息状态同步和故障恢复
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from datetime import datetime
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from app.database.beatmap import Beatmap
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable, Callable
|
||||
from fnmatch import fnmatch
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from app.log import log
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
用于缓存用户信息,提供热缓存和实时刷新功能
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
import json
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
邮件验证管理服务
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import secrets
|
||||
import string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ruff: noqa: F401
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from . import (
|
||||
beatmapset_update,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from app.dependencies.scheduler import get_scheduler
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""缓存相关的 APScheduler 任务入口。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import UTC, timedelta
|
||||
from typing import Final
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from app.database import RankHistory, UserStatistics
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.const import BANCHOBOT_ID
|
||||
from app.database.statistics import UserStatistics
|
||||
from app.database.user import User
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import UTC, timedelta
|
||||
import json
|
||||
from math import ceil
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.dependencies.database import with_db
|
||||
from app.dependencies.scheduler import get_scheduler
|
||||
from app.log import logger
|
||||
|
||||
@@ -3,8 +3,6 @@ Scheduled Update Service
|
||||
Periodically update the MaxMind GeoIP database
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.config import settings
|
||||
from app.dependencies.geoip import get_geoip_helper
|
||||
from app.dependencies.scheduler import get_scheduler
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
|
||||
from app.log import logger
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.config import settings
|
||||
from app.const import BANCHOBOT_ID
|
||||
from app.database.statistics import UserStatistics
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.calculator import pre_fetch_and_calculate_pp
|
||||
from app.database.score import Score, calculate_user_pp
|
||||
from app.database.statistics import UserStatistics
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable, Callable, Sequence
|
||||
from datetime import UTC, datetime
|
||||
|
||||
2
main.py
2
main.py
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from logging.config import fileConfig
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-10 06:10:08.093591
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-10 14:07:51.749025
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-10 04:30:58.443568
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-11 11:47:11.004301
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-11 08:03:33.739398
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-12 15:12:49.860825
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-12 09:29:12.085060
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -6,8 +6,6 @@ Create Date: 2025-08-12 13:31:45.315844
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user