pip: use batch request

This commit is contained in:
2 * r + 2 * t
2025-08-17 15:02:12 +10:00
parent ebca5f8557
commit b22ab08a37
2 changed files with 10 additions and 2 deletions
+6
View File
@@ -27,3 +27,9 @@ def message(msg: str, json: bool = True) -> str | dict[str, any]:
def dispatch(dispatcher: str, *args: list[any]) -> bool:
return message(f"dispatch {dispatcher} {' '.join(map(str, args))}".rstrip(), json=False) == "ok"
def batch(*msgs: list[str], json: bool = False) -> str | dict[str, any]:
if json:
msgs = (f"j/{m.strip()}" for m in msgs)
return message(f"[[BATCH]]{';'.join(msgs)}", json=False)