<commit_before>def load_cfg(path):
    from flask import json, current_app

    f = open(path, 'r')
    data = json.load(f)

    current_app.config["MAP"] = data["Map"]
    current_app.config["DATABASE"] = data["Database"]
    for cfg_name in data["Flask"]:
        current_app.config[cfg_name] = data["Flask"][cfg_name]<commit_msg>Add token lifetime in global config<commit_after>def load_cfg(path):
    from flask import json, current_app
    from datetime import datetime, timedelta

    f = open(path, 'r')
    data = json.load(f)

    current_app.config["MAP"] = data["Map"]
    current_app.config["DATABASE"] = data["Database"]
    for cfg_name in data["Flask"]:
        if cfg_name == "token_life":
            t = datetime.strptime(data["Flask"][cfg_name],"%H:%M:%S")
            delta = timedelta(hours=t.hour, minutes=t.minute, seconds=t.second)
            current_app.config[cfg_name] = delta
        else:
            current_app.config[cfg_name] = data["Flask"][cfg_name]
{'fraction_non_alphanumeric': 0.14619289340101524, 'fraction_numerical': 0.0, 'mean_word_length': 3.481818181818182, 'pattern_counts': {'":': 1, '<': 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': '5785649', 'n_tokens_mistral': 334, 'n_tokens_neox': 324, 'n_words': 65}