<commit_before>"""This module is used on every CLI operation"""
import os
import sys
import inspect
import imp
from symautomata.alphabet import createalphabet
sys.path.insert(1, imp.find_module('lightbulb')[1]+'/core/modules')
moduleNames = [name[:-3] for name in os.listdir(imp.find_module('lightbulb')[1]+'/core/modules')
               if name.endswith(".py")]


def options_as_dictionary(meta):
    """
    Transforms a list of tuples to a dictionary
    Args:
        meta (list): A list ot option tuples
    Retuns:
        dict: A dictionary of options key - values
    """
    module_config = {}
    for seltuple in meta:
        module_config.update({seltuple[0]: seltuple[1]})
    return  module_config

def importmodule(name):

    mod = __import__(name)
    components = name.split('.')
    for comp in components[1:]:
        mod = getattr(mod, comp)
    return mod

def create_object(object_type, object_type_configuration, handler, handler_configuration):
    object_mod = importmodule('lightbulb.core.modules.' + object_type.lower())
    object_class = getattr(object_mod, object_type)
    handler_mod = importmodule('lightbulb.core.utils.' + handler.lower())<commit_msg>Update dynamic import module to support Jython:<commit_after>"""This module is used on every CLI operation"""
import os
import sys
import inspect
import imp
from symautomata.alphabet import createalphabet
sys.path.insert(1, imp.find_module('lightbulb')[1]+'/core/modules')
moduleNames = [name[:-3] for name in os.listdir(imp.find_module('lightbulb')[1]+'/core/modules')
               if name.endswith(".py")]


def options_as_dictionary(meta):
    """
    Transforms a list of tuples to a dictionary
    Args:
        meta (list): A list ot option tuples
    Retuns:
        dict: A dictionary of options key - values
    """
    module_config = {}
    for seltuple in meta:
        module_config.update({seltuple[0]: seltuple[1]})
    return  module_config

def importmodule(name):
    try:
       try:
          mod = __import__(name)
       except:
          print 'using alternative way to load ', name
          modfile, pathname, description = imp.find_module(name)
          mod = imp.load_module(name, modfile, pathname, description)
          print 'module was successfully loaded'
       components = name.split('.')
       for comp in components[1:]:
           mod = getattr(mod, comp)
    except ImportError as error:
       print 'error'
       print error.__class__.__name__ + ": " + error.message

    return mod

def create_object(object_type, object_type_configuration, handler, handler_configuration):
    object_mod = importmodule('lightbulb.core.modules.' + object_type.lower())
    object_class = getattr(object_mod, object_type)
    handler_mod = importmodule('lightbulb.core.utils.' + handler.lower())
{'fraction_non_alphanumeric': 0.11126910771418415, 'fraction_numerical': 0.004976892996800568, 'mean_word_length': 3.4454976303317535, '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': '883634', 'n_tokens_mistral': 843, 'n_tokens_neox': 828, 'n_words': 226}