@classmethod
    def _getDependencies(cls, parameters):
        
        def getDep(dep_type):

            # Get the precise dependencies 
            dep_attr = dep_type + '_dependencies'

            def process_dependency(dl):
                def wrong_type(s):
                    raise TypeError("'%s' dependency type '%s' for module '%s' not understood"
                                    % (dep_type, str(type(s)), cls._name))
                
                def clean(s):
                    if type(s) is str:
                        return s.strip().lower()
                    elif not getattr(s, "__parameter_container__", False):
                        wrong_type(s)
                    return s
                    
                if type(dl) is str or getattr(dl, "__parameter_container__", False):
                    s = [dl]
                elif type(dl) in [list, tuple, set]:
                    s = list(dl)
                elif dl is None:
                    s = []
                else:
                    wrong_type(dl)
                    
                s = [clean(se) for se in s]

                return [se for se in s if se != ""]

            if hasattr(cls, dep_attr):
                dependency_function = getattr(cls, dep_attr)

                if type(dependency_function) in [list, tuple, set, str]:
                    return process_dependency(dependency_function)

                null_ = "_null_"

                deps = null_
                
                pb = parameters[cls._name]
                
                for t in [[], [pb], [pb,parameters]]:
                    try:
                        deps = dependency_function(*t)
                        break
                    except TypeError, te:

                        if dep_attr in str(te):
                            continue
                        else:
                            raise

                if deps is null_:
                    raise TypeError(("%s() for %s must be a string, list, tuple, set or "
                                     "take either no parameters, the local parameter "
                                     "tree, or the local and global parameter trees.")
                                    % (dep_attr, cls._name))

                
                return process_dependency(deps)   

            else:
                return []

        mod_dep = getDep("module")
        res_dep = getDep("result")
        par_dep = getDep("parameter")

        return (mod_dep, res_dep, par_dep)
dataset/ETHPy150Open hoytak/lazyrunner/lazyrunner/pmodule/pmodulebase.py/PModule._getDependencies/original