# Path: habitat/utils/dynamicloader.py
# def load(loadable, force_reload=False):
# def fullname(loadable):
# def isclass(thing):
# def isfunction(thing):
# def isgeneratorfunction(thing):
# def issubclass(thing, the_other_thing):
# def hasattr(thing, attr):
# def isstandardfunction(thing):
# def hasnumargs(thing, num):
# def hasmethod(loadable, name):
# def iscallable(loadable):
# def _expectify(error):
#     def decorator(function):
#         def new_function(*args, **kwargs):


from .utils import dynamicloader
    def load(self, module, shorthand):
        """Loads *module* as a library and assigns it to *shorthand*."""

        module = dynamicloader.load(module)
        self.libraries[shorthand] = module

    def run(self, name, config, data):
        """
        Run the loadable specified by *name*, giving it *config* and *data*.

        If the loadable only takes one argument, it will only be given *data*.
        *config* is ignored in this case.

        Returns the result of running the loadable.
        """

        name_parts = name.split('.')
        library_name = '.'.join(name_parts[0:-1])
        function_name = name_parts[-1]

        if library_name not in self.libraries:
            raise ValueError("Invalid library name: " + library_name)

        library = self.libraries[library_name]

        if function_name not in library.__all__:
            raise ValueError("Invalid function name: " + function_name)

        func = getattr(library, function_name)


# Path: habitat/utils/dynamicloader.py
# def load(loadable, force_reload=False):
# def fullname(loadable):
# def isclass(thing):
# def isfunction(thing):
# def isgeneratorfunction(thing):
# def issubclass(thing, the_other_thing):
# def hasattr(thing, attr):
# def isstandardfunction(thing):
# def hasnumargs(thing, num):
# def hasmethod(loadable, name):
# def iscallable(loadable):
# def _expectify(error):
#     def decorator(function):
#         def new_function(*args, **kwargs):


# Path: habitat/loadable_manager.py
from .utils import dynamicloader

    def load(self, module, shorthand):
        """Loads *module* as a library and assigns it to *shorthand*."""

        module = dynamicloader.load(module)
        self.libraries[shorthand] = module

    def run(self, name, config, data):
        """
        Run the loadable specified by *name*, giving it *config* and *data*.

        If the loadable only takes one argument, it will only be given *data*.
        *config* is ignored in this case.

        Returns the result of running the loadable.
        """

        name_parts = name.split('.')
        library_name = '.'.join(name_parts[0:-1])
        function_name = name_parts[-1]

        if library_name not in self.libraries:
            raise ValueError("Invalid library name: " + library_name)

        library = self.libraries[library_name]

        if function_name not in library.__all__:
            raise ValueError("Invalid function name: " + function_name)

        func = getattr(library, function_name)


        if dynamicloader.hasnumargs(func, 1):