def loadAll():
    """Loads all DroneD Services that adhere to the Interface Definition
       of IDroneDService. The resulting dictionary will return in the form
       of {"SERVICENAME": "MODULE", ...}

       :Note technically this is a private method, because the server will
       hide it from you.

       @return (dict)
    """
    from kitt.interfaces import IDroneDService
    from twisted.python.log import err
    from twisted.python.failure import Failure
    import warnings
    import config
    import os

    global EXPORTED_SERVICES

    my_dir = os.path.dirname(__file__)

    for filename in os.listdir(my_dir):
        if not filename.endswith('.py'): continue
        if filename == '__init__.py': continue
        modname = filename[:-3]
        mod = None

        try:
            mod = __import__(__name__ + '.' + modname, {}, {}, [modname])
        except:
            err(Failure(), 'Exception Caught Importing Service module %s' % \
                    (modname,))
            continue #skip further checks

        if not mod: continue #fix for sphinx documentation
        #prefer module level interfaces first and foremost
        try:
            if IDroneDService.providedBy(mod):
                EXPORTED_SERVICES[mod.SERVICENAME] = mod
                continue #module level interfaces are considered singleton services
        except __HOLE__: pass
        except:
            err(Failure(), 'Exception Caught Validating Module Interface %s' % \
                    (name,))
        #see if any classes implement the desired interfaces
        for name,obj in vars(mod).items():
            try:
                if IDroneDService.implementedBy(obj):
                    EXPORTED_SERVICES[obj.SERVICENAME] = obj() #instantiate now
                    warnings.warn('loaded %s' % name)
                else:
                    warnings.warn('%s from %s does not provide ' + \
                            'IDroneDService Interface' % \
                            (name,modname))
            except TypeError: pass
            except:
                err(Failure(), 'Exception Caught Validating Interface %s' % \
                        (name,))

    #apply romeo configuration to all services
    for name, obj in EXPORTED_SERVICES.items():
        try: obj.SERVICECONFIG.wrapped.update(config.SERVICES.get(name, {}))
        except:
            err(Failure(), 'Exception Caught Setting Configuration %s' % \
                    (modname,))

    return EXPORTED_SERVICES
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/services/__init__.py/loadAll