def __init__(self, namespaces=None, extensions=None, context=None, debug=False):
        """
        :param namespaces: namespace mapping as :class:`dict`
        :param extensions: extension :class:`dict`
        :param context: user-context passed to XPath extension functions

        `namespaces` and `extensions` dicts should have the same format
        as for `lxml`_:
        see http://lxml.de/xpathxslt.html#namespaces-and-prefixes
        and `<http://lxml.de/extensions.html#xpath-extension-functions>`_

        Extension functions have a slightly different signature than
        pure-lxml extension functions: they must expect a user-context
        as first argument; all other arguments are the same as for
        `lxml` extensions.

        `context` will be passed as first argument to extension functions
        registered through `extensions`.
        Alternative: user-context can also be passed to :meth:`parslepy.base.Parselet.parse`

        """

        super(XPathSelectorHandler, self).__init__(debug=debug)

        # support EXSLT extensions
        self.namespaces = copy.copy(self.EXSLT_NAMESPACES)

        # add local XPath extension functions
        self._add_parsley_ns(self.namespaces)
        self.extensions = copy.copy(self.LOCAL_XPATH_EXTENSIONS)

        # add user-defined extensions
        self._user_extensions = None
        self.context = context
        if namespaces:
            self.namespaces.update(namespaces)
        if extensions:
            self._user_extensions = extensions
            self._process_extensions(extensions)

        # some functions need smart_strings=True
        self._set_smart_strings_regexps()
def __init__ ( self , namespaces = None , extensions = None , context = None , debug = False ) : super ( XPathSelectorHandler , self ) . __init__ ( debug = debug ) self . namespaces = copy . copy ( self . EXSLT_NAMESPACES ) self . _add_parsley_ns ( self . namespaces ) self . extensions = copy . copy ( self . LOCAL_XPATH_EXTENSIONS ) self . _user_extensions = None self . context = context if namespaces : self . namespaces . update ( namespaces ) if extensions : self . _user_extensions = extensions self . _process_extensions ( extensions ) self . _set_smart_strings_regexps ( )
:param namespaces: namespace mapping as :class:`dict`
        :param extensions: extension :class:`dict`
        :param context: user-context passed to XPath extension functions

        `namespaces` and `extensions` dicts should have the same format
        as for `lxml`_:
        see http://lxml.de/xpathxslt.html#namespaces-and-prefixes
        and `<http://lxml.de/extensions.html#xpath-extension-functions>`_

        Extension functions have a slightly different signature than
        pure-lxml extension functions: they must expect a user-context
        as first argument; all other arguments are the same as for
        `lxml` extensions.

        `context` will be passed as first argument to extension functions
        registered through `extensions`.
        Alternative: user-context can also be passed to :meth:`parslepy.base.Parselet.parse`