Get function from module
    :param func_name: function name
    :param module_pathname:  pathname to module
    :return:
7262
def get_func(func_name, module_pathname):
    

    if sys.version_info[0] >= 3:
        if sys.version_info[1] >= 6:
            import importlib.util
            spec = importlib.util.spec_from_file_location('module_name', module_pathname)
            cells_module = importlib.util.module_from_spec(spec)
            spec.loader.exec_module(cells_module)
            return getattr(cells_module, func_name)
        elif sys.version_info[1] >= 4:
            import importlib.machinery
            module = importlib.machinery.SourceFileLoader('module_name', module_pathname).load_module()
            return getattr(module, func_name)

    fatal('Python version {} not supported'.format(sys.version))
127326
def get_func_task_path(func):
    
    module_path = inspect.getmodule(func).__name__
    task_path = '{module_path}.{func_name}'.format(
                                        module_path=module_path,
                                        func_name=func.__name__
                                    )
    return task_path
548305
def _get_registerd_func(name_or_func):
    
    # get the function or register callable
    if callable(name_or_func):
        func = register_array_xcorr(name_or_func)
    else:
        func = XCOR_FUNCS[name_or_func or 'default']
    assert callable(func), 'func is not callable'
    # ensure func has the added methods
    if not hasattr(func, 'registered'):
        func = register_array_xcorr(func)
    return func
720010
def query_func_module(self, func):
        """"""
        exp = self.session.query(Export).filter_by(
            func=func).first()
        if exp:
            return exp
        logging.debug(_('Function not found: %s'), func)
        alt = func + 'A'
        exp = self.session.query(Export).filter_by(
            func=alt).first()
        if exp:
            logging.warning(_('Using ANSI version: %s'), alt)
            return exp
        logging.warning(_('Not handled: %s or %s'), func, alt)
        return None
748697
def get_lambda_function(self, function_name):
        
        response = self.lambda_client.get_function(
                FunctionName=function_name)
        return response['Configuration']['FunctionArn']
1011002
def get_name(self, func):
        '''
        
        '''
        if hasattr(func, 'name'):
            return func.name

        return '%s.%s' % (
            func.__module__,
            func.__name__
        )
591761
def str_func(name):
    
    def func(mapping, bind, values):
        for v in values:
            if isinstance(v, six.string_types):
                v = getattr(v, name)()
            yield v
    return func
1274940
def call_user_func(settings_module, func_name, *args, **kwargs):
    
    if settings_module:
        if hasattr(settings_module, func_name):
            func = getattr(settings_module, func_name)
            try:
                return func(*args, **kwargs)
            finally:
                # cleanup user function
                delattr(settings_module, func_name)
394117
def list_functions(mod_name):
    
    mod = sys.modules[mod_name]
    return [func.__name__ for func in mod.__dict__.values()
            if is_mod_function(mod, func)]
759206
def _function_signature(func):
    
    if sys.version_info.major > 2:
        # Python 3 already implements this functionality
        return func.__name__ + str(inspect.signature(func))

    # In Python 2 we have to do it manually, unfortunately
    spec = inspect.getargspec(func)
    posargs = spec.args
    defaults = spec.defaults if spec.defaults is not None else []
    varargs = spec.varargs
    kwargs = spec.keywords
    deflen = 0 if defaults is None else len(defaults)
    nodeflen = 0 if posargs is None else len(posargs) - deflen

    args = ['{}'.format(arg) for arg in posargs[:nodeflen]]
    args.extend('{}={}'.format(arg, dval)
                for arg, dval in zip(posargs[nodeflen:], defaults))
    if varargs:
        args.append('*{}'.format(varargs))
    if kwargs:
        args.append('**{}'.format(kwargs))

    argstr = ', '.join(args)

    return '{}({})'.format(func.__name__, argstr)
624607
def cmd_func(self, command: str) -> Optional[Callable]:
        
        func_name = self.cmd_func_name(command)
        if func_name:
            return getattr(self, func_name)
830770
def get_module_path(module_name):
    
    path = sys.path
    for name in module_name.split('.'):
        file_pointer, path, desc = imp.find_module(name, path)
        path = [path, ]
        if file_pointer is not None:
            file_pointer.close()

    return path[0]
506233
def _get_function(self, name: str):
        
        f = mapped.get(name)

        if f is None:
            raise MissingPipelineFunctionError('{} is not registered as a pipeline function'.format(name))

        if name in universe_map and name in in_place_map:
            return self._wrap_in_place(self._wrap_universe(f))

        if name in universe_map:
            return self._wrap_universe(f)

        if name in in_place_map:
            return self._wrap_in_place(f)

        return f
955770
def _get_module(module_name=None, module=None, register=True):
    
    if module is None and module_name is not None:
        try:
            module = sys.modules[module_name]
        except KeyError as ex:
            print(ex)
            raise KeyError(('module_name=%r must be loaded before ' +
                            'receiving injections') % module_name)
    elif module is not None and module_name is None:
        pass
    else:
        raise ValueError('module_name or module must be exclusively specified')
    if register is True:
        _add_injected_module(module)
    return module
660838
def resolve_str(name_or_func, module, default):
    
    assert isinstance(name_or_func, str)
    resolved = resolve(name_or_func, module=module)

    if isinstance(resolved, ModuleType):
        if not hasattr(resolved, default):
            raise ImportError("{}.{}".format(resolved.__name__, default))

        resolved = getattr(resolved, default)

    if not callable(resolved):
        raise TypeError("{!r} is not callable"
                        "".format(resolved))

    return resolved
911301
def load_module_functions(module):
    
    module_functions = {}

    for name, item in vars(module).items():
        if validator.is_function(item):
            module_functions[name] = item

    return module_functions
523188
def as_session(name_or_func):  # decorator
    
    if callable(name_or_func):  # no name provided
        func = name_or_func
        name = func.__name__
        name = "".join([(' ' + x) if x.isupper() else x for x in name])
        name = name.replace('_', ' ')
        return as_session(name)(func)  # deco(func) -> deco(name)(func)
    else:
        name = name_or_func

    def get_func(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            start()
            title(name)
            result = func(*args, **kwargs)
            end()
            return result
        return wrapper
    return get_func