parse_bool_list¶
tiatoolbox.cli.common.parse_bool_list
- parse_bool_list(_ctx, _param, value)[source]¶
Parse a comma-separated list of boolean values for a Click option.
This function is intended for use as a Click callback. It converts a comma-separated string (e.g.,
"true,false,1,0") into a tuple of Python booleans. Each item is stripped, lowercased, and validated against a set of accepted truthy and falsy representations.- Accepted truthy values:
"true","1","yes","y"- Accepted falsy values:
"false","0","no","n"
- Parameters:
ctx (click.Context) – The Click context object (unused but required by Click callback API).
param (click.Parameter) – The Click parameter object (unused but required by Click callback API).
value (str | None) – The raw string provided by the user. If
None, the function returnsNoneunchanged._ctx (Context)
_param (Parameter)
- Returns:
A tuple of parsed boolean values, or
Noneif no value was provided.- Return type:
- Raises:
click.BadParameter – If any item in the comma-separated list is not a valid boolean string.