<commit_before>import re

from datetime import timedelta
from itertools import chain


def parse_timedelta(timedelta_str):
    if not timedelta_str or timedelta_str == 'null':
        return None

    tokens = re.split(r' days?, ', timedelta_str)
    if len(tokens) == 1:
        days = '0'
        rest = tokens[0]
    else:
        days, rest = tokens

    days = int(days)
    hours, minutes, seconds = map(int, rest.split(':'))
    return timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds)


def flatten_list_2d(list_2d):
    return list(chain.from_iterable(list_2d))<commit_msg>Comma (,) is optional in common_utils.parse_timedelta<commit_after>import re

from datetime import timedelta
from itertools import chain


def parse_timedelta(timedelta_str):
    if not timedelta_str or timedelta_str == 'null':
        return None

    tokens = re.split(r' days?,? ', timedelta_str)
    if len(tokens) == 1:
        days = '0'
        rest = tokens[0]
    else:
        days, rest = tokens

    days = int(days)
    hours, minutes, seconds = map(int, rest.split(':'))
    return timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds)


def flatten_list_2d(list_2d):
    return list(chain.from_iterable(list_2d))
{'fraction_non_alphanumeric': 0.11039484286865431, 'fraction_numerical': 0.009669621273166801, 'mean_word_length': 3.5494505494505493, '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': '3384290', 'n_tokens_mistral': 430, 'n_tokens_neox': 406, 'n_words': 105}