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

Function schema_of

scripts/theme_gate.py:541–553  ·  view source on GitHub ↗

Ids ``scope`` (section|block) can read from the schema of ``f``: a section's ``settings`` are ``section.settings``, its ``blocks[].settings`` are ``block.settings``; a block file's own ``settings`` are ``block.settings``.

(f: str, scope: str)

Source from the content-addressed store, hash-verified

539 schema_cache: dict[str, set[str]] = {}
540
541 def schema_of(f: str, scope: str) -> set[str]:
542 """Ids ``scope`` (section|block) can read from the schema of ``f``: a section's ``settings`` are
543 ``section.settings``, its ``blocks[].settings`` are ``block.settings``; a block file's own
544 ``settings`` are ``block.settings``."""
545 if f not in schema_cache:
546 p = root / f
547 schema_cache[f] = _schema_scoped(_read(p)) if p.is_file() else (set(), set())
548 own, blocks = schema_cache[f]
549 if f.startswith("sections/"):
550 return own if scope == "section.settings" else blocks
551 if f.startswith("blocks/"):
552 return own if scope == "block.settings" else set()
553 return set()
554
555 for file, line, key in cases_d(root):
556 cases.append(1)

Callers 1

measureFunction · 0.85

Calls 2

_schema_scopedFunction · 0.85
_readFunction · 0.70

Tested by

no test coverage detected