From 3e669873b966f2ae8ecfd3c300fc04ac11b82864 Mon Sep 17 00:00:00 2001 From: MarTrepodi Date: Tue, 13 Oct 2026 10:37:34 -0400 Subject: [PATCH 1/2] style(examples): remove unused imports and a dead variable Applies ruff's safe fixes for F401 and I001 in the examples, and drops the never-read fetch_times list in streaming_guild_roster_advanced.py. Co-Authored-By: Claude Opus 5.5 --- examples/Async/calc_stats_local.py | 2 +- examples/Async/concurrent_requests.py | 1 - examples/Async/get_events.py | 1 - examples/Async/get_player_arena_profile.py | 1 - examples/Async/streaming_guild_roster_advanced.py | 2 -- examples/Sync/calc_stats_local.py | 2 +- examples/Sync/get_player_arena_profile.py | 2 +- 7 files changed, 3 insertions(+), 8 deletions(-) diff --git a/examples/Async/calc_stats_local.py b/examples/Async/calc_stats_local.py index cf5a55d..b33c4e8 100644 --- a/examples/Async/calc_stats_local.py +++ b/examples/Async/calc_stats_local.py @@ -11,7 +11,7 @@ import asyncio -from swgoh_comlink import SwgohComlinkAsync, StatCalcAsync, GameDataBuilderAsync +from swgoh_comlink import StatCalcAsync async def main(): diff --git a/examples/Async/concurrent_requests.py b/examples/Async/concurrent_requests.py index 9c7a288..f12ed8d 100644 --- a/examples/Async/concurrent_requests.py +++ b/examples/Async/concurrent_requests.py @@ -9,7 +9,6 @@ from swgoh_comlink import SwgohComlinkAsync - # Example ally codes to fetch concurrently ALLY_CODES = [ 314927874, diff --git a/examples/Async/get_events.py b/examples/Async/get_events.py index 219bde2..079ef7f 100644 --- a/examples/Async/get_events.py +++ b/examples/Async/get_events.py @@ -5,7 +5,6 @@ import asyncio from datetime import datetime, timezone -from typing import Union from swgoh_comlink import SwgohComlinkAsync diff --git a/examples/Async/get_player_arena_profile.py b/examples/Async/get_player_arena_profile.py index 7c4184a..2fcec32 100644 --- a/examples/Async/get_player_arena_profile.py +++ b/examples/Async/get_player_arena_profile.py @@ -7,7 +7,6 @@ # Place module imports below this line from swgoh_comlink import SwgohComlinkAsync -from pprint import pprint as pp async def main(): diff --git a/examples/Async/streaming_guild_roster_advanced.py b/examples/Async/streaming_guild_roster_advanced.py index 34fb75b..21ae98f 100644 --- a/examples/Async/streaming_guild_roster_advanced.py +++ b/examples/Async/streaming_guild_roster_advanced.py @@ -28,7 +28,6 @@ import argparse import asyncio -import statistics import time from swgoh_comlink import SwgohComlinkAsync @@ -225,7 +224,6 @@ async def main(): print(f"Fetching {total} member profiles (max {args.retries} retries each)...\n") # Step 3: Fetch all members concurrently using TaskGroup - fetch_times: list[float] = [] results: list[dict | None] = [] overall_start = time.perf_counter() diff --git a/examples/Sync/calc_stats_local.py b/examples/Sync/calc_stats_local.py index 15c1d4d..beb336f 100644 --- a/examples/Sync/calc_stats_local.py +++ b/examples/Sync/calc_stats_local.py @@ -9,7 +9,7 @@ 4. GameDataBuilder — fetches data dynamically from a running Comlink service """ -from swgoh_comlink import SwgohComlink, StatCalc, GameDataBuilder +from swgoh_comlink import StatCalc # --- Example 1: Basic unit (no skills or mods) --- basic_unit = { diff --git a/examples/Sync/get_player_arena_profile.py b/examples/Sync/get_player_arena_profile.py index 5767beb..cf2f690 100644 --- a/examples/Sync/get_player_arena_profile.py +++ b/examples/Sync/get_player_arena_profile.py @@ -4,8 +4,8 @@ """ # Place module imports below this line + from swgoh_comlink import SwgohComlink -from pprint import pprint as pp # create an instance of a SwgohComlink object comlink = SwgohComlink() From 5e70872c6b18fe6146ce698526163c5d21d36007 Mon Sep 17 00:00:00 2001 From: MarTrepodi Date: Tue, 13 Oct 2026 10:37:37 -0400 Subject: [PATCH 2/2] ci(examples): lint examples in CI and pre-commit examples/ was excluded from ruff check, so its findings were never seen. The remaining F841 hits assign a call's result to a named variable to show what the call returns, so ignore F841 under examples/ only and lint the rest of the directory in both the pre-commit hook and the CI job. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 3 +-- .pre-commit-config.yaml | 1 - pyproject.toml | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a086a57..74401d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,8 +34,7 @@ jobs: run: uv sync --locked --only-group lint - name: Run Ruff linter - # examples/ is excluded, matching the pre-commit ruff hook - run: uv run --no-sync ruff check src/ tests/ parity/ + run: uv run --no-sync ruff check src/ tests/ examples/ parity/ - name: Run Ruff formatter check run: uv run --no-sync ruff format --check src/ tests/ examples/ parity/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 350468e..4d5a019 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,6 @@ repos: name: ruff check entry: uv run ruff check --fix --force-exclude language: system - exclude: ^examples/ types: [python] require_serial: true - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 7063090..0297699 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,6 +166,8 @@ ignore = [ # Existing violations to address incrementally — do not add new suppressions "src/swgoh_comlink/__init__.py" = ["UP036"] # outdated version block (sys.exit check) "src/swgoh_comlink/helpers/*.py" = ["B007", "B904", "SIM102"] # existing patterns to clean up +# Examples assign results to named variables to show what each call returns +"examples/**" = ["F841"] [tool.ruff.lint.isort] known-first-party = ["swgoh_comlink"]