`PyQuery <https://pythonhosted.org/pyquery/>`_ representation
        of the :class:`Element <Element>` or :class:`HTML <HTML>`.
4186
def pq(self) -> PyQuery:
        
        if self._pq is None:
            self._pq = PyQuery(self.raw_xml)

        return self._pq
976739
def get_pyquery(self, tree=None, page_numbers=None):
        
        if not page_numbers:
            page_numbers = []
        if tree is None:
            if not page_numbers and self.tree is not None:
                tree = self.tree
            else:
                tree = self.get_tree(page_numbers)
        if hasattr(tree, 'getroot'):
            tree = tree.getroot()
        return PyQuery(tree, css_translator=PDFQueryTranslator())
810031
def get_soup(self, *args, **kwargs):
        
        return BeautifulSoup(self.get(*args, **kwargs).text)
742236
def html(self) -> str:
        
        tag_name = self.random.choice(list(HTML_CONTAINER_TAGS))
        tag_attributes = list(HTML_CONTAINER_TAGS[tag_name])  # type: ignore
        k = self.random.randint(1, len(tag_attributes))

        selected_attrs = self.random.sample(tag_attributes, k=k)

        attrs = []
        for attr in selected_attrs:
            attrs.append('{}="{}"'.format(
                attr, self.html_attribute_value(tag_name, attr)))

        html_result = '<{tag} {attrs}>{content}</{tag}>'
        return html_result.format(
            tag=tag_name,
            attrs=' '.join(attrs),
            content=self.__text.sentence(),
        )
770424
def get_web_element(self, element):
        
        from toolium.pageelements.page_element import PageElement
        if isinstance(element, WebElement):
            web_element = element
        elif isinstance(element, PageElement):
            web_element = element.web_element
        elif isinstance(element, tuple):
            web_element = self.driver_wrapper.driver.find_element(*element)
        else:
            web_element = None
        return web_element
6861
def fromHTML(html, *args, **kwargs):
        
        source = BeautifulSoup(html, 'html.parser', *args, **kwargs)
        return TOC('[document]',
            source=source,
            descendants=source.children)
530559
def html(self):
        
        cases = [x.html() for x in self.cases]

        return """
        <hr size="2"/>
        <a name="{anchor}">
        <div class="testclass">
            <div>Test Class: {name}</div>
            <div class="testcases">
            {cases}
            </div>
        </div>
        </a>
        """.format(anchor=self.anchor(),
                   name=tag.text(self.name),
                   count=len(cases),
                   cases="".join(cases))
605161
def dehtml(text):
    ''' '''
    # added by BoPeng to handle html output from kernel
    #
    # Do not understand why, but I cannot define the class outside of the
    # function.
    try:
        # python 2
        from HTMLParser import HTMLParser
    except ImportError:
        # python 3
        from html.parser import HTMLParser
    # added by BoPeng to handle html output from kernel
    class _DeHTMLParser(HTMLParser):
        '''This parser analyzes input text, removes HTML tags such as
        <p>, <br>, <ul>, <li> etc and returns properly formatted texts.
        '''
        def __init__(self):
            HTMLParser.__init__(self)
            self.__text = []

        def handle_data(self, data):
            text = data.strip()
            if len(text) > 0:
                text = re.sub('[ \t\r\n]+', ' ', text)
                self.__text.append(text + ' ')

        def handle_starttag(self, tag, attrs):
            if tag == 'p':
                self.__text.append('\n\n\n\n')
            elif tag == 'br':
                self.__text.append('\n\n')
            elif tag == 'ul':
                self.__text.append('')
            elif tag == 'li':
                self.__text.append('\n\n  * ')

        def handle_endtag(self, tag):
            if tag == 'ul':
                self.__text.append('\n\n')
            if tag == 'li':
                self.__text.append('\n\n')

        def handle_startendtag(self, tag, attrs):
            if tag == 'br':
                self.__text.append('\n\n')

        def text(self):
            return ''.join(self.__text).strip()

    try:
        parser = _DeHTMLParser()
        parser.feed(text)
        parser.close()
        return parser.text()
    except Exception as e:
        return text
