pyhanko.sign.diff_analysis.rules_api module
Module defining common API types for use by rules and policies.
In principle, these aren’t relevant to the high-level validation API.
- class pyhanko.sign.diff_analysis.rules_api.QualifiedWhitelistRule
Bases:
object
Abstract base class for a whitelisting rule that outputs references together with the modification level at which they’re cleared.
This is intended for use by complicated whitelisting rules that need to differentiate between multiple levels.
- apply_qualified(old: pyhanko.pdf_utils.reader.HistoricalResolver, new: pyhanko.pdf_utils.reader.HistoricalResolver) Iterable[Tuple[pyhanko.sign.diff_analysis.policy_api.ModificationLevel, pyhanko.sign.diff_analysis.rules_api.ReferenceUpdate]]
Apply the rule to the changes between two revisions.
- Parameters
old – The older, base revision.
new – The newer revision to be vetted.
- class pyhanko.sign.diff_analysis.rules_api.WhitelistRule
Bases:
object
Abstract base class for a whitelisting rule that simply outputs cleared references without specifying a modification level.
These rules are more flexible than rules of type
QualifiedWhitelistRule
, since the modification level can be specified separately (seeWhitelistRule.as_qualified()
).- apply(old: pyhanko.pdf_utils.reader.HistoricalResolver, new: pyhanko.pdf_utils.reader.HistoricalResolver) Iterable[pyhanko.sign.diff_analysis.rules_api.ReferenceUpdate]
Apply the rule to the changes between two revisions.
- Parameters
old – The older, base revision.
new – The newer revision to be vetted.
- as_qualified(level: pyhanko.sign.diff_analysis.policy_api.ModificationLevel) pyhanko.sign.diff_analysis.rules_api.QualifiedWhitelistRule
Construct a new
QualifiedWhitelistRule
that whitelists the object references from this rule at the level specified.- Parameters
level – The modification level at which the output of this rule should be cleared.
- Returns
A
QualifiedWhitelistRule
backed by this rule.
- class pyhanko.sign.diff_analysis.rules_api.ReferenceUpdate(updated_ref: pyhanko.pdf_utils.generic.Reference, paths_checked: Union[pyhanko.pdf_utils.reader.RawPdfPath, Iterable[pyhanko.pdf_utils.reader.RawPdfPath], NoneType] = None, blanket_approve: bool = False)
Bases:
object
- updated_ref: pyhanko.pdf_utils.generic.Reference
Reference that was (potentially) updated.
- paths_checked: Optional[Union[pyhanko.pdf_utils.reader.RawPdfPath, Iterable[pyhanko.pdf_utils.reader.RawPdfPath]]] = None
- blanket_approve: bool = False
- classmethod curry_ref(**kwargs)