Skip to content

The agent that grows with you

ci: fix PLC0206, PLC0414 linter errors

Maciej Lisiewski7ef490ed3b16
diff --git a/evals/provider_wire/issue_103944.py b/evals/provider_wire/issue_103944.py
index 453ef794503..46652dac07b 100644
--- a/evals/provider_wire/issue_103944.py
+++ b/evals/provider_wire/issue_103944.py
@@ -102,7 +102,7 @@ from agent.transports.chat_completions import ChatCompletionsTransport
loaded = get_compatible_custom_providers(load_config())
rows = []
for provider in ["custom:my-gateway", "custom"]:
- for model in models:
+ for model, model_spec in models.items():
agent = AIAgent(
model=model,
provider=provider,
@@ -124,7 +124,7 @@ for provider in ["custom:my-gateway", "custom"]:
rows.append({
"provider": agent.provider,
"model": agent.model,
- "declared_format": models[model].get("reasoning_format"),
+ "declared_format": model_spec.get("reasoning_format"),
"profile": None if profile is None else type(profile).__name__,
"agent_has_custom_models": any(
e.get("models") == models for e in agent._custom_providers
diff --git a/evals/toolperf_abeval/ab_eval.py b/evals/toolperf_abeval/ab_eval.py
index cf985b1e934..f28e8c65ba0 100644
--- a/evals/toolperf_abeval/ab_eval.py
+++ b/evals/toolperf_abeval/ab_eval.py
@@ -155,7 +155,7 @@ def run(arm: str, model: str, reps: int, pythonpath: str, only=None):
except (ValueError, KeyError):
continue
for rep in range(reps):
- for name in TASKS:
+ for name, task in TASKS.items():
if only and name not in only:
continue
run_id = f"{name}-r{rep}"
@@ -194,7 +194,7 @@ mode = "overwrite"
"HERMES_HOME": str(HOME),
"HERMES_NEMO_RELAY_PLUGINS_TOML": str(relay_config),
})
- q = TASKS[name].replace("{WORK}", str(work))
+ q = task.replace("{WORK}", str(work))
t0 = time.time()
try:
p = subprocess.run(
diff --git a/gateway/platforms/api_server.py b/gateway/platforms/api_server.py
index f28b6bf4f0f..8045b003177 100644
--- a/gateway/platforms/api_server.py
+++ b/gateway/platforms/api_server.py
@@ -1086,7 +1086,7 @@ def _notify_cron_provider_jobs_changed() -> None:
# endpoints are authenticated, so this is not the trust boundary). Optional import:
# a missing scanner must not disable the cron REST API.
try:
- from tools.cronjob_tools import _scan_cron_prompt as _scan_cron_prompt
+ from tools.cronjob_tools import _scan_cron_prompt
except Exception: # pragma: no cover - scanner is optional hardening
_scan_cron_prompt = None
diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.py
index 45c9aadd996..d9fe32427ba 100644
--- a/hermes_cli/anon_auth.py
+++ b/hermes_cli/anon_auth.py
@@ -1104,48 +1104,48 @@ def persist_nous_credentials(*args, **kwargs):
# Public sign-in imports remain here for existing callers and module-attribute patches.
# The flow imports this module only inside calls, so either module can be imported first.
from hermes_cli.anon_sign_in import (
- AlreadySignedIn as AlreadySignedIn,
- Code as Code,
- Completed as Completed,
- Declined as Declined,
- FREE_TIER_RATE_LIMIT_CARD as FREE_TIER_RATE_LIMIT_CARD,
- FREE_TIER_RATE_LIMIT_CHAT as FREE_TIER_RATE_LIMIT_CHAT,
- Failed as Failed,
- LOGIN_BUSY_ELSEWHERE as LOGIN_BUSY_ELSEWHERE,
- LOGIN_COMMAND as LOGIN_COMMAND,
- LOGIN_DM_ONLY as LOGIN_DM_ONLY,
- LOGIN_NOT_ALLOWED as LOGIN_NOT_ALLOWED,
- LOGIN_STARTING as LOGIN_STARTING,
- Retired as Retired,
- SignInState as SignInState,
- Superseded as Superseded,
- TimedOut as TimedOut,
- UPGRADE_ALREADY_SIGNED_IN as UPGRADE_ALREADY_SIGNED_IN,
- UPGRADE_CANCELLED as UPGRADE_CANCELLED,
- UPGRADE_DO_NOT_SHARE as UPGRADE_DO_NOT_SHARE,
- UPGRADE_NOT_COMPLETED as UPGRADE_NOT_COMPLETED,
- UPGRADE_NO_DEFAULT_CHAT as UPGRADE_NO_DEFAULT_CHAT,
- UPGRADE_NO_DEFAULT_TERMINAL as UPGRADE_NO_DEFAULT_TERMINAL,
- UPGRADE_REASON_COPY as UPGRADE_REASON_COPY,
- UPGRADE_START as UPGRADE_START,
- UPGRADE_TIMED_OUT as UPGRADE_TIMED_OUT,
- UPGRADE_UNAVAILABLE as UPGRADE_UNAVAILABLE,
- UPGRADE_UNAVAILABLE_CHAT as UPGRADE_UNAVAILABLE_CHAT,
- UPGRADE_WAITING as UPGRADE_WAITING,
- UPGRADE_WAITING_UP_TO as UPGRADE_WAITING_UP_TO,
- Unavailable as Unavailable,
- Waiting as Waiting,
- _RETIRED_REASONS as _RETIRED_REASONS,
- _default_persist_guard as _default_persist_guard,
- _outcome_state as _outcome_state,
- format_wait_line as format_wait_line,
- run_sign_in as run_sign_in,
+ AlreadySignedIn,
+ Code,
+ Completed,
+ Declined,
+ FREE_TIER_RATE_LIMIT_CARD,
+ FREE_TIER_RATE_LIMIT_CHAT,
+ Failed,
+ LOGIN_BUSY_ELSEWHERE,
+ LOGIN_COMMAND,
+ LOGIN_DM_ONLY,
+ LOGIN_NOT_ALLOWED,
+ LOGIN_STARTING,
+ Retired,
+ SignInState,
+ Superseded,
+ TimedOut,
+ UPGRADE_ALREADY_SIGNED_IN,
+ UPGRADE_CANCELLED,
+ UPGRADE_DO_NOT_SHARE,
+ UPGRADE_NOT_COMPLETED,
+ UPGRADE_NO_DEFAULT_CHAT,
+ UPGRADE_NO_DEFAULT_TERMINAL,
+ UPGRADE_REASON_COPY,
+ UPGRADE_START,
+ UPGRADE_TIMED_OUT,
+ UPGRADE_UNAVAILABLE,
+ UPGRADE_UNAVAILABLE_CHAT,
+ UPGRADE_WAITING,
+ UPGRADE_WAITING_UP_TO,
+ Unavailable,
+ Waiting,
+ _RETIRED_REASONS,
+ _default_persist_guard,
+ _outcome_state,
+ format_wait_line,
+ run_sign_in,
)
from hermes_cli.anon_sign_in_cli import (
- drain_sign_in_copy as drain_sign_in_copy,
- render_sign_in_cli as render_sign_in_cli,
- render_sign_in_cli_code as render_sign_in_cli_code,
- upgrade_guest as upgrade_guest,
+ drain_sign_in_copy,
+ render_sign_in_cli,
+ render_sign_in_cli_code,
+ upgrade_guest,
)
FREE_TIER_STATUS_LINE = f"{FREE_TIER_LABEL} \u00b7 {GUEST_MODEL} \u00b7 {LOGIN_COMMAND} to sign in"
diff --git a/hermes_yaml.py b/hermes_yaml.py
index bae447df100..4cd43d3cbda 100644
--- a/hermes_yaml.py
+++ b/hermes_yaml.py
@@ -8,7 +8,7 @@ from io import StringIO
from typing import Any, IO, overload
from ruamel.yaml import YAML
-from ruamel.yaml.error import YAMLError as YAMLError
+from ruamel.yaml.error import YAMLError
from ruamel.yaml.resolver import VersionedResolver
diff --git a/ruff.strict.toml b/ruff.strict.toml
index 4213caa5613..9b627b92a1d 100644
--- a/ruff.strict.toml
+++ b/ruff.strict.toml
@@ -284,9 +284,9 @@ select = [
"PLC0131",
"PLC0132",
"PLC0205",
- # "PLC0206",
+ "PLC0206",
"PLC0208",
- # "PLC0414",
+ "PLC0414",
"PLC3002",
"PLE0100",
"PLE0101",
diff --git a/skills/productivity/google-workspace/scripts/_hermes_home.py b/skills/productivity/google-workspace/scripts/_hermes_home.py
index e50741fa6c7..b2d7606862b 100644
--- a/skills/productivity/google-workspace/scripts/_hermes_home.py
+++ b/skills/productivity/google-workspace/scripts/_hermes_home.py
@@ -20,8 +20,8 @@ import os
from pathlib import Path
try:
- from hermes_constants import display_hermes_home as display_hermes_home
- from hermes_constants import get_hermes_home as get_hermes_home
+ from hermes_constants import display_hermes_home
+ from hermes_constants import get_hermes_home
except (ModuleNotFoundError, ImportError):
def get_hermes_home() -> Path:
diff --git a/skills/research/grounded-citations/scripts/_hermes_home.py b/skills/research/grounded-citations/scripts/_hermes_home.py
index 45ed49d3773..072f4680c4f 100644
--- a/skills/research/grounded-citations/scripts/_hermes_home.py
+++ b/skills/research/grounded-citations/scripts/_hermes_home.py
@@ -14,7 +14,7 @@ import os
from pathlib import Path
try:
- from hermes_constants import get_hermes_home as get_hermes_home
+ from hermes_constants import get_hermes_home
except (ModuleNotFoundError, ImportError):
def get_hermes_home() -> Path:
diff --git a/tests/e2e/core/history/_helpers.py b/tests/e2e/core/history/_helpers.py
index 155a0c1f49a..7edf42a59ec 100644
--- a/tests/e2e/core/history/_helpers.py
+++ b/tests/e2e/core/history/_helpers.py
@@ -247,9 +247,9 @@ def tools_diff(a: Any, b: Any) -> str:
bn = {t["function"]["name"]: canon(t) for t in b or ()}
if list(an) != list(bn):
return f"names/order differ: -{sorted(set(an) - set(bn))} +{sorted(set(bn) - set(an))}"
- for name in an:
- if an[name] != bn[name]:
- return f"tool {name!r}: {first_divergence(an[name], bn[name])}"
+ for name, a_tool in an.items():
+ if a_tool != bn[name]:
+ return f"tool {name!r}: {first_divergence(a_tool, bn[name])}"
return "?"
diff --git a/tests/hermes_cli/plugin_worker_support.py b/tests/hermes_cli/plugin_worker_support.py
index 055c5f36374..0136e00d03c 100644
--- a/tests/hermes_cli/plugin_worker_support.py
+++ b/tests/hermes_cli/plugin_worker_support.py
@@ -18,7 +18,7 @@ import sys
import pytest
import hermes_yaml as yaml
-from tests.pm._fixtures import _wheel, isolated_python as isolated_python
+from tests.pm._fixtures import _wheel, isolated_python as isolated_python # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
def worker_command(worker: Path, uv: str, python: str, *, prelude: str = "", runtime_python: str | None = None) -> list[str]:
diff --git a/tests/hermes_cli/test_enable_no_capabilities.py b/tests/hermes_cli/test_enable_no_capabilities.py
index 71c92ceb54e..a64b971e5c3 100644
--- a/tests/hermes_cli/test_enable_no_capabilities.py
+++ b/tests/hermes_cli/test_enable_no_capabilities.py
@@ -5,8 +5,8 @@ import pytest
import hermes_yaml as yaml
from tests.hermes_cli.plugin_worker_support import (
- isolated_python as isolated_python,
- plugin_world as plugin_world,
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_npm_engine.py b/tests/hermes_cli/test_npm_engine.py
index e58885c8cff..3c1a37315bc 100644
--- a/tests/hermes_cli/test_npm_engine.py
+++ b/tests/hermes_cli/test_npm_engine.py
@@ -4,8 +4,8 @@ import pytest
from hermes_cli.npm_engine import maybe_repair_npm_engine
from tests.compat.old_updater_support import (
- fresh_child as fresh_child,
- no_external_work as no_external_work,
+ fresh_child as fresh_child, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ no_external_work as no_external_work, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_old_updater_additional_shims.py b/tests/hermes_cli/test_old_updater_additional_shims.py
index eede7d25df6..9c949cde296 100644
--- a/tests/hermes_cli/test_old_updater_additional_shims.py
+++ b/tests/hermes_cli/test_old_updater_additional_shims.py
@@ -10,8 +10,8 @@ from types import SimpleNamespace
import pytest
from tests.compat.old_updater_support import (
- fresh_child as fresh_child,
- no_external_work as no_external_work,
+ fresh_child as fresh_child, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ no_external_work as no_external_work, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_old_updater_main_shims.py b/tests/hermes_cli/test_old_updater_main_shims.py
index 48428083f99..4d872a17f3b 100644
--- a/tests/hermes_cli/test_old_updater_main_shims.py
+++ b/tests/hermes_cli/test_old_updater_main_shims.py
@@ -5,7 +5,7 @@ from pathlib import Path
import pytest
from tests.compat.old_updater_support import (
- no_external_work as no_external_work,
+ no_external_work as no_external_work, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_old_updater_shims.py b/tests/hermes_cli/test_old_updater_shims.py
index 5c517d963d5..a9d0d82b2b1 100644
--- a/tests/hermes_cli/test_old_updater_shims.py
+++ b/tests/hermes_cli/test_old_updater_shims.py
@@ -11,8 +11,8 @@ from types import SimpleNamespace
import pytest
from tests.compat.old_updater_support import (
- fresh_child as fresh_child,
- no_external_work as no_external_work,
+ fresh_child as fresh_child, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ no_external_work as no_external_work, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_plugin_install_ref.py b/tests/hermes_cli/test_plugin_install_ref.py
index 5f879add763..902549c1f0b 100644
--- a/tests/hermes_cli/test_plugin_install_ref.py
+++ b/tests/hermes_cli/test_plugin_install_ref.py
@@ -9,8 +9,8 @@ from pathlib import Path
import pytest
from tests.hermes_cli.plugin_worker_support import (
- isolated_python as isolated_python,
- plugin_world as plugin_world,
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
import hermes_yaml as yaml
diff --git a/tests/hermes_cli/test_plugin_worker_lifecycle.py b/tests/hermes_cli/test_plugin_worker_lifecycle.py
index e90dfd2d94d..12bfff2d00f 100644
--- a/tests/hermes_cli/test_plugin_worker_lifecycle.py
+++ b/tests/hermes_cli/test_plugin_worker_lifecycle.py
@@ -4,8 +4,8 @@ from __future__ import annotations
import pytest
from tests.hermes_cli.plugin_worker_support import (
- plugin_world as plugin_world,
- isolated_python as isolated_python,
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_plugins_admission_setter.py b/tests/hermes_cli/test_plugins_admission_setter.py
index 39a9a6c8ba4..ed34476a0ec 100644
--- a/tests/hermes_cli/test_plugins_admission_setter.py
+++ b/tests/hermes_cli/test_plugins_admission_setter.py
@@ -5,9 +5,9 @@ import sys
import pytest
from tests.hermes_cli.plugin_worker_support import (
- plugin_world as plugin_world,
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
worker_command,
- isolated_python as isolated_python,
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_plugins_cmd_enable_disable_nested.py b/tests/hermes_cli/test_plugins_cmd_enable_disable_nested.py
index c98b2eb3711..60b42b3e33b 100644
--- a/tests/hermes_cli/test_plugins_cmd_enable_disable_nested.py
+++ b/tests/hermes_cli/test_plugins_cmd_enable_disable_nested.py
@@ -5,8 +5,8 @@ import pytest
import hermes_yaml as yaml
from tests.hermes_cli.plugin_worker_support import (
- plugin_world as plugin_world,
- isolated_python as isolated_python,
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_plugins_picker_effective_state.py b/tests/hermes_cli/test_plugins_picker_effective_state.py
index 40cf8bc59fd..46409b67950 100644
--- a/tests/hermes_cli/test_plugins_picker_effective_state.py
+++ b/tests/hermes_cli/test_plugins_picker_effective_state.py
@@ -9,8 +9,8 @@ import pytest
import hermes_yaml as yaml
from tests.hermes_cli.plugin_worker_support import (
- plugin_world as plugin_world,
- isolated_python as isolated_python,
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/hermes_cli/test_update_venv_holder_retirement.py b/tests/hermes_cli/test_update_venv_holder_retirement.py
index bcc199d9e34..a381dded21e 100644
--- a/tests/hermes_cli/test_update_venv_holder_retirement.py
+++ b/tests/hermes_cli/test_update_venv_holder_retirement.py
@@ -9,7 +9,7 @@ from unittest.mock import Mock
import pytest
from hermes_cli import main, update_cmd, update_cmd_windows
-from tests.compat.old_updater_support import fresh_child as fresh_child, no_external_work as no_external_work
+from tests.compat.old_updater_support import fresh_child as fresh_child, no_external_work as no_external_work # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
@pytest.mark.real_concurrent_gate
diff --git a/tests/pm/test_build_operations.py b/tests/pm/test_build_operations.py
index f45594955d1..ae6b3a5a561 100644
--- a/tests/pm/test_build_operations.py
+++ b/tests/pm/test_build_operations.py
@@ -12,10 +12,10 @@ from pm.package import InstallError
from tests.pm._fixtures import (
_run,
_wheel,
- build_worker as build_worker,
- client as client,
- isolated_python as isolated_python,
- served as served,
+ build_worker as build_worker, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ client as client, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ served as served, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/pm/test_darwin_build.py b/tests/pm/test_darwin_build.py
index 7e0b9aa80a0..121647994bf 100644
--- a/tests/pm/test_darwin_build.py
+++ b/tests/pm/test_darwin_build.py
@@ -9,7 +9,7 @@ import tarfile
import pytest
-from tests.pm._fixtures import build_worker as build_worker, client as client, isolated_python as isolated_python
+from tests.pm._fixtures import build_worker as build_worker, client as client, isolated_python as isolated_python # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
@pytest.mark.platforms("macos")
diff --git a/tests/pm/test_downloader.py b/tests/pm/test_downloader.py
index a6899bc932b..e040c4d3468 100644
--- a/tests/pm/test_downloader.py
+++ b/tests/pm/test_downloader.py
@@ -20,7 +20,7 @@ from pm.downloader import (Download, DownloadError, DownloadPaused,
HashError, Source, replace_when_released)
from tests.pm._range_server import RangeHandler as _Handler, url as _url
-from tests.pm._range_server import dl_server as dl_server
+from tests.pm._range_server import dl_server as dl_server # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
def _payload(n: int, seed: bytes = b"x") -> bytes:
diff --git a/tests/pm/test_environment_build.py b/tests/pm/test_environment_build.py
index 431636ccfb6..61b9dda2571 100644
--- a/tests/pm/test_environment_build.py
+++ b/tests/pm/test_environment_build.py
@@ -14,9 +14,9 @@ from pm.plugin_inputs import Members
from tests.pm._fixtures import (
_run,
_wheel,
- build_worker as build_worker,
- client as client,
- isolated_python as isolated_python,
+ build_worker as build_worker, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ client as client, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
diff --git a/tests/pm/test_held_entry_windows_live.py b/tests/pm/test_held_entry_windows_live.py
index 886f808f4ab..5dcaa513dbc 100644
--- a/tests/pm/test_held_entry_windows_live.py
+++ b/tests/pm/test_held_entry_windows_live.py
@@ -15,8 +15,8 @@ from pathlib import Path
import pytest
from pm.lock import Facts
-from tests.pm.test_pm_core import pm_env as pm_env
-from tests.pm._fixtures import served as served
+from tests.pm.test_pm_core import pm_env as pm_env # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+from tests.pm._fixtures import served as served # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
@pytest.mark.platforms("windows")
diff --git a/tests/pm/test_pm_authority.py b/tests/pm/test_pm_authority.py
index 3a9d42ce802..2f0d267cfea 100644
--- a/tests/pm/test_pm_authority.py
+++ b/tests/pm/test_pm_authority.py
@@ -19,7 +19,7 @@ from pm import paths
from pm import registry
from pm.lock import Facts, Lockfile
from pm.store import Store, current_target, tree_digest
-from tests.pm._fixtures import make_tar, served as served
+from tests.pm._fixtures import make_tar, served as served # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
from tests.pm.test_pm_core import FakeTool, pm_env as core_env
diff --git a/tests/pm/test_pm_core.py b/tests/pm/test_pm_core.py
index fb5d836a2a1..9a1e073031f 100644
--- a/tests/pm/test_pm_core.py
+++ b/tests/pm/test_pm_core.py
@@ -19,7 +19,7 @@ from pm.lock import Facts, Lockfile
from pm.package import InstallError, compose_env
from pm.packages import BinaryPackage, Venv
from pm.store import Store, current_target
-from tests.pm._fixtures import make_tar, served as served
+from tests.pm._fixtures import make_tar, served as served # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
class FakeTool(BinaryPackage):
diff --git a/tests/pm/test_restart_needed.py b/tests/pm/test_restart_needed.py
index 06eeeaf19be..13e9eb1b67e 100644
--- a/tests/pm/test_restart_needed.py
+++ b/tests/pm/test_restart_needed.py
@@ -2,7 +2,7 @@
from __future__ import annotations
from tests.hermes_cli.plugin_worker_support import (
- boot as boot, isolated_python as isolated_python, plugin_world as plugin_world, publish_plugins)
+ boot as boot, isolated_python as isolated_python, plugin_world as plugin_world, publish_plugins) # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
def test_a_process_on_a_superseded_generation_needs_a_restart_until_it_adopts(plugin_world, boot):
diff --git a/tests/pm/test_security_consumers.py b/tests/pm/test_security_consumers.py
index cf48e9ba71c..03ca2bfb3d3 100644
--- a/tests/pm/test_security_consumers.py
+++ b/tests/pm/test_security_consumers.py
@@ -16,7 +16,7 @@ import pytest
import pm
from pm import paths
from tests.pm._range_server import RangeHandler, url
-from tests.pm._range_server import dl_server as dl_server
+from tests.pm._range_server import dl_server as dl_server # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
@pytest.fixture
diff --git a/tests/pm/test_startup_activation.py b/tests/pm/test_startup_activation.py
index c24b9f724cd..265fbd89c27 100644
--- a/tests/pm/test_startup_activation.py
+++ b/tests/pm/test_startup_activation.py
@@ -11,7 +11,7 @@ import pm
from pm import paths, registry
from pm.lock import Lockfile
from pm.packages import BinaryPackage
-from tests.pm._fixtures import make_tar, served as served
+from tests.pm._fixtures import make_tar, served as served # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
@pytest.fixture
diff --git a/tests/pm/test_store_resume.py b/tests/pm/test_store_resume.py
index d6562ef21fe..b867697e6f9 100644
--- a/tests/pm/test_store_resume.py
+++ b/tests/pm/test_store_resume.py
@@ -11,7 +11,7 @@ from pm.store import Store
from pm import paths
from tests.pm._range_server import RangeHandler as _Handler, url as _url
-from tests.pm._range_server import dl_server as dl_server
+from tests.pm._range_server import dl_server as dl_server # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
diff --git a/tests/pm/test_worker.py b/tests/pm/test_worker.py
index c10d63086cd..2a0e696ca1a 100644
--- a/tests/pm/test_worker.py
+++ b/tests/pm/test_worker.py
@@ -17,9 +17,9 @@ from tests.pm._range_server import RangeHandler, dl_server, url
from tests.pm.test_runtime_wheelhouse import locked_wheelhouse
from tests.pm._fixtures import (
_wheel,
- build_worker as build_worker,
- client as client,
- isolated_python as isolated_python,
+ build_worker as build_worker, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ client as client, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
# Spawns children with a home it builds itself; the parent's must stay real.
diff --git a/tests/pm/test_worker_observers.py b/tests/pm/test_worker_observers.py
index 1a86aea2a29..cc33cc7afab 100644
--- a/tests/pm/test_worker_observers.py
+++ b/tests/pm/test_worker_observers.py
@@ -9,8 +9,8 @@ import pytest
from pm import paths
from pm.lock import Facts
-from tests.pm._fixtures import client as client, isolated_python as isolated_python
-from tests.pm._range_server import dl_server as dl_server
+from tests.pm._fixtures import client as client, isolated_python as isolated_python # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+from tests.pm._range_server import dl_server as dl_server # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
from tests.pm.test_worker import _node_archive
diff --git a/tests/pm/test_worker_stdio.py b/tests/pm/test_worker_stdio.py
index b76a4b27341..3a9d5de9ee3 100644
--- a/tests/pm/test_worker_stdio.py
+++ b/tests/pm/test_worker_stdio.py
@@ -9,7 +9,7 @@ import textwrap
import pytest
-from tests.pm._fixtures import isolated_python as isolated_python
+from tests.pm._fixtures import isolated_python as isolated_python # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
@pytest.mark.parametrize("streaming", [False, True])
diff --git a/tests/scripts/test_fresh_source_install.py b/tests/scripts/test_fresh_source_install.py
index 3bd17b97578..4f4239b58f9 100644
--- a/tests/scripts/test_fresh_source_install.py
+++ b/tests/scripts/test_fresh_source_install.py
@@ -18,7 +18,7 @@ import tomllib
import pytest
from pm.store import current_target
-from tests.pm._fixtures import _wheel, served as served
+from tests.pm._fixtures import _wheel, served as served # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
ROOT = Path(__file__).resolve().parents[2]
diff --git a/tests/tools/test_file_operations.py b/tests/tools/test_file_operations.py
index 91945899000..9e8e29908cb 100644
--- a/tests/tools/test_file_operations.py
+++ b/tests/tools/test_file_operations.py
@@ -578,9 +578,9 @@ class TestPatchReplacePostWriteVerification:
def side_effect(command, **kwargs):
# the byte-exact read (base64 over the transport) — both the initial read and the verify read
if "base64 < " in command:
- for path in file_contents:
+ for path, contents in file_contents.items():
if path in command:
- return {"output": _fenced_base64_reply(command, file_contents[path].encode()),
+ return {"output": _fenced_base64_reply(command, contents.encode()),
"returncode": 0}
return {"output": "", "returncode": 1}
# mkdir for parent dir
@@ -588,9 +588,9 @@ class TestPatchReplacePostWriteVerification:
return {"output": "", "returncode": 0}
# wc -c for byte count after write
if command.startswith("if [ -f ") or command.startswith("wc -c"):
- for path in file_contents:
+ for path, contents in file_contents.items():
if path in command:
- return {"output": str(len(file_contents[path].encode())), "returncode": 0}
+ return {"output": str(len(contents.encode())), "returncode": 0}
return {"output": "0", "returncode": 0}
# Everything else (including the write itself) pretends to succeed
# but DOESN'T update file_contents — simulates silent failure
diff --git a/tests/tools/test_plugin_guard.py b/tests/tools/test_plugin_guard.py
index 3b0730d46a1..88b1ec6c95a 100644
--- a/tests/tools/test_plugin_guard.py
+++ b/tests/tools/test_plugin_guard.py
@@ -13,8 +13,8 @@ from pathlib import Path
import pytest
from tests.hermes_cli.plugin_worker_support import (
- isolated_python as isolated_python,
- plugin_world as plugin_world,
+ isolated_python as isolated_python, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+ plugin_world as plugin_world, # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
)
from tools.skills_guard import format_scan_report
from tools.plugin_guard import (
diff --git a/tools/delegate_tool_results.py b/tools/delegate_tool_results.py
index 640fe133294..e771e4dc1f2 100644
--- a/tools/delegate_tool_results.py
+++ b/tools/delegate_tool_results.py
@@ -346,7 +346,7 @@ def _fire_subagent_stop_hooks(results, child_by_index, parent_agent) -> float:
"""Pop the model-hidden ``_child_role`` / ``_child_cost_usd`` fields from every
entry, fire ``subagent_stop`` per child, and return the summed child cost."""
try:
- from hermes_cli.plugins import invoke_hook as invoke_hook
+ from hermes_cli.plugins import invoke_hook
except Exception:
invoke_hook = None
children_cost_total = 0.0
diff --git a/website/scripts/generate-skill-docs.py b/website/scripts/generate-skill-docs.py
index 4c6d4fdb535..bf5beaf56f7 100755
--- a/website/scripts/generate-skill-docs.py
+++ b/website/scripts/generate-skill-docs.py
@@ -469,8 +469,8 @@ def build_catalog_md_bundled(entries: list[tuple[dict[str, Any], dict[str, Any]]
if meta["source_kind"] != "bundled":
continue
by_cat[meta["category"]].append((meta, parsed))
- for k in by_cat:
- by_cat[k].sort(key=lambda e: e[0]["slug"])
+ for entries in by_cat.values():
+ entries.sort(key=lambda e: e[0]["slug"])
lines = [
"---",
@@ -515,8 +515,8 @@ def build_catalog_md_optional(entries: list[tuple[dict[str, Any], dict[str, Any]
if meta["source_kind"] != "optional":
continue
by_cat[meta["category"]].append((meta, parsed))
- for k in by_cat:
- by_cat[k].sort(key=lambda e: e[0]["slug"])
+ for entries in by_cat.values():
+ entries.sort(key=lambda e: e[0]["slug"])
lines = [
"---",