MCPcopy Create free account
hub / github.com/pytorch/executorch / query

Function query

scripts/print_exported_headers.py:29–38  ·  view source on GitHub ↗

Query an attribute of a target.

(buck2: str, target: str, attribute: str)

Source from the content-addressed store, hash-verified

27
28
29def query(buck2: str, target: str, attribute: str) -> str:
30 """Query an attribute of a target."""
31 output = run([buck2, "cquery", target, "--output-attribute", attribute])
32
33 try:
34 output_json = json.loads(output)
35 return output_json[next(iter(output_json))][attribute]
36 except (json.JSONDecodeError, KeyError) as e:
37 print(f"Failed to parse JSON from query({target}, {attribute}): {output}")
38 raise SystemExit("Error: " + str(e))
39
40
41# Cache to store results for exported headers per target.

Callers 1

exported_headersFunction · 0.85

Calls 1

runFunction · 0.70

Tested by

no test coverage detected