refactor(hermes_cli): join wrapped signatures/conditions that fit one line
This commit is contained in:
@@ -129,13 +129,7 @@ def _upgrade_env() -> dict[str, str]:
|
||||
return env
|
||||
|
||||
|
||||
def upgrade_managed_npm(
|
||||
npm: str,
|
||||
npm_range: str,
|
||||
*,
|
||||
prefix: Path,
|
||||
quiet: bool = False,
|
||||
) -> bool:
|
||||
def upgrade_managed_npm(npm: str, npm_range: str, *, prefix: Path, quiet: bool = False) -> bool:
|
||||
"""Upgrade the managed npm at *npm* in place to satisfy *npm_range*.
|
||||
|
||||
``--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
|
||||
|
||||
|
||||
def maybe_repair_npm_engine(
|
||||
npm: str | None,
|
||||
output: str,
|
||||
*,
|
||||
quiet: bool = False,
|
||||
) -> str | None:
|
||||
def maybe_repair_npm_engine(npm: str | None, output: str, *, quiet: bool = False) -> str | None:
|
||||
"""Repair an ``EBADENGINE`` failure, never touching a foreign toolchain.
|
||||
|
||||
Truthy exactly when the caller should retry once (with the returned npm path).
|
||||
|
||||
@@ -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"{choices} using your own judgment and continue.]"
|
||||
)
|
||||
return (
|
||||
"[oneshot mode: no user available. Make the most reasonable "
|
||||
"assumption you can and continue.]"
|
||||
)
|
||||
return "[oneshot mode: no user available. Make the most reasonable assumption you can and continue.]"
|
||||
|
||||
@@ -18,9 +18,7 @@ DEFAULT_KEEP_LAST = 2
|
||||
MAX_KEEP_LAST = 100
|
||||
|
||||
|
||||
def parse_partial_compress_args(
|
||||
raw_args: str,
|
||||
) -> Tuple[bool, int, Optional[str]]:
|
||||
def parse_partial_compress_args(raw_args: str) -> Tuple[bool, int, Optional[str]]:
|
||||
"""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
|
||||
|
||||
+1
-3
@@ -278,9 +278,7 @@ def _update_pet_config(when_slug: str | None = None, **values) -> bool:
|
||||
|
||||
cfg = load_config()
|
||||
pet = cfg.setdefault("display", {}).setdefault("pet", {})
|
||||
if when_slug is not None and (
|
||||
not isinstance(pet, dict) or str(pet.get("slug", "") or "") != when_slug
|
||||
):
|
||||
if when_slug is not None and (not isinstance(pet, dict) or str(pet.get("slug", "") or "") != when_slug):
|
||||
return False
|
||||
pet.update(values)
|
||||
save_config(cfg)
|
||||
|
||||
@@ -177,18 +177,14 @@ class PlatformActions:
|
||||
|
||||
# -- v1 verbs -----------------------------------------------------------
|
||||
|
||||
async def add_reaction(
|
||||
self, platform: str, chat_id: str, message_id: str, emoji: str
|
||||
) -> Dict[str, Any]:
|
||||
async def add_reaction(self, platform: str, chat_id: str, message_id: str, emoji: str) -> Dict[str, Any]:
|
||||
"""Add/set an emoji reaction on a platform message."""
|
||||
return await self._run(
|
||||
"add_reaction", platform, chat_id, message_id, emoji,
|
||||
chat_id=chat_id, message_id=message_id, emoji=emoji,
|
||||
)
|
||||
|
||||
async def set_thread_title(
|
||||
self, platform: str, chat_id: str, thread_id: str, title: str
|
||||
) -> Dict[str, Any]:
|
||||
async def set_thread_title(self, platform: str, chat_id: str, thread_id: str, title: str) -> Dict[str, Any]:
|
||||
"""Rename a thread / forum topic."""
|
||||
return await self._run(
|
||||
"set_thread_title", platform, chat_id, thread_id, title,
|
||||
|
||||
Reference in New Issue
Block a user