util.py 308 Bytes
Newer Older
kaiyou's avatar
kaiyou committed
1 2 3 4 5 6 7 8 9 10
import importlib


def resolve(function, cache={}):
    """ Utility function that resolves a fully qualified function name
    """
    if function not in cache:
        module, name = function.rsplit(".", 1)
        cache[function] = getattr(importlib.import_module(module), name)
    return cache[function]