Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "cssselect in functional component" in Python

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'cssselect' in functional components in Python. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

def test_tokenizer(self):
        tokens = [
            _unicode(item) for item in tokenize(
                u(r'E\ é > f [a~="y\"x"]:nth(/* fu /]* */-3.7)'))]
        assert tokens == [
            u(""),
            "<s>",
            "' at 5&gt;",
            "<s>",
            # the no-break space is not whitespace in CSS
            u(""),  # f\xa0
            "",
            "",
            "",
            "",
            "",
            "",
            "",</s></s>
def test_tokenizer(self):
        tokens = [
            _unicode(item) for item in tokenize(
                u(r'E\ é &gt; f&nbsp;[a~="y\"x"]:nth(/* fu /]* */-3.7)'))]
        assert tokens == [
            u(""),
            "<s>",
            "' at 5&gt;",
            "<s>",
            # the no-break space is not whitespace in CSS
            u(""),  # f\xa0
            "",
            "",
            "",
            "",
            "",
            "",
            "",</s></s>
def test_unicode(self):
        if sys.version_info[0] &lt; 3:
            css = '.a\xc1b'.decode('ISO-8859-1')
        else:
            css = '.a\xc1b'

        xpath = GenericTranslator().css_to_xpath(css)
        assert css[1:] in xpath
        xpath = xpath.encode('ascii', 'xmlcharrefreplace').decode('ASCII')
        assert xpath == (
            "descendant-or-self::*[@class and contains("
            "concat(' ', normalize-space(@class), ' '), ' aÁb ')]")
def test_unicode_escapes(self):
        # \22 == '"'  \20 == ' '
        css_to_xpath = GenericTranslator().css_to_xpath
        assert css_to_xpath(r'*[aval="\'\22\'"]') == (
            '''descendant-or-self::*[@aval = concat("'",'"',"'")]''')
        assert css_to_xpath(r'*[aval="\'\22 2\'"]') == (
            '''descendant-or-self::*[@aval = concat("'",'"2',"'")]''')
        assert css_to_xpath(r'*[aval="\'\20  \'"]') == (
            '''descendant-or-self::*[@aval = "'  '"]''')
        assert css_to_xpath('*[aval="\'\\20\r\n \'"]') == (
            '''descendant-or-self::*[@aval = "'  '"]''')
def xpath(css):
            return _unicode(GenericTranslator().css_to_xpath(css, prefix=''))
def test_quoting(self):
        css_to_xpath = GenericTranslator().css_to_xpath
        assert css_to_xpath('*[aval="\'"]') == (
            '''descendant-or-self::*[@aval = "'"]''')
        assert css_to_xpath('*[aval="\'\'\'"]') == (
            """descendant-or-self::*[@aval = "'''"]""")
        assert css_to_xpath('*[aval=\'"\']') == (
            '''descendant-or-self::*[@aval = '"']''')
        assert css_to_xpath('*[aval=\'"""\']') == (
            '''descendant-or-self::*[@aval = '"""']''')
def series(css):
            selector, = parse(':nth-child(%s)' % css)
            args = selector.parsed_tree.arguments
            try:
                return parse_series(args)
            except ValueError:
                return None
def specificity(css):
            selectors = parse(css)
            assert len(selectors) == 1
            return selectors[0].specificity()
def repr_parse(css):
            selectors = parse(css)
            for selector in selectors:
                assert selector.pseudo_element is None
            return [repr(selector.parsed_tree).replace("(u'", "('")
                    for selector in selectors]
def get_error(css):
            try:
                parse(css)
            except SelectorSyntaxError:
                # Py2, Py3, ...
                return str(sys.exc_info()[1]).replace("(u'", "('")

Is your System Free of Underlying Vulnerabilities?
Find Out Now