torch_ecg.utils.str2bool#

torch_ecg.utils.str2bool(v: str | bool | None, *, default: bool = False, strict: bool = True) bool[source]#

Converts a “boolean” value possibly in the format of str to bool.

Modified from [1].

Parameters:
  • v (str or bool or None) – The “boolean” value.

  • default (bool, default False) –

    The default value to return if v is None, or if strict is False and v could not be converted.

    Added in version 0.0.32.

  • strict (bool, default True) –

    Whether to raise error if v could not be converted.

    Added in version 0.0.32.

Returns:

v in the format of a bool.

Return type:

bool

References