style(hooks): ruff format hooks_cli.py and test_hooks_cli.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -245,12 +245,16 @@ def hook_stop(data: dict, harness: str):
|
|||||||
try:
|
try:
|
||||||
from .config import MempalaceConfig
|
from .config import MempalaceConfig
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
_log(f"WARNING: could not import MempalaceConfig for stop guard: {exc}; preserving block-mode guard")
|
_log(
|
||||||
|
f"WARNING: could not import MempalaceConfig for stop guard: {exc}; preserving block-mode guard"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
silent_guard = MempalaceConfig().hook_silent_save
|
silent_guard = MempalaceConfig().hook_silent_save
|
||||||
except AttributeError as exc:
|
except AttributeError as exc:
|
||||||
_log(f"WARNING: could not read hook_silent_save: {exc}; preserving block-mode guard")
|
_log(
|
||||||
|
f"WARNING: could not read hook_silent_save: {exc}; preserving block-mode guard"
|
||||||
|
)
|
||||||
if not silent_guard:
|
if not silent_guard:
|
||||||
_output({})
|
_output({})
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -255,10 +255,12 @@ def test_output_falls_back_to_fd1_when_mcp_server_absent():
|
|||||||
os.dup2(write_fd, 1)
|
os.dup2(write_fd, 1)
|
||||||
os.close(write_fd)
|
os.close(write_fd)
|
||||||
try:
|
try:
|
||||||
modules_without_mcp = {k: v for k, v in __import__("sys").modules.items()
|
modules_without_mcp = {
|
||||||
if "mcp_server" not in k}
|
k: v for k, v in __import__("sys").modules.items() if "mcp_server" not in k
|
||||||
|
}
|
||||||
with patch.dict("sys.modules", modules_without_mcp, clear=True):
|
with patch.dict("sys.modules", modules_without_mcp, clear=True):
|
||||||
from mempalace.hooks_cli import _output
|
from mempalace.hooks_cli import _output
|
||||||
|
|
||||||
_output({"continue": True})
|
_output({"continue": True})
|
||||||
finally:
|
finally:
|
||||||
os.dup2(orig_fd1, 1)
|
os.dup2(orig_fd1, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user