mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
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:
40 files changed
+248
-236
No files matched your search
+2
-3
@@ -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}"),
|
||||
|
||||
Reference in new issue
Block a user