def load_directives(self,inherits):
        '''there has got to be a better way
           plugin pattern away!!!
           
           #1 this could be a comprehension but it'd be hard
              to read.
           #2 maybe we should put a dummy sys.modules in place
              while doing this to limit junk in the name space.
        '''
        m = self.__class__.__module__
        exclude = ['__init__.py']
        relpath = sys.modules[m].__file__
        reldir = os.path.split(relpath)[0]
        fulldir = os.path.realpath(reldir)
        pyfiles = []
        for f in os.listdir(fulldir): #1
            ff = os.path.join(fulldir,f)
            if os.path.isfile(ff): pyfiles.append(f)
        pyfiles = [f for f in pyfiles if f.endswith(".py")]
        pyfiles = [f for f in pyfiles if f not in exclude]
        pyfiles = [f[:-3] for f in pyfiles]
        candidates = []
        for py in pyfiles:
            m = __import__(py,globals(),locals(),"romeo.directives") #2
            for i in dir(m):
                attr = getattr(m,i)
                if not type(attr) == types.TypeType: continue
                matches = [cls for cls in inherits 
                           if issubclass(attr,cls)
                           if attr.__name__ != cls.__name__]
                if len(matches) == len(inherits): candidates.append(attr)
        for c in candidates:
            cinst = c( c.name,self.root,*c.init_args(self),**c.init_kwargs(self) )
            self.directives.append(cinst)
dataset/ETHPy150Open OrbitzWorldwide/droned/romeo/lib/romeo/directives/__init__.py/Preprocessor.load_directives/original