diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88898ca..447ce59 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.15.12 hooks: - - id: ruff + - id: ruff-check args: [--fix] - id: ruff-format - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.383 + rev: v1.1.409 hooks: - id: pyright diff --git a/pyproject.toml b/pyproject.toml index 1c3e138..03b6919 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,10 +6,10 @@ authors = [ ] description = "A copyright violation detector web tool for Wikipedia articles" readme = "README.md" -requires-python = ">=3.11" +requires-python = ">=3.13" dependencies = [ "earwigbot[sql,copyvios] >= 0.4", - "mwparserfromhell >= 0.6", + "mwparserfromhell >= 0.7", "flask >= 3.0", "requests >= 2.32.3", "pydantic >= 2.9.2", @@ -26,12 +26,12 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [tool.pyright] -pythonVersion = "3.11" +pythonVersion = "3.13" venvPath = "." venv = "venv" [tool.ruff] -target-version = "py311" +target-version = "py313" [tool.ruff.lint] select = ["E4", "E7", "E9", "F", "I", "UP"] diff --git a/src/copyvios/misc.py b/src/copyvios/misc.py index 53dc158..1b92518 100644 --- a/src/copyvios/misc.py +++ b/src/copyvios/misc.py @@ -11,7 +11,6 @@ import datetime import os import sqlite3 import urllib.parse -from typing import TypeVar import pymysql from flask import g, request @@ -20,8 +19,6 @@ from . import app from .cache import cache from .query import CheckQuery -T = TypeVar("T") - def get_sql_error() -> type[Exception]: match cache.engine.dialect.name: @@ -33,7 +30,7 @@ def get_sql_error() -> type[Exception]: raise ValueError(f"Unknown engine: {dialect}") -def sql_dialect(mysql: T, sqlite: T) -> T: +def sql_dialect[T](mysql: T, sqlite: T) -> T: match cache.engine.dialect.name: case "mysql": return mysql