dissec.patterns
– Pattern definitions¶
- class dissec.patterns.BasicKey(*, name: str, skip_right_padding: Any = False)¶
Basic key for dissect patterns.
- name: Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None)]¶
Name of the key.
- classmethod parse(raw: str, /) BasicKeyType ¶
Parse a basic key.
- Parameters:
raw – Textual form of the key to parse.
- Returns:
Pattern.
- Raises:
ValueError – Could not parse a key.
- class dissec.patterns.SkipKey(*, name: str = '', skip_right_padding: Any = False)¶
Skip key for dissect patterns.
- classmethod parse(raw: str, /) SkipKeyType ¶
Parse a skip key.
- Parameters:
raw – Textual form of the key to parse.
- Returns:
Pattern.
- Raises:
ValueError – Could not parse a key.
- class dissec.patterns.AppendKey(*, name: str, append_order: int | None = None, skip_right_padding: Any = False)¶
Append key for dissect patterns.
- classmethod parse(raw: str, /) AppendKeyType ¶
Parse a skip key.
- Parameters:
raw – Textual form of the key to parse.
- Returns:
Pattern.
- Raises:
ValueError – Could not parse a key.
- class dissec.patterns.FieldNameKey(*, name: str, skip_right_padding: Any = False)¶
Field name key for dissect patterns.
- name: Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None)]¶
Optional name of the skip key.
- classmethod parse(raw: str, /) FieldNameKeyType ¶
Parse a skip key.
- Parameters:
raw – Textual form of the key to parse.
- Returns:
Pattern.
- Raises:
ValueError – Could not parse a key.
- class dissec.patterns.FieldValueKey(*, name: str, skip_right_padding: Any = False)¶
Field value key for dissect patterns.
- name: Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None)]¶
Optional name of the skip key.
- classmethod parse(raw: str, /) FieldValueKeyType ¶
Parse a skip key.
- Parameters:
raw – Textual form of the key to parse.
- Returns:
Pattern.
- Raises:
ValueError – Could not parse a key.
- dissec.patterns.Key¶
Key type for dissect patterns.
alias of
BasicKey
|SkipKey
|AppendKey
|FieldNameKey
|FieldValueKey
- class dissec.patterns.Pattern(*, prefix: str = '', pairs: Sequence[tuple[BasicKey | SkipKey | AppendKey | FieldNameKey | FieldValueKey, str]] = ())¶
Dissect pattern.
For more information, see Dissect patterns.
- classmethod parse_key(raw: str, /, *, runk: Runk | None = None) Key ¶
Parse a key for a dissect pattern.
- Parameters:
raw – Raw dissect key.
runk – Runk instance.
- Returns:
Dissect key.
- classmethod parse(raw: str, /, *, runk: Runk | None = None) PatternType ¶
Parse a pattern.
- Parameters:
raw – Textual form of the pattern to parse.
runk – Runk instance to start from.
- Returns:
Pattern.
- property pairs: Sequence[tuple[BasicKey | SkipKey | AppendKey | FieldNameKey | FieldValueKey, str]]¶
Key / delimiter pairs to use to parse the string.