Looks through siblings for content that might also be related.
    Things like preambles, content split by ads that we removed, etc.
763686
def check_siblings(candidate_node, candidate_list):
    
    candidate_css = candidate_node.node.get("class")
    potential_target = candidate_node.content_score * 0.2
    sibling_target_score = potential_target if potential_target > 10 else 10
    parent = candidate_node.node.getparent()
    siblings = parent.getchildren() if parent is not None else []

    for sibling in siblings:
        append = False
        content_bonus = 0

        if sibling is candidate_node.node:
            append = True

        # Give a bonus if sibling nodes and top candidates have the example
        # same class name
        if candidate_css and sibling.get("class") == candidate_css:
            content_bonus += candidate_node.content_score * 0.2

        if sibling in candidate_list:
            adjusted_score = \
                candidate_list[sibling].content_score + content_bonus

            if adjusted_score >= sibling_target_score:
                append = True

        if sibling.tag == "p":
            link_density = get_link_density(sibling)
            content = sibling.text_content()
            content_length = len(content)

            if content_length > 80 and link_density < 0.25:
                append = True
            elif content_length < 80 and link_density == 0:
                if ". " in content:
                    append = True

        if append:
            logger.debug(
                "Sibling appended: %s %r", sibling.tag, sibling.attrib)
            if sibling.tag not in ("div", "p"):
                # We have a node that isn't a common block level element, like
                # a form or td tag. Turn it into a div so it doesn't get
                # filtered out later by accident.
                sibling.tag = "div"

            if candidate_node.node != sibling:
                candidate_node.node.append(sibling)

    return candidate_node
848423
def get_siblings(self):
        
        if self.parent:
            return get_result_class(self.__class__).objects.filter(
                parent=self.parent)
        return self.__class__.get_root_nodes()
1320687
def looking_for
      content = [looking_for_friends,
                 looking_for_dating,
                 looking_for_relationship,
                 looking_for_networking]

      content << looking_for_who if content.join.empty?

      helpers.safe_join(content)
    end
446606
def get_section_relations(Section):
    """"""
    all_rels = (Section._meta.get_all_related_objects() +
                Section._meta.get_all_related_many_to_many_objects())
    return filter_item_rels(all_rels)
1259314
function (parent, siblings, index) {
                this.parent = parent;
                this.siblings = siblings.slice(0);

                // If source node is in the target nodes
                var i = this.siblings.indexOf(this.source);
                if (i > -1) {
                  this.siblings.splice(i, 1);
                  if (this.source.index() < index) {
                    index--;
                  }
                }

                this.siblings.splice(index, 0, this.source);
                this.index = index;
              }
1337483
def _find_by_chain(self, browser, criteria, tag, constraints):
        """"""
        return self._filter_elements(
            browser.find_elements_by_ios_class_chain(criteria),
            tag, constraints)
910962
def posted_since(self):
        
        try:
            if self._data_from_search:
                info = self._data_from_search.find(
                    'div', {"class": "date_entered"}).text
                s = info.split(':')
                return s[-1].strip()
            else:
                div = self._ad_page_content.find(
                    'div', {'class': 'description_extras'})
                index = [i for i, s in enumerate(
                    div.contents) if 'Entered/Renewed' in str(s)][0] + 1
                return re.search("([0-9]{1,2}/[0-9]{1,2}/[0-9]{4})", str(div.contents[index]))[0]
        except Exception as e:
            if self._debug:
                logging.error(
                    "Error getting posted_since. Error message: " + e.args[0])
            return
1236473
def siblings(client, revision, paths):
    """"""
    graph = Graph(client)
    nodes = graph.build(paths=paths, revision=revision)
    siblings_ = set(nodes)
    for node in nodes:
        siblings_ |= graph.siblings(node)

    paths = {node.path for node in siblings_}
    for path in paths:
        click.echo(graph._format_path(path))
1353830
function getLinkedDeps(pkgs) {
  return pkgs.map((name) => {
    const isLinked = checkForLink(name);
    return isLinked ? name : false;
  }).filter(Boolean);
}
32457
def get_related(page):
    
    related = []
    entry   = Entry.get_for_model(page)

    if entry:
        related = entry.related

    return related
