CleanPlan#
- class scikitplot.cleanprompt.CleanPlan(packs=('auto',), formats=('all',), custom=(), conflict='error', profile=None, core=True, style='placeholder', keep=(), roles=(), infer_roles=False, ner='none', language='en', hide=(), allow=(), remember=True, pattern_risk=None, surrogates=None, configured=())[source]#
Everything a cleaner needs to know, and nothing it discovers.
- Parameters:
- packstuple of str
Pack names, or one of
('all',),('auto',),('none',).- formatstuple of str
Format names or extensions, or
('all',).- customtuple of str
Paths of custom definition files.
- conflict{‘error’, ‘replace’}
How custom definitions treat a built-in of the same name.
- profilestr or None
A core-pattern profile:
'minimal','balanced'or'strict'.- corebool
Whether the built-in structural patterns run at all.
- stylestr
'placeholder'or'surrogate'.- keeptuple of str
Artefact parts to send rather than remove.
- rolestuple of (str, str)
Declared column roles.
- infer_rolesbool
Whether to guess column roles from names.
- nerstr
Entity engine mode;
'none'for no entity detection.- languagestr
Language for entity detection.
- hidetuple of str
Literal terms to hide.
- allowtuple of str
Literal terms never to hide.
- rememberbool
Once a value is hidden, hide it wherever it appears later — in prose, in another file, in the next turn — not only where a pattern or field rule finds it again.
- pattern_risk{‘warn’, ‘ignore’, ‘refuse’} or None
What a custom pattern with a catastrophic-backtracking shape does.
None(default) defers toCLEANPROMPT_PATTERN_RISK, else'warn'. Pin'refuse'in a team plan file to make the check a gate.- surrogatesstr or None
Path of a custom surrogate set (
_surrogate_sets) whose names replace the built-in ones. Requiresstyle='surrogate'. The set’s identity joins the fingerprint, so editing the set file makes a saved plan stale.
- Parameters:
Notes
Developer notes. Tuples, never lists or sets, so a plan is hashable and its canonical form does not depend on iteration order: every collection is sorted when it enters, by
FluentCleanPrompt.pattern_riskandsurrogatesare left out ofas_dictwhile they areNone, so every plan saved before the fields existed keeps its fingerprint (I12): adding a setting must not invalidate approved plan files.- catalog()[source]#
Return the catalog this plan resolves against.
- Returns:
- Catalog
The built-ins, with the plan’s custom definitions merged in.
- Return type:
Catalog
- fingerprint()[source]#
Return a digest of the selection and the definitions it resolves to.
- Returns:
- str
Hex SHA-256.
- Raises:
- CleanPromptError
If the plan does not validate.
- Return type:
- pattern_findings()[source]#
Return every pattern-risk finding in this plan’s custom packs.
- Returns:
- list of PackFinding
Accepted findings included (
acceptedset), so a review can list what was waived. Built-in packs are proven clean by the test suite and are not analysed.
- Return type:
- pattern_risk_mode()[source]#
Return the pattern-risk mode in force for this plan.
- Returns:
- str
pattern_riskwhen set, elseCLEANPROMPT_PATTERN_RISK, else'warn'.
- Raises:
- ValueError
If the mode, set or from the environment, is not a known one.
- Return type: