MCPcopy Create free account
hub / github.com/corca-ai/nose / command

Function command

scripts/query_cache_output.py:13–27  ·  view source on GitHub ↗
(value: str)

Source from the content-addressed store, hash-verified

11def comparable_output(payload: dict, cache: Path | None) -> bytes:
12 """Only erase the exact cache argument from executable navigation commands."""
13 def command(value: str) -> str:
14 tokens = shlex.split(value)
15 if tokens[:2] != ["nose", "query"]:
16 return value
17 positions = [i for i, token in enumerate(tokens) if token == "--cache-dir"]
18 if len(positions) > 1:
19 raise ValueError("duplicate cache argument in navigation")
20 if cache is not None and payload.get("schema_version", 0) >= 10 and not positions:
21 raise ValueError("navigation lost its query cache context")
22 if positions:
23 index = positions[0]
24 if cache is None or tokens[index + 1:index + 2] != [str(cache)]:
25 raise ValueError("navigation cache argument differs from query context")
26 del tokens[index:index + 2]
27 return shlex.join(tokens)
28
29 def visit(value):
30 if isinstance(value, dict):

Callers 1

visitFunction · 0.70

Calls 2

joinMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected