Find skill by name or url
199984
def find_skill(self, param, author=None, skills=None):
        # type: (str, str, List[SkillEntry]) -> SkillEntry
        """"""
        if param.startswith('https://') or param.startswith('http://'):
            repo_id = SkillEntry.extract_repo_id(param)
            for skill in self.list():
                if skill.id == repo_id:
                    return skill
            name = SkillEntry.extract_repo_name(param)
            path = SkillEntry.create_path(self.skills_dir, param)
            return SkillEntry(name, path, param, msm=self)
        else:
            skill_confs = {
                skill: skill.match(param, author)
                for skill in skills or self.list()
            }
            best_skill, score = max(skill_confs.items(), key=lambda x: x[1])
            LOG.info('Best match ({}): {} by {}'.format(
                round(score, 2), best_skill.name, best_skill.author)
            )
            if score < 0.3:
                raise SkillNotFound(param)
            low_bound = (score * 0.7) if score != 1.0 else 1.0

            close_skills = [
                skill for skill, conf in skill_confs.items()
                if conf >= low_bound and skill != best_skill
            ]
            if close_skills:
                raise MultipleSkillMatches([best_skill] + close_skills)
            return best_skill
1291067
def find_users(session, *usernames):
    """"""
    user_string = ','.join(usernames)
    return _make_request(session, FIND_USERS_URL, user_string)
662604
def find(self):
        '''
        
        '''
        keyword = self.get_argument('keyword').strip()

        kwd = {
            'pager': '',
            'title': 'Searching Result',
        }
        self.render('user/info_list/find_list.html',
                    userinfo=self.userinfo,
                    kwd=kwd,
                    recs=MPost.get_by_keyword(keyword))
398107
def check_url (self):
        """"""
        try:
            url_data = self.urlqueue.get(timeout=QUEUE_POLL_INTERVALL_SECS)
            if url_data is not None:
                try:
                    self.check_url_data(url_data)
                finally:
                    self.urlqueue.task_done(url_data)
                self.setName(self.origname)
        except urlqueue.Empty:
            pass
        except Exception:
            self.internal_error()
417658
def _find_tpls(self, name):
        
        return self._find_tpl(name, extension='.txt'), self._find_tpl(name, extension='.html')
1199344
def find_by_url(self, space_url, id_only=True):
        
        resp = self.transport.GET(url='/space/url?%s' % urlencode({'url': space_url}))
        if id_only:
            return resp['space_id']
        return resp
587061
def doFind(self, WHAT={}, SORT=[], SKIP=None, MAX=None, LOP='AND', **params):
		""""""

		self._preFind(WHAT, SORT, SKIP, MAX, LOP)

		for key in params:
			self._addDBParam(key, params[key])

		try:
			return self._doAction('-find')
		except FMServerError as e:
			if e.args[0] in [401, 8]:
				return []
998150
def search_name(self, name, dom=None):
        """"""
        if dom is None:
            dom = self.browser
        return expect(dom.find_by_name, args=[name])
1171155
function getUrlGETparams() {
    var vars = {}, hash;
    var hashes = window.location.href.slice( window.location.href.indexOf('?') + 1 ).split('&');
    for( var i = 0; i < hashes.length; i++ ) {
        hash = hashes[i].split('=');
        vars[ hash[0] ] = hash[1];
        // switch on console logging
        if ( hash[0] == 'info') { logInfo = true  }
        if ( hash[0] == 'info' && hash[1] && hash[1] != '') { logInfoStr = hash[1] }
    }
    //alert( JSON.stringify( vars )  );
    return vars;
}
558834
def query_string(context, **kwargs):
    """"""
    params = context["request"].GET.copy()

    for key, value in list(kwargs.items()):
        params[key] = value

    return "?" + params.urlencode()
547183
def skills_name_update(self, name, data, **kwargs):
        ""
        api_path = "/api/v2/skills/name/{name}"
        api_path = api_path.format(name=name)
        return self.call(api_path, method="PUT", data=data, **kwargs)
289126
def find_this(search, source=SOURCE):
    """"""
    print("Searching for {what}.".format(what=search))
    if not search or not source:
        print("Not found on source: {what}.".format(what=search))
        return ""
    return str(re.compile(r'.*__{what}__ = "(.*?)"'.format(
        what=search), re.S).match(source).group(1)).strip()
564313
def find_by_any(self, identifier, how):
        
        if "i" in how:
            match = self.find_by_id(identifier)
            if match:
                return match
        if "l" in how:
            match = self.find_by_localpath(identifier)
            if match:
                return match
        if "c" in how:
            match = self.find_by_canonical(identifier)
            if match:
                return match
1031852
def _extract_url_and_title(self, text, start):
        """"""
        # text[start] equals the opening parenthesis
        idx = self._whitespace.match(text, start + 1).end()
        if idx == len(text):
            return None, None
        end_idx = idx
        has_anglebrackets = text[idx] == "<"
        if has_anglebrackets:
            end_idx = self._find_balanced(text, end_idx+1, "<", ">")
        end_idx = self._find_balanced(text, end_idx, "(", ")")
        match = self._inline_link_title.search(text, idx, end_idx)
        if not match:
            return None, None
        url = text[idx:match.start()]
        if has_anglebrackets:
            url = self._strip_anglebrackets.sub(r'\1', url)
        return url, end_idx
64020
def find(self, string, default=None):
        """"""
        return self.match(string) or self.search(string) or default
1034096
def update(self, skill=None, author=None):
        """"""
        if skill is None:
            return self.update_all()
        else:
            if isinstance(skill, str):
                skill = self.find_skill(skill, author)
            entry = get_skill_entry(skill.name, self.skills_data)
            if entry:
                entry['beta'] = skill.is_beta
            if skill.update():
                # On successful update update the update value
                if entry:
                    entry['updated'] = time.time()
407603
private BasicUrl findUrl(TextCursor cursor, int limit) {
        for (int i = cursor.currentOffset; i < limit; i++) {
            if (!isGoodAnchor(cursor.text, i - 1)) {
                continue;
            }
            String currentText = cursor.text.substring(i, limit);
            MatcherCompat matcher = Patterns.WEB_URL_START.matcher(currentText);
            if (matcher.hasMatch()) {
                String url = matcher.group();
                int start = i + matcher.start();
                return new BasicUrl(start, start + url.length());
            }
        }
        return null;
    }