loader
loader ¤
Registration helpers + YAML/dict loaders for lambda rules.
A lambda rule lives in two places once registered:
- :data:
ts_shape.eventlog.taxonomy.REGISTRY— the :class:~ts_shape.eventlog.taxonomy.LabelRulemapping that :func:~ts_shape.eventlog.to_event_logconsults. - :data:
ts_shape.eventlog.archetypes.ARCHETYPE_BY_METHOD— the archetype classification that the coverage tests use to enforcestandard_attrscompleteness.
Both mutations happen through :func:register_lambda_rule. The
coverage test test_no_orphan_registry_entries is configured to
exempt entries whose class name starts with Lambda, so registered
lambda rules do not need a real Python class on disk.
register_lambda_rule ¤
register_lambda_rule(spec: RuleSpec) -> LambdaDetector
Register spec in REGISTRY + ARCHETYPE_BY_METHOD; return runnable detector.
Raises :class:ValueError if the spec is malformed, the
standard_attrs mapping uses unknown keys, the archetype's
required keys are missing, or a rule with the same
(class_name, method_name) is already registered.
unregister_lambda_rule ¤
unregister_lambda_rule(
class_name: str, method_name: str
) -> None
Remove a rule previously installed by :func:register_lambda_rule.
Used by tests to keep the global REGISTRY clean between cases. No-op if the rule was not registered.
load_dicts ¤
load_dicts(
entries: Iterable[Mapping[str, Any]],
) -> list[LambdaDetector]
Compile + register an iterable of dict rules.
load_yaml ¤
load_yaml(path: str | Path) -> list[LambdaDetector]
Load and register every rule under a YAML file's rules: key.
YAML is imported lazily so :mod:ts_shape.eventlog does not gain a
hard runtime dependency on PyYAML for users who only use built-in
detectors. Install pyyaml to enable this loader.