dissec.keys – Key definitions

class dissec.keys.AppendKey(*, name: str, append_order: int | None = None, skip_right_padding: Any = False)

Append key for dissect patterns.

name: Annotated[str, StringConstraints(min_length=1)]

Optional name of the skip key.

append_order: int | None

The position at which to append the key.

skip_right_padding: bool

Whether to skip right padding.

classmethod parse(raw: str, /) AppendKeyT

Parse a skip key.

Parameters:

raw – Textual form of the key to parse.

Returns:

Pattern.

Raises:

ValueError – Could not parse a key.

class dissec.keys.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.

skip_right_padding: bool

Whether to skip right padding.

classmethod parse(raw: str, /) BasicKeyT

Parse a basic key.

Parameters:

raw – Textual form of the key to parse.

Returns:

Pattern.

Raises:

ValueError – Could not parse a key.

class dissec.keys.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.

skip_right_padding: bool

Whether to skip right padding.

classmethod parse(raw: str, /) FieldNameKeyT

Parse a skip key.

Parameters:

raw – Textual form of the key to parse.

Returns:

Pattern.

Raises:

ValueError – Could not parse a key.

class dissec.keys.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.

skip_right_padding: bool

Whether to skip right padding.

classmethod parse(raw: str, /) FieldValueKeyT

Parse a skip key.

Parameters:

raw – Textual form of the key to parse.

Returns:

Pattern.

Raises:

ValueError – Could not parse a key.

dissec.keys.Key

Key type for dissect patterns.

alias of BasicKey | SkipKey | AppendKey | FieldNameKey | FieldValueKey

class dissec.keys.SkipKey(*, name: str = '', skip_right_padding: Any = False)

Skip key for dissect patterns.

name: str

Optional name of the skip key.

skip_right_padding: bool

Whether to skip right padding.

classmethod parse(raw: str, /) SkipKeyT

Parse a skip key.

Parameters:

raw – Textual form of the key to parse.

Returns:

Pattern.

Raises:

ValueError – Could not parse a key.