The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
ci: FURB188, FURB192 linter fixes
Maciej Lisiewski32b70e9733ac
diff --git a/acp_adapter/session.py b/acp_adapter/session.pyindex 14fb5327466..aac34a5e4b6 100644--- a/acp_adapter/session.py+++ b/acp_adapter/session.py@@ -74,7 +74,7 @@ def _updated_at_sort_key(value: Any) -> float:raw = str(value).strip() if value is not None else ""if not raw:return float("-inf")- for parse in (lambda s: datetime.fromisoformat(s.replace("Z", "+00:00")).timestamp(), float):+ for parse in (lambda s: datetime.fromisoformat(s).timestamp(), float):try:return parse(raw)except Exception:diff --git a/agent/agent_runtime_helpers.py b/agent/agent_runtime_helpers.pyindex f9a96d2d6fe..5fa0621663c 100644--- a/agent/agent_runtime_helpers.py+++ b/agent/agent_runtime_helpers.py@@ -3035,7 +3035,7 @@ def _pair_tool_calls_positionally(messages: list[dict[str, Any]]) -> list[dict[sif variants:# Key on a stable representative of the alias group so a result matching ANY# spelling can consume the call.- declared_calls[sorted(variants)[0]] = (tc, variants)+ declared_calls[min(variants)] = (tc, variants)elif role == "tool":result_variants = tool_result_id_variants(msg.get("tool_call_id"))matched = next((k for k, (_tc, v) in declared_calls.items() if v & result_variants), None)diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex 48445451250..edab7a47f52 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -748,8 +748,7 @@ def _fast_model_from_catalog(provider_id: str) -> str:base_url = base_url.rstrip("/")if not base_url:return ""- if base_url.endswith("/v1"): # fetch_models_with_pricing appends /v1/models- base_url = base_url[:-3]+ base_url = base_url.removesuffix("/v1")# Nous-only args must match the pickers' or the seeded cache loses sale chrome and# policy-catalog expiry._nous_kwargs = {}diff --git a/agent/chat_completion_helpers.py b/agent/chat_completion_helpers.pyindex 3d170f80518..ae234f95d65 100644--- a/agent/chat_completion_helpers.py+++ b/agent/chat_completion_helpers.py@@ -202,8 +202,7 @@ def _parse_provider_sse_events(text: str) -> list[dict]:current["fields"][field.strip().lower()] = ""continuefield = field.strip().lower()- if value.startswith(" "):- value = value[1:]+ value = value.removeprefix(" ")if field == "event":current["event"] = value.strip()elif field == "data":diff --git a/agent/credential_pool.py b/agent/credential_pool.pyindex e6f11e39653..ad726e3dbf3 100644--- a/agent/credential_pool.py+++ b/agent/credential_pool.py@@ -419,7 +419,7 @@ def _parse_absolute_timestamp(value: Any) -> Optional[float]:except ValueError:passtry:- return datetime.fromisoformat(raw.replace("Z", "+00:00")).timestamp()+ return datetime.fromisoformat(raw).timestamp()except ValueError:return Nonereturn Nonediff --git a/agent/gemini_native_adapter.py b/agent/gemini_native_adapter.pyindex 0cbbac4e028..bf4a5681355 100644--- a/agent/gemini_native_adapter.py+++ b/agent/gemini_native_adapter.py@@ -745,7 +745,7 @@ def translate_stream_event(event: dict[str, Any], model: str, tool_call_indices:last_arguments = slot["last_arguments"]slot["last_arguments"] = args_strdelta = {"index": slot["index"], "id": slot["id"], "name": name, "extra_content": _tool_call_extra_from_part(part),- "arguments": args_str[len(last_arguments):] if args_str.startswith(last_arguments) else args_str}+ "arguments": args_str.removeprefix(last_arguments)}chunks.append(_make_stream_chunk(model=model, tool_call_delta=delta))if finish_reason_raw := str(cand.get("finishReason") or ""):finish_reason = "tool_calls" if tool_call_indices else _FINISH_REASON_MAP.get(finish_reason_raw.upper(), "stop")diff --git a/agent/learning_graph.py b/agent/learning_graph.pyindex 0225c3572f5..5dda45b0705 100644--- a/agent/learning_graph.py+++ b/agent/learning_graph.py@@ -73,7 +73,7 @@ def _to_int_ts(value: Any) -> Optional[int]:try:return int(float(s))except ValueError:- parsed = datetime.fromisoformat(s.replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(s)return int((parsed if parsed.tzinfo is not None else parsed.replace(tzinfo=timezone.utc)).timestamp())except Exception:return Nonediff --git a/agent/model_metadata.py b/agent/model_metadata.pyindex c8244273952..ee240d805af 100644--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@ -533,7 +533,7 @@ def _lmstudio_server_root(base_url: str) -> str:def _server_root(base_url: str) -> str:"""Probe root for a local server: IPv4-resolved, ``/v1`` suffix stripped."""server_url = _localhost_to_ipv4(base_url.rstrip("/"))- return server_url[:-3] if server_url.endswith("/v1") else server_url+ return server_url.removesuffix("/v1")# Families whose generation digit is part of the name (``solar-mini`` vs ``solar-mini4``): their keysdiff --git a/agent/prompt_builder.py b/agent/prompt_builder.pyindex 4fbab82e788..ac42f82409e 100644--- a/agent/prompt_builder.py+++ b/agent/prompt_builder.py@@ -96,8 +96,7 @@ def _scan_context_content(content: str, filename: str, *, user_authored: bool =``load_soul_md`` passes ``user_authored=False`` when ``distribution.yaml`` owns the file)."""# A leading UTF-8 BOM is a Windows-editor artifact, not an injection.- if content.startswith("\ufeff"):- content = content[1:]+ content = content.removeprefix("\ufeff")findings = _scan_for_threats(content, scope="context")if not findings:return contentdiff --git a/agent/secret_scope.py b/agent/secret_scope.pyindex 5752cce0415..6175563e08a 100644--- a/agent/secret_scope.py+++ b/agent/secret_scope.py@@ -324,8 +324,7 @@ def invalidate_env_file_cache(env_path: Optional[Path] = None) -> None:def _decode_env_bytes(raw: bytes) -> str:"""BOM stripped; invalid UTF-8 falls back to latin-1 exactly as``env_loader._load_dotenv_with_fallback`` installs it into ``os.environ``."""- if raw.startswith(codecs.BOM_UTF8):- raw = raw[len(codecs.BOM_UTF8):]+ raw = raw.removeprefix(codecs.BOM_UTF8)try:return raw.decode("utf-8")except UnicodeDecodeError:diff --git a/agent/transports/codex_app_server_session.py b/agent/transports/codex_app_server_session.pyindex b6190292db0..5c7c9f671d1 100644--- a/agent/transports/codex_app_server_session.py+++ b/agent/transports/codex_app_server_session.py@@ -121,8 +121,7 @@ def _image_part_to_turn_input(item: dict) -> Optional[dict]:return Noneif ref.startswith(_IMAGE_URL_SCHEMES):return {"type": "image", "url": ref}- if ref.startswith("file://"):- ref = ref[len("file://"):]+ ref = ref.removeprefix("file://")return {"type": "localImage", "path": ref}diff --git a/agent/vault_login_classifier.py b/agent/vault_login_classifier.pyindex 50634b77089..8fe521a6159 100644--- a/agent/vault_login_classifier.py+++ b/agent/vault_login_classifier.py@@ -168,9 +168,7 @@ def select_password_fill(passwords = [c for c in classified if c.token == "current-password"]if not passwords or not password:return []- best_password = sorted(- passwords, key=lambda c: (-c.score, c.control.index)- )[0]+ best_password = min(passwords, key=lambda c: (-c.score, c.control.index))return [{"index": best_password.control.index,diff --git a/cron/jobs.py b/cron/jobs.pyindex d9c8383391a..e207ee1c51c 100644--- a/cron/jobs.py+++ b/cron/jobs.py@@ -816,7 +816,7 @@ def parse_schedule(schedule: str) -> dict[str, Any]:# ISO timestamp (contains T or looks like date)if 'T' in schedule or re.match(r'^\d{4}-\d{2}-\d{2}', schedule):try:- dt = datetime.fromisoformat(schedule.replace('Z', '+00:00'))+ dt = datetime.fromisoformat(schedule)# Naive timestamps become aware in the CONFIGURED Hermes timezone (not server-local):# the due-check compares against hermes_time.now().# Make naive timestamps timezone-aware at parse time so the stored value doesn't depend on thediff --git a/cron/lifecycle_guard.py b/cron/lifecycle_guard.pyindex 85ad8de4853..a6fa733e810 100644--- a/cron/lifecycle_guard.py+++ b/cron/lifecycle_guard.py@@ -129,8 +129,7 @@ def _pattern_reaches_host_interpreter(pattern: str, *, full_cmdline: bool, exactthat names the interpreter and then only wildcards or a `hermes` token reaches it, while`python mt_add.py` (a specific script) does not."""core = pattern.strip().strip("\"'").lstrip("^")- if core.endswith("$"):- core = core[:-1]+ core = core.removesuffix("$")head, _, rest = core.partition(" ") if full_cmdline else (core, "", "")# A literal interpreter name first (`python3.12`: the dot is a version separator, not an ERE# wildcard); only then read the head as an ERE with a metacharacter tail (`python3?`, `python.*`).diff --git a/evals/codebase_navigability/bench.py b/evals/codebase_navigability/bench.pyindex 307d41872ff..1deac70254e 100644--- a/evals/codebase_navigability/bench.py+++ b/evals/codebase_navigability/bench.py@@ -57,8 +57,7 @@ def source_modules(tree: Path) -> dict[str, Path]:if f.endswith(".py"):p = Path(dp) / fm = os.path.relpath(p, tree)[:-3].replace(os.sep, ".")- if m.endswith(".__init__"):- m = m[:-9]+ m = m.removesuffix(".__init__")mods[m] = preturn modsdiff --git a/evals/codebase_navigability/static_metrics.py b/evals/codebase_navigability/static_metrics.pyindex 25fb1b3cd6f..5b11ebb9355 100644--- a/evals/codebase_navigability/static_metrics.py+++ b/evals/codebase_navigability/static_metrics.py@@ -57,7 +57,7 @@ def analyse(files):try: tree = ast.parse(src)except Exception: m["unparsable"] = m.get("unparsable", 0) + 1; continuerel = os.path.relpath(p, TREE)[:-3].replace(os.sep, ".")- if rel.endswith(".__init__"): rel = rel[:-9]+ rel = rel.removesuffix(".__init__")mods[rel] = pfor n in ast.walk(tree):if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef)):diff --git a/gateway/relay/media.py b/gateway/relay/media.pyindex f9909514255..f3882c7e68c 100644--- a/gateway/relay/media.py+++ b/gateway/relay/media.py@@ -44,8 +44,7 @@ def media_base_url(relay_dial_url: str) -> str:raw = "http://" + raw[len("ws://") :]elif raw.startswith("wss://"):raw = "https://" + raw[len("wss://") :]- if raw.endswith("/relay"):- raw = raw[: -len("/relay")]+ raw = raw.removesuffix("/relay")return rawdiff --git a/gateway/run.py b/gateway/run.pyindex a459ce250b6..d7dfbb0825b 100644--- a/gateway/run.py+++ b/gateway/run.py@@ -925,7 +925,7 @@ def _coerce_gateway_timestamp(value: Any) -> Optional[float]:except ValueError:passtry:- return datetime.fromisoformat(text.replace("Z", "+00:00")).timestamp()+ return datetime.fromisoformat(text).timestamp()except ValueError:return Nonereturn Nonediff --git a/gateway/run_inbound.py b/gateway/run_inbound.pyindex e1929844e9b..049a6e58f4d 100644--- a/gateway/run_inbound.py+++ b/gateway/run_inbound.py@@ -64,7 +64,7 @@ def strip_discord_triggering_note(event: Any, message_text: Any) -> Any:if not message_id or not isinstance(message_text, str):return message_textprefix = f"{discord_triggering_note(message_id)}\n\n"- return message_text[len(prefix):] if message_text.startswith(prefix) else message_text+ return message_text.removeprefix(prefix)class GatewayInboundMixin(GatewayPluginInjectionMixin):diff --git a/gateway/stream_consumer.py b/gateway/stream_consumer.pyindex 774fd606ffe..061f3f3ba75 100644--- a/gateway/stream_consumer.py+++ b/gateway/stream_consumer.py@@ -771,7 +771,7 @@ class GatewayStreamConsumer(StreamTransportMixin, StreamFallbackMixin, StreamThi# preview later deltas extend, so a kept indicator ends up embedded mid-reply.tail = chunks[-1]indicator = f" ({len(chunks)}/{len(chunks)})"- self._accumulated = tail[: -len(indicator)] if tail.endswith(indicator) else tail+ self._accumulated = tail.removesuffix(indicator)# Flag BEFORE the tail send: fresh-final replaces every tracked preview# with one message, which is only valid while the active message holds# the whole answer — deleting sealed heads drops delivered text.diff --git a/hermes_cli/_early_recovery.py b/hermes_cli/_early_recovery.pyindex de795d9323c..a698c52ba7b 100644--- a/hermes_cli/_early_recovery.py+++ b/hermes_cli/_early_recovery.py@@ -576,7 +576,7 @@ def _git_program(arg0: str) -> str | None:Any directory (``/usr/lib/git-core/git-commit``), either separator, ``.exe`` and case folded:Windows runs ``git.exe`` and ``git-commit.exe``."""name = re.split(r"[\\/]", arg0.strip())[-1].lower()- name = name[:-4] if name.endswith(".exe") else name+ name = name.removesuffix(".exe")return name if name == "git" or name.startswith("git-") else Nonediff --git a/hermes_cli/auth_codex.py b/hermes_cli/auth_codex.pyindex 560ad60d4b2..4b9425d4b29 100644--- a/hermes_cli/auth_codex.py+++ b/hermes_cli/auth_codex.py@@ -726,8 +726,7 @@ def _codex_usage_probe_url(base_url: Optional[str]) -> str:module does not import the auxiliary account-usage module."""normalized = _stripped(base_url).rstrip("/") or _codex_base_url()- if normalized.endswith("/codex"):- normalized = normalized[: -len("/codex")]+ normalized = normalized.removesuffix("/codex")prefix = normalized + ("/wham" if "/backend-api" in normalized else "/api/codex")return prefix + "/usage"diff --git a/hermes_cli/cli_status_bar_mixin.py b/hermes_cli/cli_status_bar_mixin.pyindex 8044361b6ef..959d60f18f0 100644--- a/hermes_cli/cli_status_bar_mixin.py+++ b/hermes_cli/cli_status_bar_mixin.py@@ -202,8 +202,7 @@ class CLIStatusBarMixin:# Shared RID-prefix stripper so this and ModelSwitchResult can't drift.from hermes_cli.model_switch import format_model_for_displaymodel_short = format_model_for_display(model_short)- if model_short.endswith(".gguf"):- model_short = model_short[:-5]+ model_short = model_short.removesuffix(".gguf")if len(model_short) > 26:model_short = f"{model_short[:23]}..."diff --git a/hermes_cli/env_loader.py b/hermes_cli/env_loader.pyindex 8eb714e95ec..7dc5b3b231b 100644--- a/hermes_cli/env_loader.py+++ b/hermes_cli/env_loader.py@@ -337,8 +337,7 @@ def _load_dotenv_with_fallback(# first key name and silently drop it from os.environ under its canonical name.text = raw.decode("utf-8-sig")except UnicodeDecodeError:- if raw.startswith(codecs.BOM_UTF8): # strip the BOM by hand: utf-8-sig can't once we decode latin-1- raw = raw[len(codecs.BOM_UTF8) :]+ raw = raw.removeprefix(codecs.BOM_UTF8)text = raw.decode("latin-1")# Imported here, not at module level: gateway tests stub ``sys.modules["dotenv"]`` with a bare module# exposing only ``load_dotenv``, and ``gateway.run`` imports this module at import time.diff --git a/hermes_cli/gateway_windows.py b/hermes_cli/gateway_windows.pyindex 582da234dbe..2e2ad5107ec 100644--- a/hermes_cli/gateway_windows.py+++ b/hermes_cli/gateway_windows.py@@ -1570,7 +1570,7 @@ def _probe_state_file(state_path: Path) -> None:age_str = ""if updated_at:try:- updated_dt = datetime.fromisoformat(updated_at.replace("Z", "+00:00"))+ updated_dt = datetime.fromisoformat(updated_at)age_seconds = int((datetime.now(timezone.utc) - updated_dt).total_seconds())age_str = f" (updated {age_seconds}s ago)"except Exception:diff --git a/hermes_cli/kanban_db.py b/hermes_cli/kanban_db.pyindex c4245202d27..24e1fb78156 100644--- a/hermes_cli/kanban_db.py+++ b/hermes_cli/kanban_db.py@@ -4185,7 +4185,7 @@ def _to_epoch(val) -> Optional[int]:# ISO-8601 fallback (e.g. '2026-05-10T15:00:00Z')try:from datetime import datetime- dt = datetime.fromisoformat(s.replace("Z", "+00:00"))+ dt = datetime.fromisoformat(s)return int(dt.timestamp())except (ValueError, OSError):return Nonediff --git a/hermes_cli/main.py b/hermes_cli/main.pyindex 4fb618400d7..0af769a0778 100644--- a/hermes_cli/main.py+++ b/hermes_cli/main.py@@ -1060,10 +1060,7 @@ def _dotenv_has_provider_key(env_file: Path, provider_env_vars: set) -> bool:line = line.strip()if line.startswith("#") or "=" not in line:continue- if line.startswith("export "):- # Strip the bash-compatible ``export `` prefix so lines like ``export API_KEY=...`` parse as- # ``API_KEY`` rather than being stored under the wrong key ``"export API_KEY"`` (#6659).- line = line[7:]+ line = line.removeprefix("export ")key, _, val = line.partition("=")if key.strip() in provider_env_vars and val.strip().strip("'\""):return Truediff --git a/hermes_cli/main_install_repair.py b/hermes_cli/main_install_repair.pyindex 4578ee9abea..ace73696c44 100644--- a/hermes_cli/main_install_repair.py+++ b/hermes_cli/main_install_repair.py@@ -126,8 +126,7 @@ def _filter_pending_shim_renames(entries: list[str], shims: list[Path]) -> tupledef _norm(value: str) -> str:path = str(value).lstrip("!")- if path.startswith("\\??\\"):- path = path[4:]+ path = path.removeprefix("\\??\\")return ntpath.normcase(ntpath.normpath(path))shim_paths = {_norm(str(shim)) for shim in shims}diff --git a/hermes_cli/mcp_catalog.py b/hermes_cli/mcp_catalog.pyindex 488bfebeedd..fa8c8484c4b 100644--- a/hermes_cli/mcp_catalog.py+++ b/hermes_cli/mcp_catalog.py@@ -382,8 +382,7 @@ def catalog_diagnostics() -> list[tuple]:def get_entry(name: str) -> Optional[CatalogEntry]:"""Look up a single entry by name. ``official/<name>`` prefix accepted."""- if name.startswith("official/"):- name = name[len("official/"):]+ name = name.removeprefix("official/")return next((e for e in list_catalog() if e.name == name), None)diff --git a/hermes_cli/models_local.py b/hermes_cli/models_local.pyindex 9f0315e2d76..10c38f77c88 100644--- a/hermes_cli/models_local.py+++ b/hermes_cli/models_local.py@@ -593,8 +593,7 @@ def ollama_model_supports_thinking(import httpxserver_url = (base_url or "").strip().rstrip("/")- if server_url.endswith("/v1"):- server_url = server_url[:-3]+ server_url = server_url.removesuffix("/v1")bare_model = _strip_ollama_cloud_suffix((model or "").strip())if not server_url or not bare_model:return Nonediff --git a/hermes_cli/models_pricing.py b/hermes_cli/models_pricing.pyindex b887276d1bc..57807cbeb98 100644--- a/hermes_cli/models_pricing.py+++ b/hermes_cli/models_pricing.py@@ -324,8 +324,7 @@ def _resolve_nous_pricing_credentials() -> tuple[str, str]:except Exception:passbase_url = (env_base or creds_base or _DEFAULT_NOUS_INFERENCE_BASE).rstrip("/")- if base_url.endswith("/v1"):- base_url = base_url[:-3]+ base_url = base_url.removesuffix("/v1")return (api_key, base_url)diff --git a/hermes_cli/observability/shared_metrics.py b/hermes_cli/observability/shared_metrics.pyindex a67cf9b4eb6..62e092912ab 100644--- a/hermes_cli/observability/shared_metrics.py+++ b/hermes_cli/observability/shared_metrics.py@@ -552,7 +552,7 @@ class SharedMetricsStore:@staticmethoddef _parse_state_timestamp(value: Any) -> datetime | None:try:- parsed = datetime.fromisoformat(str(value).replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(str(value))except (TypeError, ValueError):return Nonereturn None if parsed.tzinfo is None else parsed.astimezone(timezone.utc)diff --git a/hermes_cli/observability/shared_metrics_sender.py b/hermes_cli/observability/shared_metrics_sender.pyindex 85c94c22fc7..adfc354374e 100644--- a/hermes_cli/observability/shared_metrics_sender.py+++ b/hermes_cli/observability/shared_metrics_sender.py@@ -70,7 +70,7 @@ MAX_OBS_ADVANCE_SECONDS = 30 * 24 * 3600def _parse_stamp(value: str) -> datetime:"""Parse a stamp this module itself wrote (Z-suffixed ISO-8601, UTC)."""- return datetime.fromisoformat(value.replace("Z", "+00:00")).astimezone(timezone.utc)+ return datetime.fromisoformat(value).astimezone(timezone.utc)@dataclassdiff --git a/hermes_cli/plugin_catalog.py b/hermes_cli/plugin_catalog.pyindex c60ab213c71..63a9466c1a7 100644--- a/hermes_cli/plugin_catalog.py+++ b/hermes_cli/plugin_catalog.py@@ -442,7 +442,7 @@ def _live_generated_time(data: dict[str, Any]) -> Optional[float]:return Nonetry:from datetime import datetime, timezone- parsed = datetime.fromisoformat(raw.replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(raw)return (parsed if parsed.tzinfo else parsed.replace(tzinfo=timezone.utc)).timestamp()except ValueError:return Nonediff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.pyindex 18cd5eece4c..d3c18e8cf5d 100644--- a/hermes_cli/profiles.py+++ b/hermes_cli/profiles.py@@ -1248,7 +1248,7 @@ def _junction_target(path: str) -> Optional[str]:# readlink hands back the substitute name; CreateJunction rejects the ``\\?\`` spelling.if target.startswith("\\\\?\\UNC\\"):return "\\" + target[7:]- return target[4:] if target.startswith("\\\\?\\") else target+ return target.removeprefix("\\\\?\\")def _copytree_keep_junctions(src: Path, dst: Path, ignore, dirs_exist_ok: bool = False) -> None:diff --git a/hermes_cli/service_manager.py b/hermes_cli/service_manager.pyindex f925c30b006..bb501c7bdc5 100644--- a/hermes_cli/service_manager.py+++ b/hermes_cli/service_manager.py@@ -230,7 +230,7 @@ S6_SERVICE_PREFIX = "gateway-"def _profile_from_service(name: str) -> str:"""Strip the ``gateway-`` prefix back off (matches what the user typed via ``-p``)."""- return name[len(S6_SERVICE_PREFIX):] if name.startswith(S6_SERVICE_PREFIX) else name+ return name.removeprefix(S6_SERVICE_PREFIX)def _profile_dir_for_gateway_service(name: str) -> Path:diff --git a/hermes_cli/source_check.py b/hermes_cli/source_check.pyindex 1c6e08d33fc..46118cec6cf 100644--- a/hermes_cli/source_check.py+++ b/hermes_cli/source_check.py@@ -181,7 +181,7 @@ def _commits(payload: dict | None) -> list[dict]:continuecommit = entry.get("commit") or {}when = (commit.get("committer") or {}).get("date") or ""- at = _quiet(lambda: int(datetime.fromisoformat(when.replace("Z", "+00:00")).timestamp() * 1000), 0)+ at = _quiet(lambda: int(datetime.fromisoformat(when).timestamp() * 1000), 0)rows.append({"sha": entry["sha"], "summary": str(commit.get("message", "")).split("\n", 1)[0],"author": str((commit.get("author") or {}).get("name", "")), "at": at})return rows[::-1]diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.pyindex f0cae2d9822..b1dc75dfa9b 100644--- a/hermes_cli/tools_config.py+++ b/hermes_cli/tools_config.py@@ -136,7 +136,7 @@ def _toolset_configuration_platform(ts_key: str, default: str = "cli") -> str:"""Platform a platform-less configuration UI should target: a toolset restricted away from ``default``must be configured on a supported platform, else the save helper drops it and the UI reports a no-op."""allowed = _TOOLSET_PLATFORM_RESTRICTIONS.get(ts_key)- return default if not allowed or default in allowed else sorted(allowed)[0]+ return default if not allowed or default in allowed else min(allowed)def _get_effective_configurable_toolsets():diff --git a/hermes_cli/update_cmd_git.py b/hermes_cli/update_cmd_git.pyindex 883f87e1707..48193957efe 100644--- a/hermes_cli/update_cmd_git.py+++ b/hermes_cli/update_cmd_git.py@@ -291,7 +291,7 @@ def _is_fork(origin_url: Optional[str]) -> bool:def _norm(url: str) -> str:url = url.rstrip("/")- return url[:-4] if url.endswith(".git") else url+ return url.removesuffix(".git")return _norm(origin_url) not in {_norm(official) for official in OFFICIAL_REPO_URLS}diff --git a/hermes_cli/update_cmd_maint.py b/hermes_cli/update_cmd_maint.pyindex c1e18c4d8be..e50d360bd4a 100644--- a/hermes_cli/update_cmd_maint.py+++ b/hermes_cli/update_cmd_maint.py@@ -238,7 +238,7 @@ def _format_time_ago(iso_ts: str) -> str:"""Render an ISO timestamp as `Xh ago` / `Xd ago` / `Xm ago`. Best effort."""try:from datetime import datetime, timezone- ts = datetime.fromisoformat(iso_ts.replace("Z", "+00:00"))+ ts = datetime.fromisoformat(iso_ts)if ts.tzinfo is None:ts = ts.replace(tzinfo=timezone.utc)secs = int((datetime.now(timezone.utc) - ts).total_seconds())diff --git a/hermes_cli/web_routers/cron.py b/hermes_cli/web_routers/cron.pyindex 2506034736f..ddc7fadcd26 100644--- a/hermes_cli/web_routers/cron.py+++ b/hermes_cli/web_routers/cron.py@@ -244,7 +244,7 @@ def _cron_job_last_run_timestamp(job: Optional[dict[str, Any]]) -> Optional[floaif not text:return Nonetry:- return datetime.fromisoformat(text.replace("Z", "+00:00")).timestamp()+ return datetime.fromisoformat(text).timestamp()except ValueError:return Nonereturn None@@ -282,7 +282,7 @@ def _iso_to_epoch(text: Any) -> Optional[float]:if not isinstance(text, str) or not text.strip():return Nonetry:- return datetime.fromisoformat(text.strip().replace("Z", "+00:00")).timestamp()+ return datetime.fromisoformat(text.strip()).timestamp()except ValueError:return Nonediff --git a/hermes_cli/web_routers/messaging.py b/hermes_cli/web_routers/messaging.pyindex bb50fa77c96..c25151b2298 100644--- a/hermes_cli/web_routers/messaging.py+++ b/hermes_cli/web_routers/messaging.py@@ -670,7 +670,7 @@ _TELEGRAM_INCOMPLETE_RESPONSE = "Telegram setup service returned an incomplete rdef _parse_expiry_ts(value: str) -> float:try:- parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(value)if parsed.tzinfo is None:parsed = parsed.replace(tzinfo=timezone.utc)return parsed.timestamp()diff --git a/hermes_state_maintenance.py b/hermes_state_maintenance.pyindex 8d512665a69..64ada03a77f 100644--- a/hermes_state_maintenance.py+++ b/hermes_state_maintenance.py@@ -223,7 +223,7 @@ class SessionMaintenanceMixin:unknown = set(filters) - _PRUNE_FILTER_NAMESif unknown:raise TypeError("SessionMaintenanceMixin._prune_filter_where() got an unexpected "- f"keyword argument {sorted(unknown)[0]!r}")+ f"keyword argument {min(unknown)!r}")clauses = ["s.ended_at IS NOT NULL"]if lineage_tips_only:clauses.append("COALESCE(s.end_reason, '') <> 'compression'")diff --git a/optional-skills/blockchain/evm/scripts/evm_client.py b/optional-skills/blockchain/evm/scripts/evm_client.pyindex dc4f91edbe0..e558a5db294 100644--- a/optional-skills/blockchain/evm/scripts/evm_client.py+++ b/optional-skills/blockchain/evm/scripts/evm_client.py@@ -514,7 +514,7 @@ def eth_call_erc20(chain: str, contract: str, fn: str, arg_addr: Optional[str] =def decode_string(hex_data: str) -> str:"""Decode ABI-encoded string from eth_call result."""try:- raw = hex_data[2:] if hex_data.startswith("0x") else hex_data+ raw = hex_data.removeprefix("0x")if len(raw) < 128:# Try decoding as raw bytes (some tokens return non-ABI strings)b = bytes.fromhex(raw)@@ -528,7 +528,7 @@ def decode_string(hex_data: str) -> str:def decode_uint256(hex_data: str) -> int:try:- raw = hex_data[2:] if hex_data.startswith("0x") else hex_data+ raw = hex_data.removeprefix("0x")if not raw:return 0return int(raw, 16)diff --git a/optional-skills/research/rss-feeds/scripts/feed.py b/optional-skills/research/rss-feeds/scripts/feed.pyindex 2405b30a89a..91a5d1b708d 100644--- a/optional-skills/research/rss-feeds/scripts/feed.py+++ b/optional-skills/research/rss-feeds/scripts/feed.py@@ -58,7 +58,7 @@ def parse_date(value: str | None) -> str | None:dt = parsedate_to_datetime(value)except (TypeError, ValueError):try:- dt = datetime.fromisoformat(value.replace("Z", "+00:00"))+ dt = datetime.fromisoformat(value)except ValueError:return valueif dt.tzinfo is None:@@ -193,7 +193,7 @@ def read(url: str) -> dict:def filter_entries(entries: list[dict], limit: int, since: str | None) -> list[dict]:if since:- cutoff = datetime.fromisoformat(since).replace(tzinfo=timezone.utc) if "T" not in since else datetime.fromisoformat(since.replace("Z", "+00:00"))+ cutoff = datetime.fromisoformat(since).replace(tzinfo=timezone.utc) if "T" not in since else datetime.fromisoformat(since)if cutoff.tzinfo is None:cutoff = cutoff.replace(tzinfo=timezone.utc)entries = [e for e in entries if e["published"] and datetime.fromisoformat(e["published"]) >= cutoff]diff --git a/plugins/memory/holographic/retrieval.py b/plugins/memory/holographic/retrieval.pyindex 1383e942bcb..e528a7742c1 100644--- a/plugins/memory/holographic/retrieval.py+++ b/plugins/memory/holographic/retrieval.py@@ -208,7 +208,7 @@ class FactRetriever:if not self.half_life or not timestamp_str:return 1.0try:- ts = datetime.fromisoformat(timestamp_str.replace("Z", "+00:00")) if isinstance(timestamp_str, str) else timestamp_str+ ts = datetime.fromisoformat(timestamp_str) if isinstance(timestamp_str, str) else timestamp_strage_days = (datetime.now(timezone.utc) - (ts if ts.tzinfo else ts.replace(tzinfo=timezone.utc))).total_seconds() / 86400return 1.0 if age_days < 0 else math.pow(0.5, age_days / self.half_life)except (ValueError, TypeError):diff --git a/plugins/platforms/photon/adapter.py b/plugins/platforms/photon/adapter.pyindex 9442765797e..2d09cce06cf 100644--- a/plugins/platforms/photon/adapter.py+++ b/plugins/platforms/photon/adapter.py@@ -426,7 +426,7 @@ def _is_richlink_preview_content(content: dict[str, Any]) -> bool:def _parse_timestamp(ts_str: str) -> datetime:try:- return datetime.fromisoformat(ts_str.replace("Z", "+00:00")) if ts_str else datetime.now(tz=timezone.utc)+ return datetime.fromisoformat(ts_str) if ts_str else datetime.now(tz=timezone.utc)except ValueError:return datetime.now(tz=timezone.utc)diff --git a/plugins/platforms/raft/adapter.py b/plugins/platforms/raft/adapter.pyindex 596755787b2..345b0cb4030 100644--- a/plugins/platforms/raft/adapter.py+++ b/plugins/platforms/raft/adapter.py@@ -150,7 +150,7 @@ def _validate_activity_event(value: Any) -> dict[str, Any]:if value.get("schema") != ACTIVITY_EVENT_SCHEMA:raise ValueError("unsupported activity event schema")if unknown := set(value) - _ACTIVITY_ALLOWED_FIELDS:- raise ValueError(f"activity event field {sorted(unknown)[0]} is not allowed")+ raise ValueError(f"activity event field {min(unknown)} is not allowed")for key in ("eventId", "sessionId", "hookEventName", "occurredAt"):if not _safe_scalar(value.get(key)):raise ValueError(f"activity event {key} must be a safe non-empty string")diff --git a/plugins/platforms/simplex/adapter.py b/plugins/platforms/simplex/adapter.pyindex af93f0661ff..2805d0fec36 100644--- a/plugins/platforms/simplex/adapter.py+++ b/plugins/platforms/simplex/adapter.py@@ -385,7 +385,7 @@ class SimplexAdapter(BasePlatformAdapter):MessageType.DOCUMENT)ts_str = meta.get("itemTs") or meta.get("createdAt", "")try:- timestamp = datetime.fromisoformat(ts_str.replace("Z", "+00:00")) if ts_str else datetime.now(tz=timezone.utc)+ timestamp = datetime.fromisoformat(ts_str) if ts_str else datetime.now(tz=timezone.utc)except (ValueError, AttributeError):timestamp = datetime.now(tz=timezone.utc)msg_event = MessageEvent(diff --git a/plugins/platforms/slack/adapter.py b/plugins/platforms/slack/adapter.pyindex 6cdf24dc51f..447447425a8 100644--- a/plugins/platforms/slack/adapter.py+++ b/plugins/platforms/slack/adapter.py@@ -184,8 +184,8 @@ def _pad(cell: str, width: int) -> str:def _split_table_row(line: str) -> list[str]:"""Split a ``| a | b | c |`` row into trimmed cells (outer pipes optional)."""s = line.strip()- s = s[1:] if s.startswith("|") else s- s = s[:-1] if s.endswith("|") else s+ s = s.removeprefix("|")+ s = s.removesuffix("|")return [c.strip() for c in s.split("|")]diff --git a/pm/filesystem.py b/pm/filesystem.pyindex eb829818e39..03874126c59 100644--- a/pm/filesystem.py+++ b/pm/filesystem.py@@ -52,7 +52,7 @@ def native(path: str | os.PathLike[str]) -> str:text = os.fspath(path)if text.startswith(_VERBATIM_UNC):return "\\\\" + text[len(_VERBATIM_UNC):]- return text[len(_VERBATIM):] if text.startswith(_VERBATIM) else text+ return text.removeprefix(_VERBATIM)def lock_fd(fd: int, *, wait: bool, timeout: float | None = None) -> bool:diff --git a/pm/update.py b/pm/update.pyindex 86de317fee7..b5a4793e94e 100644--- a/pm/update.py+++ b/pm/update.py@@ -363,8 +363,7 @@ def node_latest_versions() -> list[str]:out = []for entry in _get_json("https://nodejs.org/dist/index.json"):v = entry.get("version", "")- if v.startswith("v"):- v = v[1:]+ v = v.removeprefix("v")if re.fullmatch(r"\d+\.\d+\.\d+", v):out.append(v)return outdiff --git a/ruff.strict.toml b/ruff.strict.tomlindex 1675fdfef9b..24a8928ed6f 100644--- a/ruff.strict.toml+++ b/ruff.strict.toml@@ -402,7 +402,7 @@ select = ["FURB136","FURB157","FURB161",- # "FURB162",+ "FURB162","FURB163","FURB166","FURB167",@@ -410,8 +410,8 @@ select = ["FURB169","FURB177","FURB181",- # "FURB188",- # "FURB192",+ "FURB188",+ "FURB192","RUF007","RUF008","RUF009",diff --git a/scripts/ci/live_comment.py b/scripts/ci/live_comment.pyindex 89f0d68272c..0ec7203b840 100644--- a/scripts/ci/live_comment.py+++ b/scripts/ci/live_comment.py@@ -428,8 +428,7 @@ def _parse_status_file(status_file: Path) -> list[dict]:"""Parse a review-status.json file in GITHUB_OUTPUT format."""try:content = status_file.read_text(encoding="utf-8-sig").strip()- if content.startswith("review_status="):- content = content[len("review_status="):]+ content = content.removeprefix("review_status=")statuses = json.loads(content)if isinstance(statuses, list):return statusesdiff --git a/scripts/ci/timings_report.py b/scripts/ci/timings_report.pyindex 810d96566e2..02261fc14b6 100644--- a/scripts/ci/timings_report.py+++ b/scripts/ci/timings_report.py@@ -146,7 +146,7 @@ def api_get(path: str, token: str, params: dict | None = None,def parse_ts(ts: str | None) -> datetime | None:if not ts:return None- return datetime.fromisoformat(ts.replace("Z", "+00:00"))+ return datetime.fromisoformat(ts)def dur_s(started: str | None, completed: str | None) -> float | None:diff --git a/scripts/docker_rebootstrap_nous_session.py b/scripts/docker_rebootstrap_nous_session.pyindex 05ea1d930cd..ce64c2899cd 100644--- a/scripts/docker_rebootstrap_nous_session.py+++ b/scripts/docker_rebootstrap_nous_session.py@@ -107,7 +107,7 @@ def _parse_timestamp(value: Any) -> Optional[datetime]:if not isinstance(value, str) or not value.strip():return Nonetry:- parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(value)except (ValueError, OverflowError):return Noneif parsed.tzinfo is None:diff --git a/scripts/releases/commit_build.py b/scripts/releases/commit_build.pyindex 05db8f2de8d..c6fde707d3b 100644--- a/scripts/releases/commit_build.py+++ b/scripts/releases/commit_build.py@@ -87,7 +87,7 @@ def receipt_tag(kind: str, version: str, created_at: str, run_id: str) -> str:if not re.fullmatch(r"[1-9][0-9]{0,19}", run_id):raise ValueError("Build receipt run ID is invalid")try:- instant = datetime.fromisoformat(created_at.replace("Z", "+00:00")).astimezone(timezone.utc)+ instant = datetime.fromisoformat(created_at).astimezone(timezone.utc)except (AttributeError, ValueError) as error:raise ValueError("Build receipt creation time is invalid") from errorif instant.microsecond or created_at != instant.strftime("%Y-%m-%dT%H:%M:%SZ"):diff --git a/scripts/verify-bootstrap-version-stamp.py b/scripts/verify-bootstrap-version-stamp.pyindex a95f8bc23c5..dfb3b0010da 100644--- a/scripts/verify-bootstrap-version-stamp.py+++ b/scripts/verify-bootstrap-version-stamp.py@@ -122,7 +122,7 @@ def verify_stamp(stamp_path: Path, repo: Path, expect_commit: str | None, expect_fail(errors, f"completedAt {completed!r} is missing")else:try:- parsed = datetime.fromisoformat(completed.replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(completed)if parsed.utcoffset() is None or parsed.utcoffset().total_seconds() != 0:_fail(errors, f"completedAt {completed!r} is not UTC")except ValueError:diff --git a/skills/productivity/google-workspace/scripts/gws_bridge.py b/skills/productivity/google-workspace/scripts/gws_bridge.pyindex 9cd33a7d373..d990797bacb 100755--- a/skills/productivity/google-workspace/scripts/gws_bridge.py+++ b/skills/productivity/google-workspace/scripts/gws_bridge.py@@ -92,7 +92,7 @@ def get_valid_token() -> str:expiry = token_data.get("expiry", "")if expiry:- exp_dt = datetime.fromisoformat(expiry.replace("Z", "+00:00"))+ exp_dt = datetime.fromisoformat(expiry)now = datetime.now(timezone.utc)if now >= exp_dt:token_data = refresh_token(token_data)diff --git a/tests/agent/test_anthropic_kwargs_sanitize.py b/tests/agent/test_anthropic_kwargs_sanitize.pyindex 1104cbd78e7..9430df63874 100644--- a/tests/agent/test_anthropic_kwargs_sanitize.py+++ b/tests/agent/test_anthropic_kwargs_sanitize.py@@ -21,7 +21,7 @@ def _fake_anthropic_call(**kwargs):if bad:raise TypeError("Messages.stream() got an unexpected keyword argument "- f"{sorted(bad)[0]!r}"+ f"{min(bad)!r}")return "OK"diff --git a/tests/agent/test_i18n_tui_packs.py b/tests/agent/test_i18n_tui_packs.pyindex 07972b004c7..4d770a81183 100644--- a/tests/agent/test_i18n_tui_packs.py+++ b/tests/agent/test_i18n_tui_packs.py@@ -40,7 +40,7 @@ def home(tmp_path, monkeypatch):def test_tui_surface_serves_bundled_pack_under_overlay(home):bundled = i18n_layers.parse_locale_file(LOCALES_DIR / "de.tui.yaml")- key = sorted(bundled)[0]+ key = min(bundled)served = i18n.surface_catalog("de", "tui")assert served[key] == bundled[key]assert set(served) >= set(bundled)diff --git a/tests/agent/test_model_metadata.py b/tests/agent/test_model_metadata.pyindex 973ae6f198b..13f8ffa818e 100644--- a/tests/agent/test_model_metadata.py+++ b/tests/agent/test_model_metadata.py@@ -816,9 +816,7 @@ class TestCodexOAuthContextLength:bare = model_id.rsplit("/", 1)[-1]catalog_slug = strip_codex_context_variant_suffix(bare)- if catalog_slug.endswith("-900k"):- # invalid alias — catalog advertises the underlying family slug- catalog_slug = catalog_slug[: -len("-900k")]+ catalog_slug = catalog_slug.removesuffix("-900k")fake_response = MagicMock()fake_response.status_code = 200fake_response.json.return_value = {diff --git a/tests/cron/test_cron_script.py b/tests/cron/test_cron_script.pyindex 2fa7543c203..87ab61e8d0f 100644--- a/tests/cron/test_cron_script.py+++ b/tests/cron/test_cron_script.py@@ -173,7 +173,7 @@ class TestRunJobScript:# sorted() so the probed var is deterministic across runs# (frozenset iteration order varies with PYTHONHASHSEED).- blocked_var = sorted(_HERMES_PROVIDER_ENV_BLOCKLIST)[0]+ blocked_var = min(_HERMES_PROVIDER_ENV_BLOCKLIST)monkeypatch.setenv(blocked_var, "must_not_leak")script = cron_env / "scripts" / "env_probe.py"diff --git a/tests/gateway/test_tts_media_routing.py b/tests/gateway/test_tts_media_routing.pyindex 010037fe183..f61c7fab28d 100644--- a/tests/gateway/test_tts_media_routing.py+++ b/tests/gateway/test_tts_media_routing.py@@ -480,8 +480,7 @@ class _QueuedMediaCaptureAdapter(BasePlatformAdapter):async def send_multiple_images(self, chat_id, images, metadata=None, human_delay=0.0):for image_url, _alt in images:path = image_url- if path.startswith("file://"):- path = path[len("file://"):]+ path = path.removeprefix("file://")self.images.append({"chat_id": chat_id, "image_path": path, "metadata": metadata})async def get_chat_info(self, chat_id):diff --git a/tests/hermes_state/test_fts_rebuild_admission.py b/tests/hermes_state/test_fts_rebuild_admission.pyindex 0265cdf6f32..b6914d98f2b 100644--- a/tests/hermes_state/test_fts_rebuild_admission.py+++ b/tests/hermes_state/test_fts_rebuild_admission.py@@ -170,7 +170,7 @@ class TestSchemaPathAdmission:# Drop one sync trigger out-of-band: next open takes the# triggers_need_repair branch in _init_schema.raw = sqlite3.connect(str(db_path))- raw.execute(f"DROP TRIGGER IF EXISTS {sorted(_FTS_TRIGGERS)[0]}")+ raw.execute(f"DROP TRIGGER IF EXISTS {min(_FTS_TRIGGERS)}")raw.commit()raw.close()diff --git a/tests/pm/test_long_paths_windows_live.py b/tests/pm/test_long_paths_windows_live.pyindex c915e33846a..6d92deb248b 100644--- a/tests/pm/test_long_paths_windows_live.py+++ b/tests/pm/test_long_paths_windows_live.py@@ -54,7 +54,7 @@ def _verbatim(path: Path | str) -> Path:def _plain(path: Path | str) -> str:text = os.fspath(path)- return text[len(VERBATIM):] if text.startswith(VERBATIM) else text+ return text.removeprefix(VERBATIM)def _strings(value):diff --git a/tools/clarify_gateway.py b/tools/clarify_gateway.pyindex 8d863859c14..c97a443154c 100644--- a/tools/clarify_gateway.py+++ b/tools/clarify_gateway.py@@ -149,7 +149,7 @@ def _selection_attempt_tokens(text: str, choices: Optional[list[str]] = None) ->return Nonetokens = _split_tokens(stripped)if tokens is None:- digits = stripped[1:] if stripped.startswith("-") else stripped+ digits = stripped.removeprefix("-")return [stripped] if digits.isdigit() or _is_int(stripped) else Noneif "," not in stripped or not tokens:return tokens or Nonediff --git a/tools/connectors/gateway/names.py b/tools/connectors/gateway/names.pyindex a5bcc01f3e0..716899f9ca6 100644--- a/tools/connectors/gateway/names.py+++ b/tools/connectors/gateway/names.py@@ -52,8 +52,7 @@ def parse_connector_name(name: object) -> Optional[ConnectorName]:def format_connector_name(connector: str, tool: str) -> str:prefix = f"{connector.upper()}_"- if tool.startswith(prefix):- tool = tool[len(prefix):]+ tool = tool.removeprefix(prefix)return f"{CONNECTOR_NAME_PREFIX}{connector}__{tool}"diff --git a/tools/cronjob_job_args.py b/tools/cronjob_job_args.pyindex 7c0d10c6e7d..57cd7c9108a 100644--- a/tools/cronjob_job_args.py+++ b/tools/cronjob_job_args.py@@ -42,7 +42,7 @@ def _first_fire_within_thread_horizon(if not run_at:return Falsetry:- fire_at = datetime.fromisoformat(str(run_at).replace("Z", "+00:00"))+ fire_at = datetime.fromisoformat(str(run_at))except ValueError:return Falsenow = hermes_time.now()diff --git a/tools/environments/docker_egress.py b/tools/environments/docker_egress.pyindex 895a04a9ed5..b9feb74ee56 100644--- a/tools/environments/docker_egress.py+++ b/tools/environments/docker_egress.py@@ -171,8 +171,7 @@ def _env_flag_value(arg: str) -> tuple[str, str | None] | None:continueif ch == "e":rest = arg[pos + 2:]- if rest.startswith("="):- rest = rest[1:]+ rest = rest.removeprefix("=")return "env", rest or Nonereturn Nonereturn Nonediff --git a/tools/file_operations.py b/tools/file_operations.pyindex 544bc0beb42..d5a1519190e 100644--- a/tools/file_operations.py+++ b/tools/file_operations.py@@ -494,8 +494,7 @@ class ShellFileOperations(LintMixin, SearchMixin, FileOperations):# gutter line on every newline-terminated file (`cat -n` semantics).# Exactly ONE terminator is dropped, so a genuinely selected trailing# blank line in a page keeps its own number.- if content.endswith('\n'):- content = content[:-1]+ content = content.removesuffix('\n')return '\n'.join(f"{i}|{line if len(line) <= max_line_length else line[:max_line_length] + '... [truncated]'}"for i, line in enumerate(content.split('\n'), start=start_line))diff --git a/tools/file_operations_search.py b/tools/file_operations_search.pyindex ba6035afed7..58839219b50 100644--- a/tools/file_operations_search.py+++ b/tools/file_operations_search.py@@ -1091,7 +1091,7 @@ class SearchMixin:if is_absolute:search_root = self._escape_shell_arg(path)else:- relative_path = path[2:] if path.startswith("./") else path+ relative_path = path.removeprefix("./")search_root = '"$PWD"'if relative_path not in {"", "."}:search_root += f"/{self._escape_shell_arg(relative_path)}"diff --git a/tools/mcp_tool_config.py b/tools/mcp_tool_config.pyindex 85245b64293..91546bf18f7 100644--- a/tools/mcp_tool_config.py+++ b/tools/mcp_tool_config.py@@ -403,7 +403,7 @@ def _npx_cached_bin(args: list) -> Optional[tuple]:spec = str(rest[0])# Scoped names keep their leading '@', so only an '@' AFTER the scope is a version separator.- if "@" in (spec[1:] if spec.startswith("@") else spec):+ if "@" in (spec.removeprefix("@")):return Noneif not spec or spec.startswith("-"):return Nonediff --git a/tools/patch_parser.py b/tools/patch_parser.pyindex 0e303a3f459..3d7e25d1c68 100644--- a/tools/patch_parser.py+++ b/tools/patch_parser.py@@ -59,7 +59,7 @@ _HINT_RE = re.compile(r'@@\s*(.+?)\s*@@')def parse_v4a_patch(patch_content: str) -> tuple[list[PatchOperation], Optional[str]]:"""-> ``(operations, None)`` (empty patch = ``[]``, no error) or ``([], "Parse error: …")``."""# Tolerate CRLF: a stray ``\r`` would land in every HunkLine.content and defeat the markers.- lines = [ln[:-1] if ln.endswith('\r') else ln for ln in patch_content.split('\n')]+ lines = [ln.removesuffix('\r') for ln in patch_content.split('\n')]start_idx = -1 # parse from the top when no Begin marker is presentend_idx = len(lines)for i, line in enumerate(lines):diff --git a/tools/session_search_tool.py b/tools/session_search_tool.pyindex fd64fcf6eca..409112b63c9 100644--- a/tools/session_search_tool.py+++ b/tools/session_search_tool.py@@ -141,7 +141,7 @@ def _parse_iso_bound(value: Optional[str]) -> Optional[int]:if rel := _RELATIVE_BOUND_RE.match(text):return int(time.time()) - int(rel.group(1)) * _RELATIVE_UNIT_SECONDS[rel.group(2).lower()]try:- parsed = datetime.fromisoformat(text.replace("Z", "+00:00"))+ parsed = datetime.fromisoformat(text)except ValueError:raise ValueError(f"invalid time bound: {value!r} (expected ISO date/datetime like ""2026-07-01, or a relative duration like 7d, 24h, 2w)") from Nonediff --git a/tools/skills_hub_models.py b/tools/skills_hub_models.pyindex 13c0475097d..6573849441f 100644--- a/tools/skills_hub_models.py+++ b/tools/skills_hub_models.py@@ -307,7 +307,7 @@ def _referenced_support_paths(skill_md: str) -> Optional[set[str]]:raw = match.group(1).rstrip(".,;:")# Canonicalize like the support-dir branch (drop query/fragment, percent-decode), strip leading ``./``.name = unquote(urlsplit(raw).path)- name = name[2:] if name.startswith("./") else name+ name = name.removeprefix("./")# External URLs, anchors, mailto and site-absolute targets are not same-directory file links.if not name or "://" in raw or raw.startswith(("mailto:", "#", "/")):continuediff --git a/tools/skills_hub_sources.py b/tools/skills_hub_sources.pyindex 219e8a7b9d4..46abc4e6f58 100644--- a/tools/skills_hub_sources.py+++ b/tools/skills_hub_sources.py@@ -106,7 +106,7 @@ class WellKnownSkillSource(GuardedFetchMixin, SkillSource):return query.rstrip("/") + f"{self.BASE_PATH}/index.json"def _parse_identifier(self, identifier: str) -> Optional[dict]:- raw = identifier[len("well-known:"):] if identifier.startswith("well-known:") else identifier+ raw = identifier.removeprefix("well-known:")if not raw.startswith(("http://", "https://")):return Noneparsed_url = urlparse(raw)@@ -427,4 +427,4 @@ class BrowseShSource(SkillSource):def _slug_from_identifier(self, identifier: str) -> str:"""'browse-sh/airbnb.com/search-listings-abc' -> 'airbnb.com/search-listings-abc'."""- return identifier[len("browse-sh/"):] if identifier.startswith("browse-sh/") else identifier+ return identifier.removeprefix("browse-sh/")diff --git a/tools/tool_search_catalog.py b/tools/tool_search_catalog.pyindex dc9901f1d8c..d46ab157929 100644--- a/tools/tool_search_catalog.py+++ b/tools/tool_search_catalog.py@@ -83,8 +83,7 @@ def _entry_search_text(td: dict[str, Any], source_label: str = "") -> str:("linear") reach a tool whose own name omits the vendor."""fn = _fn(td)name = fn.get("name", "")- if name.startswith("mcp__"):- name = name[len("mcp__"):]+ name = name.removeprefix("mcp__")name_words = re.sub(r"[_.:-]", " ", name)extra = source_label if source_label and source_label not in name_words.split() else ""param_names = " ".join(((fn.get("parameters") or {}).get("properties") or {}).keys())@@ -230,7 +229,7 @@ def _short_desc(description: str, max_chars: int = 60) -> str:def _listing_group_label(source_name: str) -> str:"""Human-facing group heading for a toolset, e.g. ``mcp-github`` -> ``github``."""label = source_name or "other"- return label[4:] if label.startswith("mcp-") else label+ return label.removeprefix("mcp-")def hidden_declared_sources() -> list[dict[str, Any]]:diff --git a/tui_gateway/slash_worker.py b/tui_gateway/slash_worker.pyindex 6149479421f..781f6cf0bef 100644--- a/tui_gateway/slash_worker.py+++ b/tui_gateway/slash_worker.py@@ -82,8 +82,7 @@ def _start_parent_death_watchdog(original_ppid) -> None:def _slash_base(command: str) -> str:cmd = (command or "").strip()- if cmd.startswith("/"):- cmd = cmd[1:]+ cmd = cmd.removeprefix("/")return (cmd.split(maxsplit=1)[0] if cmd else "").lower()diff --git a/website/scripts/check_doc_links.py b/website/scripts/check_doc_links.pyindex 9c5dc5df4aa..3e7362a392c 100644--- a/website/scripts/check_doc_links.py+++ b/website/scripts/check_doc_links.py@@ -67,8 +67,7 @@ def route_for(rel: str, text: str) -> str:stem = re.sub(r"\.mdx?$", "", rel)if stem == "index":return "/"- if stem.endswith("/index"):- stem = stem[: -len("/index")]+ stem = stem.removesuffix("/index")return "/" + stemdiff --git a/website/scripts/extract-skills.py b/website/scripts/extract-skills.pyindex b57276aefa0..ecadfc7581e 100644--- a/website/scripts/extract-skills.py+++ b/website/scripts/extract-skills.py@@ -227,7 +227,7 @@ def _source_url(source: str, identifier: str, extra: dict) -> str:# ClawHub URLs require the owner handle: https://clawhub.ai/{owner}/skills/{slug}.# Without the owner we cannot build a valid URL — return "" rather than# a broken link (the card will simply omit the "View source" button).- slug = identifier[len("clawhub/"):] if identifier.startswith("clawhub/") else identifier+ slug = identifier.removeprefix("clawhub/")owner = extra.get("owner", "") if isinstance(extra, dict) else ""if owner:return f"https://clawhub.ai/{owner}/skills/{slug}"@@ -235,16 +235,16 @@ def _source_url(source: str, identifier: str, extra: dict) -> str:if src in {"skills.sh", "skills-sh"}:# "skills-sh/owner/repo/skill" -> the skills.sh detail page- rest = identifier[len("skills-sh/"):] if identifier.startswith("skills-sh/") else identifier+ rest = identifier.removeprefix("skills-sh/")return f"https://skills.sh/skills/{rest}"if src == "lobehub":- slug = identifier[len("lobehub/"):] if identifier.startswith("lobehub/") else identifier+ slug = identifier.removeprefix("lobehub/")return f"https://lobehub.com/agent/{slug}"if src in {"browse.sh", "browse-sh"}:# "browse-sh/<hostname>/<task-id>" -> browse.sh task page- rest = identifier[len("browse-sh/"):] if identifier.startswith("browse-sh/") else identifier+ rest = identifier.removeprefix("browse-sh/")return f"https://browse.sh/skills/{rest}"return ""diff --git a/website/scripts/generate-skill-docs.py b/website/scripts/generate-skill-docs.pyindex f8ffb88d171..4c6d4fdb535 100755--- a/website/scripts/generate-skill-docs.py+++ b/website/scripts/generate-skill-docs.py@@ -247,7 +247,7 @@ def rewrite_relative_links(body: str, meta: dict[str, Any]) -> str:if url.startswith("mailto:"):return m.group(0)# Strip leading ./- url_clean = url[2:] if url.startswith("./") else url+ url_clean = url.removeprefix("./")full = f"{base}/{url_clean}"return f"[{text}]({full})"