| | |
- render_file(path: 'str | Path', rule: 'str', context: 'Mapping[str, str] | None' = None, *, processors: 'Mapping[str, Callable[[str], str]] | None' = None) -> 'str'
- Render one rule from a configuration file.
This convenience helper loads the file, renders one rule, and releases the
native handle. Use ``Copperlace.from_file`` for repeated renders.
Args:
path: Path to the configuration file.
rule: Name of the rule to render.
context: Optional initial render context values.
processors: Optional custom processor callbacks.
Returns:
Rendered text for the requested rule.
Raises:
CopperlaceError: If loading, parsing, compilation, or rendering fails.
- render_file_inferred(path: 'str | Path', rule: 'str', context: 'Mapping[str, str] | None' = None, *, processors: 'Mapping[str, Callable[[str], str]] | None' = None) -> 'str'
- Render one rule from a configuration file, returning formatted JSON for object-valued rules.
- render_file_structured(path: 'str | Path', rule: 'str', context: 'Mapping[str, str] | None' = None, *, processors: 'Mapping[str, Callable[[str], str]] | None' = None) -> 'str'
- Render one structured rule from a configuration file as formatted JSON text.
This convenience helper loads the file, renders one structured rule, and
releases the native handle.
Args:
path: Path to the configuration file.
rule: Name of the structured rule to render.
context: Optional initial render context values.
processors: Optional custom processor callbacks.
Returns:
Formatted JSON text for the requested structured rule.
Raises:
CopperlaceError: If loading, parsing, compilation, or rendering fails.
- render_str(config: 'str', rule: 'str', context: 'Mapping[str, str] | None' = None, *, processors: 'Mapping[str, Callable[[str], str]] | None' = None) -> 'str'
- Render one rule from a configuration string.
This convenience helper compiles the config, renders one rule, and releases
the native handle. Use ``Copperlace.from_string`` for repeated renders.
Args:
config: configuration text containing Copperlace rules.
rule: Name of the rule to render.
context: Optional initial render context values.
processors: Optional custom processor callbacks.
Returns:
Rendered text for the requested rule.
Raises:
CopperlaceError: If parsing, compilation, or rendering fails.
- render_str_inferred(config: 'str', rule: 'str', context: 'Mapping[str, str] | None' = None, *, processors: 'Mapping[str, Callable[[str], str]] | None' = None) -> 'str'
- Render one rule from a configuration string, returning formatted JSON for object-valued rules.
- render_str_structured(config: 'str', rule: 'str', context: 'Mapping[str, str] | None' = None, *, processors: 'Mapping[str, Callable[[str], str]] | None' = None) -> 'str'
- Render one structured rule from a configuration string as formatted JSON text.
This convenience helper compiles the config, renders one structured rule,
and releases the native handle.
Args:
config: configuration text containing Copperlace rules.
rule: Name of the structured rule to render.
context: Optional initial render context values.
processors: Optional custom processor callbacks.
Returns:
Formatted JSON text for the requested structured rule.
Raises:
CopperlaceError: If parsing, compilation, or rendering fails.
|