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: HistoricalResolver, new: HistoricalResolver) Iterable[Tuple[ModificationLevel, 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: HistoricalResolver, new: HistoricalResolver) Iterable[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: ModificationLevel) 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, context_checked: Union[pyhanko.sign.diff_analysis.rules_api.Context, NoneType] = None)
Bases:
object
- classmethod curry_ref(**kwargs)
- property approval_type: ApprovalType
- class pyhanko.sign.diff_analysis.rules_api.Context
Bases:
object
- classmethod from_absolute(pdf_handler: PdfHandler, absolute_path: RawPdfPath) AbsoluteContext
- classmethod relative_to(start: Union[DictionaryObject, ArrayObject], path: Union[RawPdfPath, int, str]) RelativeContext
- descend(path: Union[RawPdfPath, int, str]) Context
- class pyhanko.sign.diff_analysis.rules_api.RelativeContext(anchor: pyhanko.pdf_utils.generic.Dereferenceable, relative_path: pyhanko.pdf_utils.reader.RawPdfPath)
Bases:
Context
- anchor: Dereferenceable
Reference to the container object. In comparisons, this should be the reference tied to the older revision.
- relative_path: RawPdfPath
Path to the object from the container.
- descend(path: Union[RawPdfPath, int, str]) RelativeContext
- class pyhanko.sign.diff_analysis.rules_api.AbsoluteContext(path: pyhanko.pdf_utils.reader.RawPdfPath, pdf_handler: pyhanko.pdf_utils.rw_common.PdfHandler = None)
Bases:
Context
- path: RawPdfPath
Absolute path from the trailer.
- pdf_handler: PdfHandler = None
The PDF handler to which this context is tied.
- property relative_view: RelativeContext
- descend(path: Union[RawPdfPath, int, str]) AbsoluteContext