This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.3.

Text utilitites - kombu.utils.text

Text Utilities.

kombu.utils.text.escape_regex(p: str, white: str = '') str[source]

Escape string for use within a regular expression.

kombu.utils.text.fmatch_best(needle: str, haystack: Iterable[str], min_ratio: float = 0.6) str | None[source]

Fuzzy match - Find best match (scalar).

kombu.utils.text.fmatch_iter(needle: str, haystack: Iterable[str], min_ratio: float = 0.6) Iterator[tuple[float, str]][source]

Fuzzy match: iteratively.

Yields:

Tuple (of ratio and key.)

kombu.utils.text.version_string_as_tuple(version: str) version_info_t[source]

Parse a version string into its components and return a version_info_t tuple.

The version string is expected to follow the pattern: ‘major.minor.micro[releaselevel][serial]’. Each component of the version is extracted and returned as a tuple in the format (major, minor, micro, releaselevel, serial).

Parameters:

(str) (version)

Returns:

version_info_t

Return type:

A tuple containing the parsed version components.

Raises:

ValueError – If the version string is invalid and does not match the expected pattern.: