Lookup an article.

   lookup("Kernel#puts")     # => content or nil.
764599
def lookup(topic)
      if @cache.has_key? topic
        @cache[topic]
      else
        require_frontend

        etopic = case @shell_escape
        when :unix
          Tools.shell_escape(topic)
        when :windows
          Tools.win_shell_escape(topic)
        else
          topic
        end

        cmd = @frontend % etopic
        ##p "cmd", cmd
        content = `#{cmd} 2>&1`
        ##p "content", content

        # NOTES:
        # * Windows' ri always returns 0 even if article is not found. Work around it with a hack.
        # * Unix's ri sometimes returns 0 when it offers suggestions. Try `ri Object#is_ax?`.
        @cache[topic] = if $?.exitstatus != 0 or content.lines.count < 4
          nil
        else
          content
        end
      end
    end
493188
def search_hash(self, searchterm):
        
        return self.__search(type_attribute=self.__misphashtypes(), value=searchterm)
799614
def lookupFieldType( element )
      type = ""
      if element and element.is_a?( REXML::Element )
         if element.name == "f" and @fields
            fid = element.attributes[ "id" ]
            field = lookupField( fid ) if fid
            type = field.attributes[ "field_type" ] if field
         end
      end
      type
   end
236891
def find(self, tagtype, **kwargs):
        ''' '''
        for t in self.__tags:
            if t.tagtype == tagtype:
                return t
        if 'default' in kwargs:
            return kwargs['default']
        else:
            raise LookupError("Token {} is not tagged with the speficied tagtype ({})".format(self, tagtype))
383441
def lookup(outputs, key)
      out = outputs.find { |o| o.output_key == key }
      out&.output_value
    end
126883
def referenced(word, article=INDEFINITE, gender=MALE, role=SUBJECT):
    
    return "%s %s" % (_article(word, article, gender, role), word)
236707
def lookup(self, name: str, fragment: str = None):
        ''''''
        if name in self._contentMap:
            symbol = self._contentMap[name]
            if fragment:
                return symbol._contentMap[fragment]
            return symbol
        return self.system.lookup(name)
395397
def load_child_articles_for_section(
        context, section, featured_in_section=None, count=5):
    
    request = context.get('request')
    locale = context.get('locale_code')
    main_language_page = section.get_main_language_page()
    settings = SiteSettings.for_site(request.site) \
        if request else None

    # TODO: Consider caching the pks of these articles using a timestamp on
    # section as the key so tha twe don't always do these joins
    article_ordering = settings and settings.article_ordering_within_section
    order_by = ArticleOrderingChoices.\
        get(settings.article_ordering_within_section).name.lower() \
        if article_ordering \
        and settings.article_ordering_within_section !=\
        ArticleOrderingChoices.CMS_DEFAULT_SORTING\
        else '-first_published_at'

    order_by = order_by if order_by.find('_desc') == -1 \
        else '-{}'.format(order_by.replace('_desc', ''))

    child_articles = ArticlePage.objects.child_of(
        main_language_page).filter(
        language__is_main_language=True).order_by(order_by)

    if featured_in_section is not None:
        child_articles = child_articles.filter(
            featured_in_section=featured_in_section)\
            .order_by('-featured_in_section_start_date')

    related_articles = ArticlePage.objects.filter(
        related_sections__section__slug=main_language_page.slug)
    qs = list(chain(
        get_pages(context, child_articles, locale),
        get_pages(context, related_articles, locale)))

    # Pagination
    if count:
        p = context.get('p', 1)
        paginator = Paginator(qs, count)

        try:
            articles = paginator.page(p)
        except PageNotAnInteger:
            articles = paginator.page(1)
        except EmptyPage:
            articles = paginator.page(paginator.num_pages)
    else:
        articles = qs
    if not locale:
        return articles

    context.update({'articles_paginated': articles})
    return articles
345164
def _find_value(content, ns, key):
    
    doc = ElementTree.fromstring(content)
    query = './/{%(ns)s}%(item)s' % {'ns': ns, 'item': key}
    rv = doc.find(query)
    return rv.text
712251
def extract(self, item):
        
        article_candidate = ArticleCandidate()
        article_candidate.extractor = self._name()

        article = Article('')
        article.set_html(item['spider_response'].body)
        article.parse()
        article_candidate.title = article.title
        article_candidate.description = article.meta_description
        article_candidate.text = article.text
        article_candidate.topimage = article.top_image
        article_candidate.author = article.authors
        if article.publish_date is not None:
            try:
                article_candidate.publish_date = article.publish_date.strftime('%Y-%m-%d %H:%M:%S')
            except ValueError as exception:
                self.log.debug('%s: Newspaper failed to extract the date in the supported format,'
                              'Publishing date set to None' % item['url'])
        article_candidate.language = article.meta_lang

        return article_candidate
1287614
def update_article(self, article_id, article_dict):
        
        return self._create_put_request(resource=ARTICLES, billomat_id=article_id, send_data=article_dict)
358489
function lookup( pageRef ) {
      const page = deepClone( artifactsByRef.pages[ pageRef ] );
      removeDisabledItems( page );
      return page;
   }
378816
def _lookup(self, skip_cache, fun, *args, **kwargs):
        
        if args not in self.cache or skip_cache:
            self.cache[args] = fun(*args, **kwargs)
        return self.cache[args]
770395
public Object lookup(String id,StringWrapper toFind)
    {
	doLookup(id,toFind);
	return closestMatch;
    }
1237898
def extract_relevant_info(item):
        
        article = {
            'authors': item['article_author'],
            'date_download': item['download_date'],
            'date_modify': item['modified_date'],
            'date_publish': item['article_publish_date'],
            'description': item['article_description'],
            'filename': item['filename'],
            'image_url': item['article_image'],
            'language': item['article_language'],
            'localpath': item['local_path'],
            'title': item['article_title'],
            'title_page': ExtractedInformationStorage.ensure_str(item['html_title']),
            'title_rss': ExtractedInformationStorage.ensure_str(item['rss_title']),
            'source_domain': ExtractedInformationStorage.ensure_str(item['source_domain']),
            'text': item['article_text'],
            'url': item['url']
        }

        # clean values
        for key in article:
            value = article[key]
            if isinstance(value, str) and not value:
                article[key] = None

        return article
822055
def include?(id)
      !(blob = find_blob(id)).nil? && !blob.find(id).nil?
    end
746878
def lookup(source, keys, fallback = None):
  """"""
  try:
    for key in keys:
      source = source[key]
    return source
  except (KeyError, AttributeError, TypeError):
    return fallback