fitzzftw.baselib.converter

Future Package Migration

This module is scheduled to be moved into a separate package in the near future.

No action required: Due to the use of namespace packages, your import paths (e.g., from fitzzftw.baselib...) will remain unchanged. Your existing code will continue to work without any modifications after the transition.

Functions

str2bool(value)

Convert a string or boolean to a real boolean value.

str2bool(value)[source]

Convert a string or boolean to a real boolean value.

This function is designed for CLI and configuration parsing. It interprets ‘true’, ‘yes’, ‘1’, ‘on’ as True and their opposites as False.

Parameters:

value (str | bool) – The value to be converted.

Raises:

ValueError – If the value cannot be mapped to a boolean.

Returns:

The resulting boolean value.

Return type:

bool