refactor(hermes_cli): join wrapped signatures/conditions that fit one line

This commit is contained in:
Teknium
2026-09-02 20:40:15 -07:00
parent b454c354dd
commit 2675bcaafd
5 changed files with 7 additions and 29 deletions
+2 -13
View File
@@ -129,13 +129,7 @@ def _upgrade_env() -> dict[str, str]:
return env return env
def upgrade_managed_npm( def upgrade_managed_npm(npm: str, npm_range: str, *, prefix: Path, quiet: bool = False) -> bool:
npm: str,
npm_range: str,
*,
prefix: Path,
quiet: bool = False,
) -> bool:
"""Upgrade the managed npm at *npm* in place to satisfy *npm_range*. """Upgrade the managed npm at *npm* in place to satisfy *npm_range*.
``--prefix`` targets the managed tree explicitly: a managed install writes ``prefix=~/.local`` ``--prefix`` targets the managed tree explicitly: a managed install writes ``prefix=~/.local``
@@ -235,12 +229,7 @@ def _provision_managed_npm(npm_range: str | None, *, quiet: bool = False) -> str
return managed_npm return managed_npm
def maybe_repair_npm_engine( def maybe_repair_npm_engine(npm: str | None, output: str, *, quiet: bool = False) -> str | None:
npm: str | None,
output: str,
*,
quiet: bool = False,
) -> str | None:
"""Repair an ``EBADENGINE`` failure, never touching a foreign toolchain. """Repair an ``EBADENGINE`` failure, never touching a foreign toolchain.
Truthy exactly when the caller should retry once (with the returned npm path). Truthy exactly when the caller should retry once (with the returned npm path).
+1 -4
View File
@@ -452,7 +452,4 @@ def _oneshot_clarify_callback(question: str, choices=None, multi_select=False) -
f"[oneshot mode: no user available. Pick the best {what} from " f"[oneshot mode: no user available. Pick the best {what} from "
f"{choices} using your own judgment and continue.]" f"{choices} using your own judgment and continue.]"
) )
return ( return "[oneshot mode: no user available. Make the most reasonable assumption you can and continue.]"
"[oneshot mode: no user available. Make the most reasonable "
"assumption you can and continue.]"
)
+1 -3
View File
@@ -18,9 +18,7 @@ DEFAULT_KEEP_LAST = 2
MAX_KEEP_LAST = 100 MAX_KEEP_LAST = 100
def parse_partial_compress_args( def parse_partial_compress_args(raw_args: str) -> Tuple[bool, int, Optional[str]]:
raw_args: str,
) -> Tuple[bool, int, Optional[str]]:
"""Parse the argument string after ``/compress`` into ``(partial, keep_last, focus_topic)``. """Parse the argument string after ``/compress`` into ``(partial, keep_last, focus_topic)``.
``here [N]`` / ``up to here [N]`` / ``--keep N`` / ``-k N`` / ``--keep=N`` select the ``here [N]`` / ``up to here [N]`` / ``--keep N`` / ``-k N`` / ``--keep=N`` select the
+1 -3
View File
@@ -278,9 +278,7 @@ def _update_pet_config(when_slug: str | None = None, **values) -> bool:
cfg = load_config() cfg = load_config()
pet = cfg.setdefault("display", {}).setdefault("pet", {}) pet = cfg.setdefault("display", {}).setdefault("pet", {})
if when_slug is not None and ( if when_slug is not None and (not isinstance(pet, dict) or str(pet.get("slug", "") or "") != when_slug):
not isinstance(pet, dict) or str(pet.get("slug", "") or "") != when_slug
):
return False return False
pet.update(values) pet.update(values)
save_config(cfg) save_config(cfg)
+2 -6
View File
@@ -177,18 +177,14 @@ class PlatformActions:
# -- v1 verbs ----------------------------------------------------------- # -- v1 verbs -----------------------------------------------------------
async def add_reaction( async def add_reaction(self, platform: str, chat_id: str, message_id: str, emoji: str) -> Dict[str, Any]:
self, platform: str, chat_id: str, message_id: str, emoji: str
) -> Dict[str, Any]:
"""Add/set an emoji reaction on a platform message.""" """Add/set an emoji reaction on a platform message."""
return await self._run( return await self._run(
"add_reaction", platform, chat_id, message_id, emoji, "add_reaction", platform, chat_id, message_id, emoji,
chat_id=chat_id, message_id=message_id, emoji=emoji, chat_id=chat_id, message_id=message_id, emoji=emoji,
) )
async def set_thread_title( async def set_thread_title(self, platform: str, chat_id: str, thread_id: str, title: str) -> Dict[str, Any]:
self, platform: str, chat_id: str, thread_id: str, title: str
) -> Dict[str, Any]:
"""Rename a thread / forum topic.""" """Rename a thread / forum topic."""
return await self._run( return await self._run(
"set_thread_title", platform, chat_id, thread_id, title, "set_thread_title", platform, chat_id, thread_id, title,