Wrapper for lxml`s find.
542023
def find(self, node, path):
        """"""

        return node.find(path, namespaces=self.namespaces)
959259
def xpathNsLookup(self, prefix):
        
        ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
        return ret
1291239
def get_lst(source, extract=None, transform=None):
  """"""
  if extract is None:
    raw_list = source
  else:
    raw_list = extract(source)

  if transform is None:
    return raw_list
  else:
    tlist = []
    for idx, item in enumerate(raw_list):
      try:
        tlist.append(transform(item))
      except Exception as ex:
        raise Exception("An error occurred with item #{0}".format(idx)) from ex
    return tlist
1242150
def findall(self, string, *args, **kwargs):
        """"""

        return self._pattern.findall(string, *args, **kwargs)
375093
def find(soup, name=None, attrs=None, recursive=True, text=None, **kwargs):
    
    tags = find_all(
        soup, name, attrs or {}, recursive, text, 1, **kwargs
    )
    if tags:
        return tags[0]
736085
protected function Find()
	{
		$myWords = $this->WordCollection();
		
		$xmlnukeDB = $this->_context->getXMLDataBase();
		
		$arr = $xmlnukeDB->searchDocuments($this->txtSearch, $this->_context->get("checkAll") != "");

		$blockCenter = new XmlBlockCollection($myWords->Value("BLOCKRESULT"), BlockPosition::Center);
		$this->_document->addXmlnukeObject($blockCenter);
		
		if ($arr == null)
		{
			$paragraph = new XmlParagraphCollection();
			$paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTFOUND")));
			$blockCenter->addXmlnukeObject($paragraph);
		}
		else
		{
			$nodeTitleList = array("/meta/title");
			$nodeAbstractList = array("/meta/abstract");

			$configSearchFile = new AnydatasetFilenameProcessor("_configsearch");
			$configSearch = new AnyDataset( $configSearchFile ->FullQualifiedNameAndPath());
			
			$iterator = $configSearch->getIterator();
			while ($iterator->hasNext())
			{
				$singleRow = $iterator->moveNext();
				$nodeTitleList[] = $sr->getField("nodetitle");
				$nodeAbstractList[] = $sr->getField("nodeabstract") ;
			}

			foreach($arr as $s)
			{
				$singleName = FilenameProcessor::StripLanguageInfo($s);

				try
				{
					$file = new XMLFilenameProcessor($singleName);
					$docResult = $this->_context->getXMLDataBase()->getDocument($file->FullQualifiedName(), null);
					$nodeResult = $this->getNode($nodeTitleList, $docResult);
					$titulo = ($nodeResult == null) ? $myWords->Value("NOTITLE") : $nodeResult->nodeValue;
					$nodeResult = $this->getNode($nodeAbstractList, $docResult);
					$abstr = ($nodeResult == null) ? "" : $nodeResult->nodeValue;
					
					$paragraph = new XmlParagraphCollection();
					$blockCenter->addXmlnukeObject($paragraph);
					
					$href = new XmlAnchorCollection("engine:xmlnuke?xml=$singleName", "");
					$href->addXmlnukeObject(new XmlnukeText($titulo));
					$paragraph->addXmlnukeObject($href);
					
					$paragraph->addXmlnukeObject(new XmlnukeText(" ["));
					
					$href = new XmlAnchorCollection("engine:xmlnuke?xml=$singleName&xsl=rawxml", "");
					$href->addXmlnukeObject(new XmlnukeText($myWords->Value("VIEWXML")));
					$paragraph->addXmlnukeObject($href);
					
					$paragraph->addXmlnukeObject(new XmlnukeText("]"));
					$paragraph->addXmlnukeObject(new XmlnukeBreakLine());
					$paragraph->addXmlnukeObject(new XmlnukeText($abstr));
				}
				catch (Exception $e)
				{
					$paragraph = new XmlParagraphCollection();
					$paragraph->addXmlnukeObject(new XmlnukeText($s . " (" . $myWords->Value("NOTITLE") . ")"));
					$blockCenter->addXmlnukeObject($paragraph);
				}
			}
			$paragraph = new XmlParagraphCollection();
			$paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("DOCFOUND", sizeof($arr) )));
			$blockCenter->addXmlnukeObject($paragraph);
		}
	}
809614
function get(sl, context) {
    var data = parse(sl);
    var result = find(data, context || doc);
    return result;
  }
757158
def find_all(self, header, list_type=None):
        """"""
        found = []
        for chunk in self:
            if chunk.header == header and (not list_type or (header in
                list_headers and chunk.type == list_type)):
                found.append(chunk)
        return found
389081
def find(cls, *args, **kwargs):
        """"""
        return cls.from_cursor(cls.collection.find(*args, **kwargs))
417658
def _find_tpls(self, name):
        
        return self._find_tpl(name, extension='.txt'), self._find_tpl(name, extension='.html')
1050680
def _extract_all(node, name, limit_count=None):
    """"""

    seq = []

    for i in range(0, len(node.getElementsByTagName(name))):
        if len(seq) == limit_count:
            break

        seq.append(_extract(node, name, i))

    return seq
967117
def xpath(self, xpath, dom=None):
        """"""
        if dom is None:
            dom = self.browser
        return expect(dom.find_by_xpath, args=[xpath])
1302553
def _lxml_el_to_data(lxml_el, ns, nsmap, snake=True):
    """"""
    tag_name = _to_colon_ns(lxml_el.tag, default_ns=ns, nsmap=nsmap)
    ret = [tag_name]
    attributes = _get_el_attributes(lxml_el, ns=ns, nsmap=nsmap)
    if attributes:
        ret.append(attributes)
    for sub_el in lxml_el:
        ret.append(_lxml_el_to_data(sub_el, ns, nsmap, snake=snake))
    text = lxml_el.text
    if text:
        ret.append(text)
    return tuple(ret)
12881
def _find_literal(s, start, level, parts, exprs):
    """"""
    i = start
    parse_expr = True

    while i < len(s):
        ch = s[i]

        if ch in ('{', '}'):
            if level == 0:
                if i + 1 < len(s) and s[i + 1] == ch:
                    i += 2
                    parse_expr = False
                    break
                elif ch == '}':
                    raise SyntaxError("f-string: single '}' is not allowed")
            break

        i += 1

    parts.append(s[start:i])
    return i, parse_expr and i < len(s)
64020
def find(self, string, default=None):
        """"""
        return self.match(string) or self.search(string) or default
785326
def match_lang(self, el, langs):
        """"""

        match = False
        has_ns = self.supports_namespaces()
        root = self.root
        has_html_namespace = self.has_html_namespace

        # Walk parents looking for `lang` (HTML) or `xml:lang` XML property.
        parent = el
        found_lang = None
        last = None
        while not found_lang:
            has_html_ns = self.has_html_ns(parent)
            for k, v in self.iter_attributes(parent):
                attr_ns, attr = self.split_namespace(parent, k)
                if (
                    ((not has_ns or has_html_ns) and (util.lower(k) if not self.is_xml else k) == 'lang') or
                    (
                        has_ns and not has_html_ns and attr_ns == NS_XML and
                        (util.lower(attr) if not self.is_xml and attr is not None else attr) == 'lang'
                    )
                ):
                    found_lang = v
                    break
            last = parent
            parent = self.get_parent(parent, no_iframe=self.is_html)

            if parent is None:
                root = last
                has_html_namespace = self.has_html_ns(root)
                parent = last
                break

        # Use cached meta language.
        if not found_lang and self.cached_meta_lang:
            for cache in self.cached_meta_lang:
                if root is cache[0]:
                    found_lang = cache[1]

        # If we couldn't find a language, and the document is HTML, look to meta to determine language.
        if found_lang is None and (not self.is_xml or (has_html_namespace and root.name == 'html')):
            # Find head
            found = False
            for tag in ('html', 'head'):
                found = False
                for child in self.get_children(parent, no_iframe=self.is_html):
                    if self.get_tag(child) == tag and self.is_html_tag(child):
                        found = True
                        parent = child
                        break
                if not found:  # pragma: no cover
                    break

            # Search meta tags
            if found:
                for child in parent:
                    if self.is_tag(child) and self.get_tag(child) == 'meta' and self.is_html_tag(parent):
                        c_lang = False
                        content = None
                        for k, v in self.iter_attributes(child):
                            if util.lower(k) == 'http-equiv' and util.lower(v) == 'content-language':
                                c_lang = True
                            if util.lower(k) == 'content':
                                content = v
                            if c_lang and content:
                                found_lang = content
                                self.cached_meta_lang.append((root, found_lang))
                                break
                    if found_lang:
                        break
                if not found_lang:
                    self.cached_meta_lang.append((root, False))

        # If we determined a language, compare.
        if found_lang:
            for patterns in langs:
                match = False
                for pattern in patterns:
                    if pattern.match(found_lang):
                        match = True
                if not match:
                    break

        return match
480029
def find(self, node, interval, start, end):
        """"""
        data = []
        
        if len(interval) != 2:
            raise SyntaxError('Interval malformed %s. Allways specify start and end position for interval.' % str(interval))
        
        left = (start, node[0])
        right = (node[0], end)

        if self.overlap(left, interval):
            data.extend(node[-1])
            if node[1] != -1:
                data.extend(self.find(node[1], interval, left[0], left[1]))

        if self.overlap(right, interval):
            data.extend(node[-1])
            if node[2] != -1:
                data.extend(self.find(node[2], interval, right[0], right[1]))

        return list(set(data))