<commit_before>import ConfigParser
cfg = {}
cp = ConfigParser.ConfigParser()
cp.read('/home/ente/src/ente.cfg')
for section in cp.sections():
    sec_cfg = dict([(key.lower(), value) for key, value in cp.items(section)])
    cfg[section.lower()] = sec_cfg

def get_section(s):
    return cfg[s.lower()]

def get_entry(e, default=None):
    section, key = e.lower().split(".", 1)
    return cfg.get(section, {}).get(key, default)

def add_change_hook(f):
    pass

from __main__ import global_stuff
global_stuff.config_funcs = [get_section, get_entry, add_change_hook]

import ente_init
ente_init.init_io_redirect("utf-8")<commit_msg>start celery as bg thread, but crashes<commit_after>import ConfigParser
cfg = {}
cp = ConfigParser.ConfigParser()
cp.read('/home/ente/src/ente.cfg')
for section in cp.sections():
    sec_cfg = dict([(key.lower(), value) for key, value in cp.items(section)])
    cfg[section.lower()] = sec_cfg

def get_section(s):
    return cfg[s.lower()]

def get_entry(e, default=None):
    section, key = e.lower().split(".", 1)
    return cfg.get(section, {}).get(key, default)

def add_change_hook(f):
    pass

from __main__ import global_stuff
global_stuff.config_funcs = [get_section, get_entry, add_change_hook]

import ente_init
ente_init.init_io_redirect("utf-8")

import sys
sys.argv = ["run.py"]
import tasks.tasks
reload(tasks.tasks)

from __main__ import bootstrap_thread
#ente_init.set_bgthread_hook(lambda *a, **kw: bootstrap_thread(tasks.tasks.app.worker_main))
#def whatever(*a, **kw):
#    while True:
#        print "WHRASD", a, kw
#    sys.exit(0)
#ente_init.set_bgthread_hook(whatever)
{'fraction_non_alphanumeric': 0.14707692307692308, 'fraction_numerical': 0.003076923076923077, 'mean_word_length': 5.022222222222222, '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': '5788910', 'n_tokens_mistral': 582, 'n_tokens_neox': 574, 'n_words': 129}