misc: drop typing as T, use builtin generics

Python 3.10 is the minimum, so annotations use `X | None`, `list[X]`
and friends, enforced by ruff's pyupgrade rules. The remaining typing
names are imported directly, with abstract types coming from
collections.abc. first() is now generic over the item and default.
This commit is contained in:
Dash committed 2026-10-17 15:55:55 +02:00
1 parent ada8d5b6ed
commit 0a4358e2b8
40 files changed
+248 -236

No files matched your search

+2 -3
View File
@@ -1,5 +1,4 @@
import datetime
import typing as T
from pathlib import Path
from pqcli import random
@@ -20,7 +19,7 @@ STATS = {
}
def run_trace(seed: str, ticks: int = 3000) -> T.List[str]:
def run_trace(seed: str, ticks: int = 3000) -> list[str]:
"""Play a deterministic game and return everything that happened."""
data = load_game_data()
player = Player(
@@ -34,7 +33,7 @@ def run_trace(seed: str, ticks: int = 3000) -> T.List[str]:
random.seed(seed)
simulation = Simulation(player, data)
lines: T.List[str] = []
lines: list[str] = []
player.connect(
"new_task",
lambda: lines.append(f"task: {player.task.description}"),