pestifer.util.formatvalidator module

class pestifer.util.formatvalidator.FormatValidator(fmt: str, field_patterns: Dict[str, str] | None = None, *, greedy: bool = False, flexible_ws: bool = False)[source]

Bases: object

Build a validator for a given .format-style template. Supports named (recommended) or positional fields. Repeated fields are enforced via backreferences.

extract(s: str) Dict[str, str] | None[source]
fullmatch(s: str) bool[source]
property pattern: str
pestifer.util.formatvalidator.extract_from_format(fmt: str, s: str, field_patterns: Dict[str, str] | None = None, *, greedy: bool = False, flexible_ws: bool = False) Dict[str, str] | None[source]
pestifer.util.formatvalidator.validate_format(fmt: str, s: str, field_patterns: Dict[str, str] | None = None, *, greedy: bool = False, flexible_ws: bool = False) bool[source]