<commit_before>import re, thread

import numpy
import maskedarray as ma
import timeseries as ts

import cfame
from cfame import FAME_CONSTANTS

__all__ = [
    'FameDb', 'set_option', 'license_expires', 'DBError'
           ]

_g = globals()
for var, val in FAME_CONSTANTS.iteritems():
    _g[var] = val
    
__all__.extend(list(FAME_CONSTANTS))

def reverse_dict(d):
    return dict([(y, x) for x, y in d.iteritems()])

def convert_dict(d, key_func=lambda x:x, val_func=lambda x:x):
    return dict([(key_func(key), val_func(val)) for key, val in d.iteritems()])

basis_map = { HBSUND:"U",
              HBSDAY:"D",
              HBSBUS:"B"}
basis_revmap = reverse_dict(basis_map)

observed_map = { HOBUND:"UNDEFINED",
                 HOBBEG:"BEGINNING",
                 HOBEND:"ENDING",
                 HOBAVG:"AVERAGED",
                 HOBSUM:"SUMMED",
                 HOBANN:"ANNUALIZED",
                 HOBFRM:"FORMULA",
                 HOBHI:"MAXIMUM",
                 HOBLO:"MINIMUM"}
observed_revmap = reverse_dict(observed_map)<commit_msg>moved fame constants into their own name space<commit_after>import re, thread

import numpy
import maskedarray as ma
import timeseries as ts

import cfame
from const import *

__all__ = [
    'FameDb', 'set_option', 'license_expires', 'DBError'
           ]

def reverse_dict(d):
    return dict([(y, x) for x, y in d.iteritems()])

def convert_dict(d, key_func=lambda x:x, val_func=lambda x:x):
    return dict([(key_func(key), val_func(val)) for key, val in d.iteritems()])

basis_map = { HBSUND:"U",
              HBSDAY:"D",
              HBSBUS:"B"}
basis_revmap = reverse_dict(basis_map)

observed_map = { HOBUND:"UNDEFINED",
                 HOBBEG:"BEGINNING",
                 HOBEND:"ENDING",
                 HOBAVG:"AVERAGED",
                 HOBSUM:"SUMMED",
                 HOBANN:"ANNUALIZED",
                 HOBFRM:"FORMULA",
                 HOBHI:"MAXIMUM",
                 HOBLO:"MINIMUM"}
observed_revmap = reverse_dict(observed_map)
{'fraction_non_alphanumeric': 0.12152777777777778, 'fraction_numerical': 0.0, 'mean_word_length': 2.5262237762237763, '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': '6799866', 'n_tokens_mistral': 713, 'n_tokens_neox': 691, 'n_words': 147}