<commit_before>#!/bin/python
#Praise the libev sample

import time
import multiprocessing
from multiprocessing.reduction import reduce_handle, rebuild_handle
import Queue
import os
import sys
import re
import socket
import signal
import errno
import logging
import sys
import pyev
import ConfigParser

try:
    import resource
    resource.setrlimit(resource.RLIMIT_NOFILE, (5000000, -1))
except ValueError:
    pass 

logging.basicConfig(level=logging.INFO)

STOPSIGNALS = (signal.SIGINT, signal.SIGTERM)
NONBLOCKING = (errno.EAGAIN, errno.EWOULDBLOCK)
    
cfile = open('osiris.conf', 'r')   
config = ConfigParser.ConfigParser()
config.readfp(cfile)
cfile.close

try:
    debug = int(config.get("OSIRIS","debug"))
except:
    debug = 0

try:
    proxy = int(config.get("OSIRIS","proxy"))
except:
    proxy = 0

sys.path.append('./app')
exec_app = {}
host_mod = {}
for i in range(len(config.sections())):
    if config.sections()[i] != "OSIRIS":
        exec_app[config.sections()[i]] = __import__(config.get(config.sections()[i],'mod'))
        host_mod[config.sections()[i]] = config.get(config.sections()[i],'mod')

class app():
    srv_str = "Server: OSIRIS Mach/4\r\n"
<commit_msg>Reduce config lookups by reusing values<commit_after>#!/bin/python
#Praise the libev sample

import time
import multiprocessing
from multiprocessing.reduction import reduce_handle, rebuild_handle
import Queue
import os
import sys
import re
import socket
import signal
import errno
import logging
import sys
import pyev
import ConfigParser

try:
    import resource
    resource.setrlimit(resource.RLIMIT_NOFILE, (5000000, -1))
except ValueError:
    pass 

logging.basicConfig(level=logging.INFO)

STOPSIGNALS = (signal.SIGINT, signal.SIGTERM)
NONBLOCKING = (errno.EAGAIN, errno.EWOULDBLOCK)
    
cfile = open('osiris.conf', 'r')   
config = ConfigParser.ConfigParser()
config.readfp(cfile)
cfile.close

try:
    debug = int(config.get("OSIRIS","debug"))
except:
    debug = 0

try:
    proxy = int(config.get("OSIRIS","proxy"))
except:
    proxy = 0

sys.path.append('app')
exec_app = {}
host_mod = {}
for i in range(len(config.sections())):
    if config.sections()[i] != "OSIRIS":
        _domain = config.sections()[i]
        _mod_name = config.get(config.sections()[i],'mod')
        exec_app[_domain] = __import__(_mod_name)
        host_mod[_domain] = _mod_name

class app():
    srv_str = "Server: OSIRIS Mach/4\r\n"

{'fraction_non_alphanumeric': 0.1300745650372825, 'fraction_numerical': 0.009113504556752278, 'mean_word_length': 4.476190476190476, 'pattern_counts': {'":': 2, '<': 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': '4835725', 'n_tokens_mistral': 853, 'n_tokens_neox': 818, 'n_words': 191}