MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _metafield_defs

Function _metafield_defs

scripts/theme_gate.py:452–473  ·  view source on GitHub ↗
(root: Path)

Source from the content-addressed store, hash-verified

450
451
452def _metafield_defs(root: Path) -> set[str] | None:
453 p = root / ".shopify" / "metafields.json"
454 if not p.is_file():
455 return None
456 try:
457 data = json.loads(_read(p))
458 except ValueError:
459 return None
460 keys: set[str] = set()
461
462 def walk(o: object) -> None:
463 if isinstance(o, dict):
464 if isinstance(o.get("namespace"), str) and isinstance(o.get("key"), str):
465 keys.add(f"metafields.{o['namespace']}.{o['key']}")
466 for v in o.values():
467 walk(v)
468 elif isinstance(o, list):
469 for v in o:
470 walk(v)
471
472 walk(data)
473 return keys
474
475
476def _callers(root: Path) -> dict[str, set[str]]:

Callers 1

measureFunction · 0.70

Calls 2

_readFunction · 0.70
walkFunction · 0.70

Tested by

no test coverage detected