<commit_before>from hoerapi.errors import MissingAttributeError, InvalidDataError


def parser_list(clazz, data):
    items = []

    if isinstance(data, list):
        for item in data:
            items.append(parser_object(clazz, item))
    else:
        raise InvalidDataError('not an array')

    return items


def parser_object(clazz, data):
    try:
        return clazz(data)
    except KeyError as e:
        raise MissingAttributeError(e)<commit_msg>use list comprehension in parser_list<commit_after>from hoerapi.errors import MissingAttributeError, InvalidDataError


def parser_list(clazz, data):
    if isinstance(data, list):
        return [parser_object(clazz, item) for item in data]
    else:
        raise InvalidDataError('not an array')


def parser_object(clazz, data):
    try:
        return clazz(data)
    except KeyError as e:
        raise MissingAttributeError(e)
{'fraction_non_alphanumeric': 0.07941834451901567, 'fraction_numerical': 0.0, 'mean_word_length': 3.3446601941747574, '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': '4287129', 'n_tokens_mistral': 265, 'n_tokens_neox': 252, 'n_words': 75}