torchcell.knowledge_graphs.supported_queries.registry.QueryRegistry

class QueryRegistry(*, schema_version: Literal[1] = 1, queries: list[SupportedQuery])[source]

Bases: BaseModel

Every registered query; schema_version versions this file’s shape.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

get(query_id: str) → SupportedQuery[source]

The query registered as query_id; KeyError names the known ids.

replace(query: SupportedQuery) → QueryRegistry[source]

A registry with the entry of the same id swapped for query.

dumps() → str[source]

The byte-stable file text: queries sorted by id, one trailing newline.

save(path: Path) → None[source]

Write dumps() to path.

classmethod load(path: Path) → QueryRegistry[source]

Read and validate a registry file.