<commit_before>import os
import json
from tasks.meta import OBSTimespan

TIMESPANS_FILE = 'timespans.json'
TIMESPAN_ID = 'id'
TIMESPAN_NAME = 'name'
TIMESPAN_DESCRIPTION = 'description'
TIMESPAN_TIMESPAN = 'timespan'


def get_timespan(timespan_id):
    JSONFile = os.path.join(os.path.dirname(__file__), TIMESPANS_FILE)
    with open(JSONFile) as infile:
        timespan_json = json.load(infile).get(timespan_id)

        return OBSTimespan(id=timespan_json.get(TIMESPAN_ID),
                           name=timespan_json.get(TIMESPAN_NAME),
                           description=timespan_json.get(TIMESPAN_DESCRIPTION),
                           timespan=timespan_json.get(TIMESPAN_TIMESPAN))<commit_msg>Converting to string for flexibility<commit_after>import os
import json
from tasks.meta import OBSTimespan

TIMESPANS_FILE = 'timespans.json'
TIMESPAN_ID = 'id'
TIMESPAN_NAME = 'name'
TIMESPAN_DESCRIPTION = 'description'
TIMESPAN_TIMESPAN = 'timespan'


def get_timespan(timespan_id):
    JSONFile = os.path.join(os.path.dirname(__file__), TIMESPANS_FILE)
    with open(JSONFile) as infile:
        timespan_json = json.load(infile).get(str(timespan_id))

        return OBSTimespan(id=timespan_json.get(TIMESPAN_ID),
                           name=timespan_json.get(TIMESPAN_NAME),
                           description=timespan_json.get(TIMESPAN_DESCRIPTION),
                           timespan=timespan_json.get(TIMESPAN_TIMESPAN))
{'fraction_non_alphanumeric': 0.08990318118948824, 'fraction_numerical': 0.0, 'mean_word_length': 3.4250764525993884, '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': '297506', 'n_tokens_mistral': 487, 'n_tokens_neox': 477, 'n_words': 71}