io
io
¶
Save PII replacement plans and configurations with comments for review.
Functions:
| Name | Description |
|---|---|
save_plan |
Save |
save_config |
Save a complete NSS configuration. |
save_plan(plan, path, *, sampler, locale)
¶
Save replace_pii.replacement_plan as a standalone YAML file for review and reuse.
The file starts with a header naming the sampler and locale the plan was
written for, and each section is preceded by a short comment. The header
only informs the reader: each run checks the plan against its own
replace_pii.sampler and replace_pii.locale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
PiiReplacementPlan
|
Replacement plan to save. |
required |
path
|
str | Path
|
Destination YAML file; parent directories are created. |
required |
sampler
|
PiiSamplerConfig
|
Sampler the plan was written for. |
required |
locale
|
str
|
Locale the plan was written for. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The path written. |
Source code in src/nemo_safe_synthesizer/pii_replacer/planning/io.py
save_config(config, path, *, plan_path=None)
¶
Save a complete NSS configuration.
With plan_path and an inline plan, replace_pii.replacement_plan is
written to that file by save_plan, and the configuration names it by a
path relative to the configuration's directory when the file is inside it,
or by its absolute path otherwise, so loading the configuration reads the
file back. Otherwise the plan is written inline, and the output matches
config.to_yaml(path, exclude_unset=False) apart from the same plan
comments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SafeSynthesizerParameters
|
Configuration to save. |
required |
path
|
str | Path
|
Destination YAML file; parent directories are created. |
required |
plan_path
|
str | Path | None
|
Separate file for |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The path written. |