dissec.patterns – Pattern definitions

class dissec.patterns.KeyModifier(value)

Modifier for dissect pattern keys.

NONE = 0
APPEND_WITH_ORDER = 1
APPEND = 2
FIELD_NAME = 4
FIELD_VALUE = 8
NAMED_SKIP = 16
pydantic model dissec.patterns.Key

Key for dissect patterns.

field append_position: int = 0

Whether to append the position.

field modifier: KeyModifier = <KeyModifier.NONE: 0>

Modifier.

field name: str = ''

Name of the dissect key.

field skip: bool = False

Whether to skip.

field skip_right_padding: bool = False

Whether to skip right padding.

classmethod parse(raw: str, /, *, runk: Runk | None = None) KeyType

Parse a key for a dissect pattern.

Parameters:
  • raw – Raw dissect key.

  • runk – Runk instance.

Returns:

Dissect key.

class dissec.patterns.Pattern(*, prefix: str = '', pairs: Sequence[tuple[Key, str]] = ())

Dissect pattern.

For more information, see Dissect patterns.

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 prefix: str

Prefix, i.e. chunk of text that must be ignored at the start.

property pairs: Sequence[tuple[Key, str]]

Key / delimiter pairs to use to parse the string.