def pmodule(c):
    global _pmodule_lookup    
    
    name = c._name = c.__name__.lower()
    
    assert type(name) is str

    ret = _pmodule_lookup.setdefault(name, c)
    
    if not ret is c:
        if (inspect.getsourcefile(ret) == inspect.getsourcefile(c)
            or inspect.getfile(ret) == inspect.getfile(c)):
        
            return c         
        
        raise NameError("Processing Module '%s' doubly defined in files %s and %s." 
                        % (name, inspect.getfile(ret), inspect.getfile(c)))

        
    c.log = logging.getLogger(c._name)

    parameters.processPModule(c)

    parameters.registerPreset("r." + name, PModulePreset(name),
                              description = "Runs processing module '%s'." % c.__name__)
    
    logging.getLogger("Manager").debug("Processing module '%s' registered." % c.__name__)
        
    c._is_pmodule = True
    
    return c
dataset/ETHPy150Open hoytak/lazyrunner/lazyrunner/pmodule/lookup.py/pmodule/original