Get the section for an article, preferring it not to be News
775431
function getSectionName(article) {
  const { tiles } = article;

  if (!tiles) {
    return null;
  }

  const slices = tiles.reduce((acc, tile) => {
    acc.push(...tile.slices);
    return acc;
  }, []);
  const sections = slices.reduce((acc, slice) => {
    acc.push(...slice.sections);
    return acc;
  }, []);
  const titles = sections.map(section => section.title);

  if (titles.length === 0) {
    return null;
  }

  const nonNews = titles.filter(title => title !== "News");

  return nonNews.length ? nonNews[0] : "News";
}
864306
def get_headline(self, name):
        

        return self._loop.run_coroutine(self._client.get_headline(name))
419970
def _get_newsfeeds(self, uri, detail_level = None):
		'''
		'''
		if detail_level:
			if detail_level not in ['ALL', 'CONDENSED']:
				return requests.codes.bad_request, {'success' : 'False', 
												'error': 'detailLevel needs to be provided and field_type needs to be \'ALL\' or \'CONDENSED\''}
			uri +=  self.detail_level_suffix + detail_level
		return self._req('get', uri)
1362179
def content(self):
        """"""
        return _bfd.section_get_content(self.bfd, self._ptr, 0, self.size)
1343603
def find_section_title(node)
     title = node.find_first('./db:title')
     if title.nil?
       title = node.find_first './db:info/db:title'
     end
     if title.nil?
       ""
     else
       title.content
     end
   end
1348871
def help_center_section_articles(self, id, locale=None, **kwargs):
        ""
        api_path = "/api/v2/help_center/sections/{id}/articles.json"
        api_path = api_path.format(id=id)
        if locale:
            api_opt_path = "/api/v2/help_center/{locale}/sections/{id}/articles.json"
            api_path = api_opt_path.format(id=id, locale=locale)
        return self.call(api_path, **kwargs)
392445
def get_news(self):
        
        if self.topic is None or self.topic is 'Top Stories':
            resp = requests.get(top_news_url, params=self.params_dict)
        else:
            topic_code = topicMap[process.extractOne(self.topic, self.topics)[0]]
            resp = requests.get(topic_url.format(topic_code), params=self.params_dict)
        return self.parse_feed(resp.content)
1139186
def sections(self):
    '''
    
    '''

    if not getattr(self, '_sections', False):
      query_params = {
        'action': 'parse',
        'prop': 'sections',
      }
      query_params.update(self.__title_query_param)

      request = _wiki_request(query_params)
      self._sections = [section['line'] for section in request['parse']['sections']]

    return self._sections
792140
def section(func):
    
    def inner(self):
        return func(self)(self.et.find(func.__name__))
    return inner
692758
def NewSection(self, token_type, section_name, pre_formatters):
        """"""
        pre_formatters = [self._GetFormatter(f) for f in pre_formatters]
        
        # TODO: Consider getting rid of this dispatching, and turn _Do* into methods
        if token_type == REPEATED_SECTION_TOKEN:
            new_block = _RepeatedSection(section_name, pre_formatters)
            func = _DoRepeatedSection
        elif token_type == SECTION_TOKEN:
            new_block = _Section(section_name, pre_formatters)
            func = _DoSection
        elif token_type == DEF_TOKEN:
            new_block = _Section(section_name, [])
            func = _DoDef
        else:
            raise AssertionError('Invalid token type %s' % token_type)
        
        self._NewSection(func, new_block)
554772
def get_article(url):
    
    a = html.parse(url).getroot()
    title = a.cssselect(".firstHeading")[0].text_content()
    date = a.cssselect(".published")[0].text_content()
    date = datetime.datetime.strptime(date, "%A, %B %d, %Y").isoformat()
    paras = a.cssselect("#mw-content-text p")
    paras = paras[1:] # skip first paragraph, which contains date
    text = "\n\n".join(p.text_content().strip() for p in paras)

    return dict(headline=title,
                date=date,
                url=url,
                text=text,
                medium="Wikinews")
121092
def get_sections(need_info):
    """"""
    sections = []
    current_node = need_info['target_node']
    while current_node:
        if isinstance(current_node, nodes.section):
            title = current_node.children[0].astext()
            # If using auto-section numbering, then Sphinx inserts
            # multiple non-breaking space unicode characters into the title
            # we'll replace those with a simple space to make them easier to
            # use in filters
            title = NON_BREAKING_SPACE.sub(' ', title)
            sections.append(title)
        current_node = getattr(current_node, 'parent', None)
    return sections
157704
public function findSection() {
		$page = $this;
		while ($page && $page->ID) {
			if ($page->ParentID == 0 || $page->PrimaryNewsSection) {
				return $page;
			}
			$page = $page->Parent();
		}
	}
578152
def top_post(section: hug.types.one_of(('news', 'newest', 'show'))='news'):
    """"""
    content = requests.get('https://news.ycombinator.com/{0}'.format(section)).content
    text = content.decode('utf-8')
    return text.split('<tr class=\'athing\'>')[1].split("<a href")[1].split(">")[1].split("<")[0]
963883
def getCategoryContent(self, category, excludeRead=False, continuation=None, loadLimit=20, since=None, until=None):
        
        return self._getFeedContent(category.fetchUrl, excludeRead, continuation, loadLimit, since, until)
699735
def _get_section(self, event):
        """"""
        sentence_id = event.get('sentence')
        section = None
        if sentence_id:
            qstr = "$.sentences.frames[(@.frame_id is \'%s\')]" % sentence_id
            res = self.tree.execute(qstr)
            if res:
                sentence_frame = list(res)[0]
                passage_id = sentence_frame.get('passage')
                if passage_id:
                    qstr = "$.sentences.frames[(@.frame_id is \'%s\')]" % \
                            passage_id
                    res = self.tree.execute(qstr)
                    if res:
                        passage_frame = list(res)[0]
                        section = passage_frame.get('section-id')
        # If the section is in the standard list, return as is
        if section in self._section_list:
            return section
        # Next, handle a few special cases that come up in practice
        elif section.startswith('fig'):
            return 'figure'
        elif section.startswith('supm'):
            return 'supplementary'
        elif section == 'article-title':
            return 'title'
        elif section in ['subjects|methods', 'methods|subjects']:
            return 'methods'
        elif section == 'conclusions':
            return 'conclusion'
        elif section == 'intro':
            return 'introduction'
        else:
            return None
572904
def get_section_by_url(url,
                       include_instructor_not_on_time_schedule=True):
    
    if not course_url_pattern.match(url):
        raise InvalidSectionURL(url)

    return _json_to_section(
        get_resource(url),
        include_instructor_not_on_time_schedule=(
            include_instructor_not_on_time_schedule))