diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ea11c3..50017bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ fail_fast: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-toml - id: check-yaml @@ -19,20 +19,20 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/psf/black - rev: 25.1.0 + rev: 25.9.0 hooks: - id: black args: [--config=pyproject.toml] - repo: https://github.com/charliermarsh/ruff-pre-commit # Ruff version. - rev: "v0.11.4" + rev: "v0.13.2" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, "--config=pyproject.toml"] # enable autofix - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.18.2 hooks: - id: mypy args: ["--config-file=pyproject.toml"] @@ -48,7 +48,7 @@ repos: pass_filenames: false - repo: https://github.com/PyCQA/bandit - rev: 1.8.3 + rev: 1.8.6 hooks: - id: bandit args: ["--config=pyproject.toml"] diff --git a/chess_agent/core/schemas.py b/chess_agent/core/schemas.py index 13abbcd..5b788cd 100644 --- a/chess_agent/core/schemas.py +++ b/chess_agent/core/schemas.py @@ -2,11 +2,10 @@ import datetime from enum import StrEnum -from typing import Optional from pydantic import BaseModel, Field -PlayerInfo = dict[str, Optional[int | str | bool]] +PlayerInfo = dict[str, int | str | bool | None] GAME_EXPLANATION = """You are the Black side in every game, meaning that you will always @@ -108,8 +107,8 @@ class CreatedGamePerson(BaseModel): id: str url: str status: str - challenger: dict[str, Optional[str | int]] - dest_user: dict[str, Optional[str | int]] = Field(alias="destUser") + challenger: dict[str, str | int | None] + dest_user: dict[str, str | int | None] = Field(alias="destUser") variant: dict[str, str] time_control: dict[str, str] = Field(alias="timeControl") color: str diff --git a/chess_agent/server.py b/chess_agent/server.py index fb1329d..6fa09df 100644 --- a/chess_agent/server.py +++ b/chess_agent/server.py @@ -9,7 +9,7 @@ import logging import os from collections.abc import Callable -from typing import Any, Optional, cast +from typing import Any, cast from berserk import Client, TokenSession, exceptions from chess import Board @@ -70,7 +70,7 @@ async def login() -> None: Args: api_key: The API key to use for logging in. """ - api_key: Optional[str] = os.getenv("API_KEY") + api_key: str | None = os.getenv("API_KEY") if not api_key: raise ValueError( "API_KEY not found in environment variables. Please set it in your .env"