How to use the cssselect.parser.FunctionalPseudoElement function in cssselect

To help you get started, we’ve selected a few cssselect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zopyx / print-css-rocks / lessons / in-progress / lesson-multi-column-float-to-landscape / lib / python3.4 / site-packages / cssselect / tests.py View on Github external
def xpath_pseudo_element(self, xpath, pseudo_element):
                if isinstance(pseudo_element, FunctionalPseudoElement):
                    method = 'xpath_%s_functional_pseudo_element' % (
                        pseudo_element.name.replace('-', '_'))
                    method = _unicode_safe_getattr(self, method, None)
                    if not method:
                        raise ExpressionError(
                            "The functional pseudo-element ::%s() is unknown"
                        % pseudo_element.name)
                    xpath = method(xpath, pseudo_element.arguments)
                else:
                    method = 'xpath_%s_simple_pseudo_element' % (
                        pseudo_element.replace('-', '_'))
                    method = _unicode_safe_getattr(self, method, None)
                    if not method:
                        raise ExpressionError(
                            "The pseudo-element ::%s is unknown"
                            % pseudo_element)
github scrapy / parsel / parsel / csstranslator.py View on Github external
def xpath_pseudo_element(self, xpath, pseudo_element):
        """
        Dispatch method that transforms XPath to support pseudo-element
        """
        if isinstance(pseudo_element, FunctionalPseudoElement):
            method = 'xpath_%s_functional_pseudo_element' % (
                pseudo_element.name.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError(
                    "The functional pseudo-element ::%s() is unknown"
                    % pseudo_element.name)
            xpath = method(xpath, pseudo_element)
        else:
            method = 'xpath_%s_simple_pseudo_element' % (
                pseudo_element.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError(
                    "The pseudo-element ::%s is unknown"
                    % pseudo_element)
github scrapy / scrapy / scrapy / selector / csssel.py View on Github external
def xpath_pseudo_element(self, xpath, pseudo_element):
        if isinstance(pseudo_element, FunctionalPseudoElement):
            method = 'xpath_%s_functional_pseudo_element' % (
                pseudo_element.name.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError(
                    "The functional pseudo-element ::%s() is unknown"
                % pseudo_element.name)
            xpath = method(xpath, pseudo_element)
        else:
            method = 'xpath_%s_simple_pseudo_element' % (
                pseudo_element.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError(
                    "The pseudo-element ::%s is unknown"
                    % pseudo_element)
github mcs07 / ChemDataExtractor / chemdataextractor / scrape / csstranslator.py View on Github external
def xpath_pseudo_element(self, xpath, pseudo_element):
        if isinstance(pseudo_element, FunctionalPseudoElement):
            method = 'xpath_%s_functional_pseudo_element' % (pseudo_element.name.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError("The functional pseudo-element ::%s() is unknown" % pseudo_element.name)
            xpath = method(xpath, pseudo_element)
        else:
            method = 'xpath_%s_simple_pseudo_element' % (pseudo_element.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError("The pseudo-element ::%s is unknown" % pseudo_element)
            xpath = method(xpath)
        return xpath
github scrapy / scrapy / scrapy / selector / csstranslator.py View on Github external
def xpath_pseudo_element(self, xpath, pseudo_element):
        if isinstance(pseudo_element, FunctionalPseudoElement):
            method = 'xpath_%s_functional_pseudo_element' % (
                pseudo_element.name.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError(
                    "The functional pseudo-element ::%s() is unknown"
                % pseudo_element.name)
            xpath = method(xpath, pseudo_element)
        else:
            method = 'xpath_%s_simple_pseudo_element' % (
                pseudo_element.replace('-', '_'))
            method = _unicode_safe_getattr(self, method, None)
            if not method:
                raise ExpressionError(
                    "The pseudo-element ::%s is unknown"
                    % pseudo_element)