383793
def explicit_rel_links(self, rels=('homepage', 'download')):
        """"""
        for match in self._rel_re.finditer(self.content):
            found_rels = match.group(1).lower().split()
            for rel in rels:
                if rel in found_rels:
                    break
            else:
                continue
            match = self._href_re.search(match.group(0))
            if not match:
                continue
            url = match.group(1) or match.group(2) or match.group(3)
            url = self.clean_link(urlparse.urljoin(self.base_url, url))
            yield Link(url, self)
548264
def next(self):
        """"""
        CheckParent(self)

        val = _fitz.Link_next(self)

        if val:
            val.thisown = True
            val.parent = self.parent # copy owning page from prev link
            val.parent._annot_refs[id(val)] = val
            if self.xref > 0: # prev link has an xref
                link_xrefs = self.parent._getLinkXrefs()
                idx = link_xrefs.index(self.xref)
                val.xref = link_xrefs[idx + 1]
            else:
                val.xref = 0


        return val
917135
def _find_content(self, cont_name):
        """"""
        try:
            a = self.content_data[cont_name]
            return a
        except KeyError:
            if self.parent:
                return self.parent._find_content(cont_name)
            else:
                # Fallback for no content (Raise NoContent?)
                return ""
178623
def get_descendants(self, el, tags=True, no_iframe=False):
        """"""

        if not no_iframe or not self.is_iframe(el):
            next_good = None
            for child in el.descendants:

                if next_good is not None:
                    if child is not next_good:
                        continue
                    next_good = None

                is_tag = self.is_tag(child)

                if no_iframe and is_tag and self.is_iframe(child):
                    if child.next_sibling is not None:
                        next_good = child.next_sibling
                    else:
                        last_child = child
                        while self.is_tag(last_child) and last_child.contents:
                            last_child = last_child.contents[-1]
                        next_good = last_child.next_element
                    yield child
                    if next_good is None:
                        break
                    # Coverage isn't seeing this even though it's executed
                    continue  # pragma: no cover

                if not tags or is_tag:
                    yield child
1144546
def links(self):
        """"""
        # <https://example.com/?page=2>; rel="next", <https://example.com/?page=34>; rel="last"'
        # becomes
        # {
        #     'last': {'rel': 'last', 'url': 'https://example.com/?page=34'},
        #     'next': {'rel': 'next', 'url': 'https://example.com/?page=2'},
        # },
        result = {}
        if 'Link' in self.headers:
            value = self.headers['Link']

            for part in re.split(r', *<', value):
                link = {}
                vs = part.split(';')

                # First section is always an url.
                link['url'] = vs.pop(0).strip('\'" <>')

                for v in vs:
                    if '=' in v:
                        key, v = v.split('=')
                        link[key.strip('\'" ')] = v.strip('\'" ')

                rkey = link.get('rel') or link['url']
                result[rkey] = link

        return result
971160
public void checkParentLinks() {
        this.visit(new NodeVisitor() {
            @Override
            public boolean visit(AstNode node) {
                int type = node.getType();
                if (type == Token.SCRIPT)
                    return true;
                if (node.getParent() == null)
                    throw new IllegalStateException
                            ("No parent for node: " + node
                             + "\n" + node.toSource(0));
                return true;
            }
        });
    }
1176139
function findLinks(rootNode, callback)
{
	var attrName,i,link,linkAttrs,numAttrs,url;
	
	walk(rootNode, function(node)
	{
		linkAttrs = maxFilterLevel[node.nodeName];
		
		// If a supported element
		if (linkAttrs != null)
		{
			numAttrs = node.attrs.length;
			
			// Faster to loop through Arrays than Objects
			for (i=0; i<numAttrs; i++)
			{
				attrName = node.attrs[i].name;
				url = null;
				
				// If a supported attribute
				if (linkAttrs[attrName] === true)
				{
					// Special case for `<meta http-equiv="refresh" content="5; url=redirect.html">`
					if (node.nodeName==="meta" && attrName==="content")
					{
						if (node.attrMap["http-equiv"]!=null && node.attrMap["http-equiv"].toLowerCase()==="refresh")
						{
							url = parseMetaRefresh( node.attrMap[attrName] ).url;
						}
					}
					else
					{
						// https://html.spec.whatwg.org/multipage/infrastructure.html#valid-url-potentially-surrounded-by-spaces
						url = node.attrMap[attrName].trim();
					}
					
					if (url != null)
					{
						callback(node, attrName, url);
					}
				}
			}
		}
	});
}