<commit_before>"""
String to boolean conversion
"""
__all__ = ['convert_bool']


def convert_bool(value):
    """
    Returns the value as a boolean if appropriate

    The value is converted into a boolean if possible. The value will be
    returned unmodified if no suitable conversion found.
    """
    if value.lower() in ('yes', 'true', '1'):
        value = True
    elif value.lower() in ('no', 'false', '0', ''):
        value = False

    return value<commit_msg>Updated convert_bool to leverage distutils.util.strtobool<commit_after>"""
String to boolean conversion
"""
from distutils.util import strtobool

__all__ = ['convert_bool']


def convert_bool(value):
    """
    Returns the value as a boolean

    The value is converted into a boolean if possible. ValueError is raised
    when the value cannot be converted.
    """
    if value == '':
        return False

    return bool(strtobool(value))
{'fraction_non_alphanumeric': 0.1037117903930131, 'fraction_numerical': 0.002183406113537118, 'mean_word_length': 3.2453703703703702, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2091240', 'n_tokens_mistral': 254, 'n_tokens_neox': 252, 'n_words': 102}