Returns the function object in this module matching cmd.
774895
def __cmd_to_func(cmd):
    
    fiss_module = sys.modules[__name__]
    # Returns None if string is not a recognized FISS command
    func = getattr(fiss_module, cmd, None)
    if func and not hasattr(func, 'fiss_cmd'):
        func = None
    return func
1162936
def get_function(self):
        
        # Implemented from template for osid.learning.Activity.get_objective
        if not bool(self._my_map['functionId']):
            raise errors.IllegalState('function empty')
        mgr = self._get_provider_manager('AUTHORIZATION')
        if not mgr.supports_function_lookup():
            raise errors.OperationFailed('Authorization does not support Function lookup')
        lookup_session = mgr.get_function_lookup_session(proxy=getattr(self, "_proxy", None))
        lookup_session.use_federated_vault_view()
        return lookup_session.get_function(self.get_function_id())
1067425
def find_function(self, name):
        """"""
        deffunction = lib.EnvFindDeffunction(self._env, name.encode())
        if deffunction == ffi.NULL:
            raise LookupError("Function '%s' not found" % name)

        return Function(self._env, deffunction)
128515
function(modules){
		return function(System){
			if(!Array.isArray(modules)) {
				return [System.main];
			} else if(typeof modules === "function") {
				return modules.apply(this, arguments);
			} else {
				return modules;
			}
		};
	}
937293
def simplefilter(f):
    
    return type(f.__name__, (FunctionFilter,), {
        '__module__': getattr(f, '__module__'),
        '__doc__': f.__doc__,
        'function': f,
    })
423183
def get_module(self, module_name):
        """"""
        try:
            return self.module[module_name]

        except KeyError:
            return sys.modules[module_name]
423384
def command(self, func):
        
        command = Command(func)
        self._commands[func.__name__] = command
        return func
1245395
def get_command(self, ctx, name):
        """"""
        if name not in self.daemon_class.list_actions():
            return None

        # The context object is a Daemon object
        daemon = ctx.obj

        def subcommand(debug=False):
            """Call a daemonocle action."""
            if daemon.detach and debug:
                daemon.detach = False

            daemon.do_action(name)

        # Override the docstring for the function so that it shows up
        # correctly in the help output
        subcommand.__doc__ = daemon.get_action(name).__doc__

        if name == 'start':
            # Add a --debug option for start
            subcommand = click.option(
                '--debug', is_flag=True,
                help='Do NOT detach and run in the background.'
            )(subcommand)

        # Make it into a click command
        subcommand = click.command(
            name, options_metavar=self.options_metavar)(subcommand)

        return subcommand
131396
def retrieve_commands(obj):
    """"""
    commands = {}  # Name and help
    for func in obj.__dict__:
        if not inspect.isfunction(obj.__dict__[func]) and \
           not isinstance(obj.__dict__[func], property):
            continue
        if func.startswith('_'):
            continue
        commands[func] = _get_first_sentence_in_pydoc(
            obj.__dict__[func])
    return commands
625164
def _get_function_type(self, function_name):
        
        if (function_name.startswith("Fn::") and
                function_name[4:] in self.inspect_functions):
            return self.inspect_functions[function_name[4:]]
        return (self.inspect_functions['Ref'] if function_name == "Ref"
                else None)
1111790
def get_function(fn_name):
    
    module_name, callable_name = fn_name.split(':')
    current = globals()
    if not callable_name:
        callable_name = module_name
    else:
        import importlib
        try:
            module = importlib.import_module(module_name)
        except ImportError:
            log.error("failed to import %s", module_name)
            raise
        current = module
    for level in callable_name.split('.'):
        current = getattr(current, level)
    code = current.__code__
    if code.co_argcount != 2:
        raise ValueError('function should take 2 arguments: lines, file_name')
    return current
151481
def get_function(self, name: str) -> AbiFunction or None:
        
        for func in self.functions:
            if func['name'] == name:
                return AbiFunction(func['name'], func['parameters'], func.get('returntype', ''))
        return None
820544
def get_functions(fname):
    
    txt = '' 
    with open(fname, 'r') as f:
        for line in f:
            if line.strip()[0:4] == 'def ':
                txt += '<PRE>' + strip_text_after_string(strip_text_after_string(line, '#')[4:], ':') + '</PRE>\n'
            if line[0:5] == 'class':
                txt += '<PRE>' + strip_text_after_string(strip_text_after_string(line, '#'), ':') + '</PRE>\n'
    return txt + '<BR>'
159451
def get_module(self, name, folder=None):
        """"""
        # check if this is a builtin module
        pymod = self.pycore.builtin_module(name)
        if pymod is not None:
            return pymod
        module = self.find_module(name, folder)
        if module is None:
            raise ModuleNotFoundError('Module %s not found' % name)
        return self.pycore.resource_to_pyobject(module)
563967
function(module) {

  return Object.keys(module)
    .filter(function(k) {
      return k.substr(0,3) === 'get' && typeof module[k] === 'function';
    })
    .map(function(k) {
      return { name: k.substr(4), fn: module[k] };
    });
}
785978
def module(self):
        """"""
        if self._module is None:
            root = self
            while self._module is None and root is not None:
                if isinstance(root, Module):
                    self._module = root
                else:
                    root = root.parent

        return self._module
404232
def command(f):
    

    @functools.wraps(f)
    def func_wrapper(self, *argv, **kwargs):
        if 'ip' in kwargs:
            ip = kwargs['ip']
            del kwargs['ip']
        else:
            ip = None

        commands = _get_commands(f, self, *argv, **kwargs)
        return self.execute(commands, ip=ip)

    return func_wrapper