manen.helpers#
Helpers functions used by manen
.
- manen.helpers.batch(iterable, size: int = 1)[source]#
Slice an iterable into batches of given size.
- Parameters:
iterable (Iterable) – iterable to slice into batches
n (int, optional) – size of each batch. Default to 1.
- Return type:
Iterable
- manen.helpers.extract_integer(string: str) int [source]#
Extract an integer from a string.
- Parameters:
string (str) – text to process
- Raises:
ValueError – exception raised if no integer were fonnd in the string.
- Returns:
integer extracted from the string
- Return type:
- manen.helpers.version(version_str: str) Version [source]#
Helper function to convert a version string into a tuple. The versioning scheme is described here. The input will be validated with the regular expression
^[\d]+.[\d]+.[\d]+.[\d]+$
and raised aValueError
if it doesn’t match.Caution
This versioning system is not compliant with semantic versioning rules.
- Parameters:
version_str – string to be converted to a tuple
- Raises:
ValueError – raised if the input doesn’t match the pattern
- Returns:
parsed version
- Return type: