Attempt to resolve the task name in to a job name.

        If no job resolver can resolve the task, i.e. they all return None,
        return None.

        Keyword arguments:
        name -- Name of the task to be resolved.
491312
def resolve_job(self, name):
        
        for r in self.job_resolvers():
            resolved_name = r(name)
            if resolved_name is not None:
                return resolved_name
        return None
1048365
def rq_task(self):
        
        task_path = self.task.split('.')
        module_name = '.'.join(task_path[:-1])
        task_name = task_path[-1]

        module = importlib.import_module(module_name)
        return getattr(module, task_name)
435469
function resolve (moduleName, callback) {
                logger.trace('resolving: ' + moduleName);

                if (is.regexp(moduleName)) {
                    var modules = resolveTasks.filterMatchingRegistrations(moduleName, context)
                        .map(function (moduleNameText) {
                            return resolveOne(moduleNameText, moduleNameText);
                        })

                    if (is.function(callback)) {
                        callback(null, modules);
                    } else {
                        return modules;
                    }
                }

                return resolveOne(moduleName, moduleName, callback);
            }
419885
def resolve_name_with_call_id(caller_id, ns, name, remappings)
      name = canonicalize_name(expand_local_name(caller_id, name))
      if remappings
        remappings.each_pair do |key, value|
          if name == canonicalize_name(key)
            name = value
          end
        end
      end
      if ns
        name = ns + SEP + name
      end
      return canonicalize_name(name)
    end
175287
def resolve_name(name, package):
    """"""
    if not name.startswith('.'):
        return name
    elif not package:
        raise ValueError('{!r} is not a relative name '
                         '(no leading dot)'.format(name))
    level = 0
    for character in name:
        if character != '.':
            break
        level += 1
    return _resolve_name(name[level:], package, level)
920914
def get_task(self, name):
        
        config = getattr(self, "tasks__{}".format(name))
        if not config:
            raise TaskNotFoundError("Task not found: {}".format(name))
        return TaskConfig(config)
1272818
def name(self, name=None):
        ''''''
        if name:
            self._name = name
            return self
        return self._name
1202179
def resolve_name(name):
    """"""
    logger.debug("resolve_name: %s", name)
    with Database("feeds") as feeds, Database("aliases") as aliases:
        if name in aliases.keys():
            return feeds[aliases[name]]
        elif name in feeds.keys():
            return feeds[name]
        else:
            print("Cannot find feed named: %s" % name)
            return
143031
def absent(name,
           **kwargs):
    '''
    
    '''
    ret = {'name': name,
           'result': True,
           'changes': {},
           'comment': []}

    if __salt__['jenkins.job_exists'](name):
        try:
            __salt__['jenkins.delete_job'](name)
        except CommandExecutionError as exc:
            return _fail(ret, exc.strerror)
        else:
            ret['comment'] = 'Job \'{0}\' deleted.'.format(name)
    else:
        ret['comment'] = 'Job \'{0}\' already absent.'.format(name)
    return ret
690470
def get_name(self):
        
        self.name = self.name or graceful_get(self.inspect(refresh=False), "Name")
        return self.name
33228
@FFDCIgnore({ NamingException.class })
    @Sensitive
    Object resolveObject(Object o, WSName subname) throws NamingException {
        ServiceReference<?> ref = null;
        try {
            if (o instanceof ContextNode)
                return new WSContext(userContext, (ContextNode) o, env);

            if (tc.isDebugEnabled())
                Tr.debug(tc, "Resolving object", o);

            if (o instanceof ServiceReference) {
                ref = (ServiceReference<?>) o;
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "External service registry entry.");
            } else if (o instanceof AutoBindNode) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "AutoBindNode entry.");
                AutoBindNode abNode = (AutoBindNode) o;
                ref = (ServiceReference<?>) abNode.getLastEntry();
                // null means the node was removed in another thread.
                if (ref == null) {
                    // Use the same semantics as ContextNode.lookup.
                    throw new NameNotFoundException(subname.toString());
                }
            } else if (o instanceof ServiceRegistration) {
                ref = ((ServiceRegistration<?>) o).getReference();
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "Programmatic JNDI entry.");
            }

            boolean getObjectInstance;
            if (ref == null) {
                getObjectInstance = true;
            } else {
                o = getReference(userContext, ref);
                if (o == null) {
                    throw new NamingException(Tr.formatMessage(tc, "jndi.servicereference.failed", subname.toString()));
                }

                Object origin = ref.getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN);
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "Retrieved service from registry", o,
                             JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN + "=" + origin,
                             Constants.OBJECTCLASS + "=" + Arrays.toString((String[]) ref.getProperty(Constants.OBJECTCLASS)));
                getObjectInstance = JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE.equals(origin) ||
                                    contains((String[]) ref.getProperty(Constants.OBJECTCLASS), Reference.class.getName());
            }

            if (getObjectInstance) {
                // give JNDI a chance to resolve any references
                try {
                    Object oldO = o;
                    o = NamingManager.getObjectInstance(o, subname, this, env);
                    if (o != oldO)
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "Resolved object through NamingManager"); // remove logging object o since it might contain the sensitive information.
                } catch (NamingException e) {
                    throw e;
                } catch (Exception e) {
                    // FFDC and proceed
                }
            }
            return o;
        } catch (NamingException e) {
            throw e;
        } catch (Exception e) {
            NamingException ne = new NamingException();
            ne.setRootCause(e);
            throw ne;
        }
    }
318910
def job(self, name):
        
        for job in self.jobs():
            if job.data.name == name:
                return job
890241
def get_project(self, name):
        
        if self._cache is None:  # pragma: no cover
            result = self._get_project(name)
        elif name in self._cache:
            result = self._cache[name]
        else:
            self.clear_errors()
            result = self._get_project(name)
            self._cache[name] = result
        return result
1262209
def print_task_help(self, task, name):
        
        TerminalColor.set('GREEN')
        print(get_signature(name, task))

        # TODO: print the location does not work properly and sometimes returns None
        # print('    => defined in: {}'.format(inspect.getsourcefile(task)))
        help_msg = inspect.getdoc(task) or ''
        TerminalColor.reset()
        print('   ' + help_msg.replace('\n', '\n   '))
        TerminalColor.reset()
        print()
635751
def add_task(self, name=None, desc=None):
        
        # A name is required to create a task
        for k in self.get_tasks():
            if name in keys_of(k):
                raise ValueError('Task already exists')

        if name is not None:
            # desc can be None, so we can just append whatever we have
            self.grindstone['tasks'].append( {name: desc} )
        else:
            # Raising errors is good, and makes tests easy.
            raise ValueError('Tasks `name` cannot be None')
318807
def _resolve_name(self, name):
        
        res = [name]
        while True:
            orig_names = self._search("types", name)
            if orig_names is not None:
                name = orig_names[-1]
                # pop off the typedefd name
                res.pop()
                # add back on the original names
                res += orig_names
            else:
                break

        return res
1138285
@CLIResolver
    public static AbstractProject resolveForCLI(
            @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException {
        AbstractProject item = Jenkins.getInstance().getItemByFullName(name, AbstractProject.class);
        if (item==null) {
            AbstractProject project = AbstractProject.findNearest(name);
            throw new CmdLineException(null, project == null ? Messages.AbstractItem_NoSuchJobExistsWithoutSuggestion(name)
                    : Messages.AbstractItem_NoSuchJobExists(name, project.getFullName()));
        }
        return item;
    }