76364
def content(self, output=None, str_output=None, **kwargs):
        """"""
        if self.response.mimetype != "text/html":
            raise Failure(_("expected request to return HTML, but it returned {}").format(
                self.response.mimetype))

        # TODO: Remove once beautiful soup updates to accomodate python 3.7
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=DeprecationWarning)
            content = BeautifulSoup(self.response.data, "html.parser")

        return self._search_page(
            output,
            str_output,
            content,
            lambda regex, content: any(regex.search(str(tag)) for tag in content.find_all(**kwargs)))
274845
def search(search_type, klass, query, options = false)
      header = {}

      # Required Data
      data = {
        'SearchType' => search_type,
        'Class'      => klass,
        'Query'      => query,
        'QueryType'  => 'DMQL2',
        'Format'     => format,
        'Count'      => '0'
      }

      # Options
      #--
      # We might want to switch this to merge!, but I've kept it like this for now because it
      # explicitly casts each value as a string prior to performing the search, so we find out now
      # if can't force a value into the string context. I suppose it doesn't really matter when
      # that happens, though...
      #++
      options.each { |k,v| data[k] = v.to_s } if options

      response = request(@urls.search, data, header)

      # TODO: make parser configurable
      results = RETS4R::Client::CompactNokogiriParser.new(response.body)

      if block_given?
        results.each {|result| yield result}
      else
        return results.to_a
      end
    end
614682
function query (el) {
  if (typeof el === 'string') {
    const selected = document.querySelector(el);
    if (!selected) {
      warn(
        'Cannot find element: ' + el
      );
      return document.createElement('div')
    }
    return selected
  } else {
    return el
  }
}
187497
def html(self):
        
        formatter = HtmlFormatter(
            cssclass=self.DIV_CSS_CLASS,
            linenos=True,
            linenostart=self._start_line,
            hl_lines=self._shift_lines(
                self._violation_lines,
                self._start_line
            ),
            lineanchors=self._src_filename
        )

        return pygments.format(self.src_tokens(), formatter)
1107349
def _object_type_html(self):
        

        if self.exists:
            return "<a href=\"%s\">%s</a>" % (self.url(), 
                                              self.content_type.name,)
        else:
            return "<s>%s</s>" % self.content_type.name
87650
def element_for_url(cls, url):
        """"""
        response = cls.http_request(url)
        if response.status != 200:
            cls.raise_http_error(response)

        assert response.getheader('Content-Type').startswith('application/xml')

        response_xml = response.read()
        logging.getLogger('recurly.http.response').debug(response_xml)
        response_doc = ElementTree.fromstring(response_xml)

        return response, response_doc
595008
def scrape_links(html, engine):
	
	soup = BeautifulSoup(html, 'lxml')
	links = []

	if engine == 'd':
		results = soup.findAll('a', {'class': 'result__a'})
		for result in results:
			link = result.get('href')[15:]
			link = link.replace('/blob/', '/raw/')
			links.append(link)

	elif engine == 'g':
		results = soup.findAll('h3', {'class': 'r'})   	
		for result in results:
			link = result.a['href'][7:].split('&')[0]
			link = link.replace('/blob/', '/raw/')
			links.append(link)

	return links
176338
def html(self):
        
        return """
        <div class="property"><i>{name}</i><br/>
        <pre>{value}</pre></div>
        """.format(name=tag.text(self.name), value=tag.text(self.value))
1368185
def iter_links_plain_element(self, element):
        ''''''
        for attrib_name, link in self.iter_links_by_attrib(element):
            if attrib_name in self.LINK_ATTRIBUTES:
                inline = self.is_link_inline(element.tag, attrib_name)
                linked = self.is_html_link(element.tag, attrib_name)
            else:
                inline = is_likely_inline(link)
                linked = not inline

            link_type = identify_link_type(link)

            yield LinkInfo(
                element=element, tag=element.tag, attrib=attrib_name,
                link=link,
                inline=inline, linked=linked,
                base_link=None,
                value_type='plain',
                link_type=link_type
            )