a
    $i4                     @  s   d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	 ddl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ erddlmZ G dd	 d	eeZG d
d dZ e!dj"Z#e!dj$Z%e!dj$Z&G dd dZ'G dd de'Z(dS )z
cssselect.xpath
===============

Translation of parsed CSS selectors to XPath expressions.


:copyright: (c) 2007-2012 Ian Bicking and contributors.
See AUTHORS for more details.
:license: BSD, see LICENSE for more details.

    )annotationsN)Callable)TYPE_CHECKINGOptionalcast)AttribClassCombinedSelectorElementFunctionHashMatchingNegationPseudoPseudoElementRelationSelectorSelectorErrorSpecificityAdjustmentTreeparseparse_series)Selfc                   @  s   e Zd ZdZdS )ExpressionErrorz3Unknown or unsupported selector (eg. pseudo-class).N)__name__
__module____qualname____doc__ r   r   ]/var/www/staging/api/virtual_environments/venv/lib/python3.9/site-packages/cssselect/xpath.pyr   -   s   r   c                   @  s   e Zd Zddddddddd	Zdd
ddZdd
ddZdddddddZdd
ddZdd
ddZddd ddddddZ	dS ) 	XPathExpr *FstrboolNone)pathelement	conditionstar_prefixreturnc                 C  s   || _ || _|| _d S N)r&   r'   r(   )selfr&   r'   r(   r)   r   r   r   __init__5   s    zXPathExpr.__init__)r*   c                 C  s0   t | jt | j }| jr,|d| j d7 }|S N[]r#   r&   r'   r(   )r,   r&   r   r   r   __str__@   s    zXPathExpr.__str__c                 C  s   | j j d|  dS r.   )	__class__r   r,   r   r   r   __repr__F   s    zXPathExpr.__repr__andr   )r(   
conjuctionr*   c                 C  s.   | j r$d| j  d| d| d| _ n|| _ | S )N(z) z ())r(   )r,   r(   r7   r   r   r   add_conditionI   s    zXPathExpr.add_conditionc                 C  s0   | j dkrd S | dt| j   d| _ d S )Nr"   z	name() = )r'   r:   GenericTranslatorxpath_literalr4   r   r   r   add_name_testP   s    
zXPathExpr.add_name_testc                 C  s   |  j d7  _ dS )ze
        Append '*/' to the path to keep the context constrained
        to a single parent.
        */N)r&   r4   r   r   r   add_star_prefixW   s    zXPathExpr.add_star_prefixN
str | None)combinerotherclosing_combinerhas_inner_conditionr*   c                 C  s   t | | }|jdkr ||j7 }|| _|sJ|r8|j| n|j| _|j| _n8|j| _|jrp|  jd|j d 7  _|r|  j|7  _| S )Nr>   r/   r0   r1   )r,   rA   rB   rC   rD   r&   r   r   r   join^   s    


zXPathExpr.join)r!   r"   r!   F)r6   )NF)
r   r   r   r-   r2   r5   r:   r=   r?   rE   r   r   r   r   r    4   s         r    z('+)z^[a-zA-Z_][a-zA-Z0-9_.-]*$z^[^ \t\r\n\f]+$c                	   @  s  e Zd ZdZdddddZddd	d
dddddZdZdZdZdZ	dZ
eZdddddddZddddddddZddddd d!Zeddd"d#d$Zd%dd&d'd(Zd)dd*d+d,Zd-dd.d/d0Zd1dd2d3d4Zd5dd6d7d8Zd9dd6d:d;Zd<dd=d>d?Zd@ddAdBdCZdDddEdFdGZdHddIdJdKZdLddMdNdOZdPddEdQdRZddddSdTdUZddddSdVdWZddddSdXdYZ ddddSdZd[Z!ddddSd\d]Z"ddddSd^d_Z#ddddSd`daZ$ddddSdbdcZ%ddd<ddddedfdgZ&dd<ddhdidjZ'dd<ddhdkdlZ(dd<ddhdmdnZ)dd<ddhdodpZ*dd<ddhdqdrZ+dddsdtduZ,dddsdvdwZ-dddsdxdyZ.dddsdzd{Z/dddsd|d}Z0dddsd~dZ1dddsddZ2dddsddZ3dddsddZ4dddsddZ5e5Z6e5Z7e5Z8e5Z9e5Z:e5Z;e5Z<e5Z=e5Z>dddddddZ?dddddddZ@dddddddZAdddddddZBdddddddZCdddddddZDdddddddZEdddddddZFdS )r;   z
    Translator for "generic" XML documents.

    Everything is case-sensitive, no assumption is made on the meaning
    of element names and attribute names.

    Z
descendantchildZdirect_adjacentZindirect_adjacent) >+~existsequalsZincludesZ	dashmatchZprefixmatchZsuffixmatchZsubstringmatchZ	different)rK   =z~=z|=z^=z$=z*=z!=idzxml:langFdescendant-or-self::r#   )cssprefixr*   c                   s   d  fddt|D S )u  Translate a *group of selectors* to XPath.

        Pseudo-elements are not supported here since XPath only knows
        about "real" elements.

        :param css:
            A *group of selectors* as a string.
        :param prefix:
            This string is prepended to the XPath expression for each selector.
            The default makes selectors scoped to the context node’s subtree.
        :raises:
            :class:`~cssselect.SelectorSyntaxError` on invalid selectors,
            :class:`ExpressionError` on unknown/unsupported selectors,
            including pseudo-elements.
        :returns:
            The equivalent XPath 1.0 expression as a string.

        z | c                 3  s   | ]}j | d dV  qdS )T)translate_pseudo_elementsN)selector_to_xpath.0selectorrQ   r,   r   r   	<genexpr>   s   z1GenericTranslator.css_to_xpath.<locals>.<genexpr>)rE   r   )r,   rP   rQ   r   rW   r   css_to_xpath   s    zGenericTranslator.css_to_xpathr   r$   )rV   rQ   rR   r*   c                 C  s`   t |dd}|std|| |}t|| js8J |rP|jrP| ||j}|pVdt| S )u+  Translate a parsed selector to XPath.


        :param selector:
            A parsed :class:`Selector` object.
        :param prefix:
            This string is prepended to the resulting XPath expression.
            The default makes selectors scoped to the context node’s subtree.
        :param translate_pseudo_elements:
            Unless this is set to ``True`` (as :meth:`css_to_xpath` does),
            the :attr:`~Selector.pseudo_element` attribute of the selector
            is ignored.
            It is the caller's responsibility to reject selectors
            with pseudo-elements, or to account for them somehow.
        :raises:
            :class:`ExpressionError` on unknown/unsupported selectors.
        :returns:
            The equivalent XPath 1.0 expression as a string.

        parsed_treeNz Expected a parsed selector, got r!   )getattr	TypeErrorxpath
isinstancexpathexpr_clspseudo_elementxpath_pseudo_elementr#   )r,   rV   rQ   rR   treer]   r   r   r   rS      s    

z#GenericTranslator.selector_to_xpathr    r   )r]   r`   r*   c                 C  s   t ddS )zTranslate a pseudo-element.

        Defaults to not supporting pseudo-elements at all,
        but can be overridden by sub-classes.

        z"Pseudo-elements are not supported.N)r   )r,   r]   r`   r   r   r   ra     s    	z&GenericTranslator.xpath_pseudo_element)sr*   c                 C  sZ   t | } d| vrd|  d} n8d| vr4d|  d} n"dd t| D }dd|} | S )N'"c                 S  s0   g | ](}|rd |v r d| dn
d | d qS )rd   re   r   )rU   partr   r   r   
<listcomp>  s   z3GenericTranslator.xpath_literal.<locals>.<listcomp>z
concat({}),)r#   split_at_single_quotesformatrE   )rc   Zparts_quotedr   r   r   r<     s    zGenericTranslator.xpath_literalr   )parsed_selectorr*   c                 C  sR   t |j}ttttgtf  t| d|  d}|du rJt	| d||S )z%Translate any parsed selector object.xpath_Nz is not supported.)
typer   r   r   r   r   r    r[   lowerr   )r,   rk   	type_namemethodr   r   r   r]      s    
zGenericTranslator.xpathr	   )combinedr*   c                 C  sJ   | j |j }ttttgtf t| d| d}|| |j| |jS )zTranslate a combined selector.rl   _combinator)	combinator_mapping
combinatorr   r   r    r[   r]   rV   subselector)r,   rq   rt   rp   r   r   r   xpath_combinedselector-  s    z(GenericTranslator.xpath_combinedselectorr   )negationr*   c                 C  sD   |  |j}|  |j}|  |jr:|d|j dS |dS )Nnot(r9   0)r]   rV   ru   r=   r(   r:   )r,   rw   r]   Z	sub_xpathr   r   r   xpath_negation6  s    z GenericTranslator.xpath_negationr   )relationr*   c              	   C  s`   |  |j}|j}|j}|  |j}ttttgtf t| d| j	tt
|j  d}|||S )NZxpath_relation_rr   )r]   rV   rt   ru   rZ   r   r   r    r[   rs   r#   value)r,   r{   r]   rt   ru   rightrp   r   r   r   xpath_relation>  s    z GenericTranslator.xpath_relationr   )matchingr*   c                   sJ     |j} fdd|jD }|D ] }|  |jr$||jd q$|S )Nc                   s   g | ]}  |qS r   r]   rT   r4   r   r   rg   N      z4GenericTranslator.xpath_matching.<locals>.<listcomp>orr]   rV   Zselector_listr=   r(   r:   r,   r   r]   exprser   r4   r   xpath_matchingL  s    z GenericTranslator.xpath_matchingr   c                   sJ     |j} fdd|jD }|D ] }|  |jr$||jd q$|S )Nc                   s   g | ]}  |qS r   r   rT   r4   r   r   rg   W  r   zAGenericTranslator.xpath_specificityadjustment.<locals>.<listcomp>r   r   r   r   r4   r   xpath_specificityadjustmentU  s    z-GenericTranslator.xpath_specificityadjustmentr   )functionr*   c                 C  s^   d |jdd}tttttgtf  t| |d}|sLt	d|j d|| 
|j|S )z$Translate a functional pseudo-class.zxpath_{}_function-_NThe pseudo-class :z() is unknown)rj   namereplacer   r   r   r    r   r[   r   r]   rV   )r,   r   method_namerp   r   r   r   xpath_function^  s    
z GenericTranslator.xpath_functionr   )pseudor*   c                 C  sZ   d |jdd}ttttgtf  t| |d}|sJtd|j d|| 	|j
S )zTranslate a pseudo-class.zxpath_{}_pseudor   r   Nr   z is unknown)rj   identr   r   r   r   r    r[   r   r]   rV   )r,   r   r   rp   r   r   r   xpath_pseudoi  s    zGenericTranslator.xpath_pseudor   )rV   r*   c                 C  s   | j |j }tttttt gtf t| d| }| jrF|j	
 }n|j	}t|}|jrx|j d| }|ovt|j}|rd| }nd| | d}|jdu rd}n"| jrtt|jj
 }n|jj}|| |j||S )z Translate an attribute selector.Zxpath_attrib_:@zattribute::*[name() = r0   N)attribute_operator_mappingoperatorr   r   r    r#   r   r[   lower_case_attribute_namesattribrn   is_safe_name	namespacer<   r|   lower_case_attribute_valuesr]   rV   )r,   rV   r   rp   r   safer   r|   r   r   r   xpath_attribt  s*    

zGenericTranslator.xpath_attribr   )class_selectorr*   c                 C  s   |  |j}| |d|jS )zTranslate a class selector.z@class)r]   rV   xpath_attrib_includes
class_name)r,   r   r]   r   r   r   xpath_class  s    zGenericTranslator.xpath_classr   )id_selectorr*   c                 C  s   |  |j}| |d|jS )zTranslate an ID selector.z@id)r]   rV   xpath_attrib_equalsrN   )r,   r   r]   r   r   r   
xpath_hash  s    zGenericTranslator.xpath_hashr
   c                 C  sr   |j }|sd}d}ntt|}| jr.| }|jrV|j d| }|oTtt|j}| j|d}|sn|  |S )z'Translate a type or universal selector.r"   Tr   )r'   )r'   r$   r   lower_case_element_namesrn   r   r_   r=   )r,   rV   r'   r   r]   r   r   r   xpath_element  s    zGenericTranslator.xpath_element)leftr}   r*   c                 C  s   | d|S )z;right is a child, grand-child or further descendant of leftz/descendant-or-self::*/rE   r,   r   r}   r   r   r   xpath_descendant_combinator  s    z-GenericTranslator.xpath_descendant_combinatorc                 C  s   | d|S )z#right is an immediate child of left/r   r   r   r   r   xpath_child_combinator  s    z(GenericTranslator.xpath_child_combinatorc                 C  s   | d|}|  |dS )z)right is a sibling immediately after left/following-sibling::zposition() = 1)rE   r=   r:   )r,   r   r}   r]   r   r   r    xpath_direct_adjacent_combinator  s    z2GenericTranslator.xpath_direct_adjacent_combinatorc                 C  s   | d|S )z1right is a sibling after left, immediately or notr   r   r   r   r   r   "xpath_indirect_adjacent_combinator  s    z4GenericTranslator.xpath_indirect_adjacent_combinatorc                 C  s   |j d|dddS )zHright is a child, grand-child or further descendant of left; select leftz[descendant::r0   T)rC   rD   r   r   r   r   r   $xpath_relation_descendant_combinator  s    z6GenericTranslator.xpath_relation_descendant_combinatorc                 C  s   |j d|ddS )z0right is an immediate child of left; select leftz[./r0   rC   r   r   r   r   r   xpath_relation_child_combinator  s    z1GenericTranslator.xpath_relation_child_combinatorc                 C  s   | d|j dS )z6right is a sibling immediately after left; select leftz following-sibling::*[(name() = 'z') and (position() = 1)])r:   r'   r   r   r   r   )xpath_relation_direct_adjacent_combinator  s    z;GenericTranslator.xpath_relation_direct_adjacent_combinatorc                 C  s   |j d|ddS )z>right is a sibling after left, immediately or not; select leftz[following-sibling::r0   r   r   r   r   r   r   +xpath_relation_indirect_adjacent_combinator  s    z=GenericTranslator.xpath_relation_indirect_adjacent_combinatorT)r]   r   lastr=   r*   c              
     s  zt |j\}}W n8 tyJ } z td|jd|W Y d }~n
d }~0 0 |d }|dkrh|dkrh|S |dk r|dk r|dS |rdn|j }	|sd|	 d}
nd	|	 d}
|dkr||
 d
| S g }|dkr|dkr||
 d|  n||
 d|  t|dkr\|
}| t| }|dkrFd| d| d}|| d| d t|dkrndnd |d	 fdd|D  |S )NzInvalid series: 'rd      r   ry   r"   count(preceding-sibling::r9   count(following-sibling:: = z >= z <= r8   z +z mod z = 0z(%s)z%sz and c                 3  s   | ]} | V  qd S r+   r   )rU   Z
expressiontemplater   r   rX   f  r   z=GenericTranslator.xpath_nth_child_function.<locals>.<genexpr>)
r   	arguments
ValueErrorr   r:   r'   appendabslenrE   )r,   r]   r   r   r=   abexZb_min_1ZnodetestZsiblings_countZexpressionsr   Zb_negr   r   r   xpath_nth_child_function  s>    *+

z*GenericTranslator.xpath_nth_child_functionr]   r   r*   c                 C  s   | j ||ddS )NT)r   )r   r,   r]   r   r   r   r   xpath_nth_last_child_functionj  s    z/GenericTranslator.xpath_nth_last_child_functionc                 C  s"   |j dkrtd| j||ddS )Nr"   "*:nth-of-type() is not implementedF)r=   r'   r   r   r   r   r   r   xpath_nth_of_type_functiono  s    
z,GenericTranslator.xpath_nth_of_type_functionc                 C  s$   |j dkrtd| j||dddS )Nr"   r   TF)r   r=   r   r   r   r   r   xpath_nth_last_of_type_functionv  s
    
z1GenericTranslator.xpath_nth_last_of_type_functionc                 C  sN   |  dgdgfvr$td|jtt|jd j}|d| | dS )NSTRINGIDENTz7Expected a single string or ident for :contains(), got r   zcontains(., r9   argument_typesr   r   r   r#   r|   r:   r<   r,   r]   r   r|   r   r   r   xpath_contains_function  s    
z)GenericTranslator.xpath_contains_functionc                 C  sN   |  dgdgfvr$td|jtt|jd j}|d| | dS )Nr   r   3Expected a single string or ident for :lang(), got r   zlang(r9   r   r   r   r   r   xpath_lang_function  s    
z%GenericTranslator.xpath_lang_functionr]   r*   c                 C  s
   | dS )Nznot(parent::*)r:   r,   r]   r   r   r   xpath_root_pseudo  s    z#GenericTranslator.xpath_root_pseudoc                 C  s
   | dS )N1r   r   r   r   r   xpath_scope_pseudo  s    z$GenericTranslator.xpath_scope_pseudoc                 C  s
   | dS )Nzcount(preceding-sibling::*) = 0r   r   r   r   r   xpath_first_child_pseudo  s    z*GenericTranslator.xpath_first_child_pseudoc                 C  s
   | dS )Nzcount(following-sibling::*) = 0r   r   r   r   r   xpath_last_child_pseudo  s    z)GenericTranslator.xpath_last_child_pseudoc                 C  s&   |j dkrtd|d|j  dS )Nr"   z"*:first-of-type is not implementedr   ) = 0r'   r   r:   r   r   r   r   xpath_first_of_type_pseudo  s    
z,GenericTranslator.xpath_first_of_type_pseudoc                 C  s&   |j dkrtd|d|j  dS )Nr"   z!*:last-of-type is not implementedr   r   r   r   r   r   r   xpath_last_of_type_pseudo  s    
z+GenericTranslator.xpath_last_of_type_pseudoc                 C  s
   | dS )Nzcount(parent::*/child::*) = 1r   r   r   r   r   xpath_only_child_pseudo  s    z)GenericTranslator.xpath_only_child_pseudoc                 C  s&   |j dkrtd|d|j  dS )Nr"   z!*:only-of-type is not implementedzcount(parent::*/child::z) = 1r   r   r   r   r   xpath_only_of_type_pseudo  s    
z+GenericTranslator.xpath_only_of_type_pseudoc                 C  s
   | dS )Nznot(*) and not(string-length())r   r   r   r   r   xpath_empty_pseudo  s    z$GenericTranslator.xpath_empty_pseudoc                 C  s
   | dS )z:Common implementation for pseudo-classes that never match.ry   r   r   r   r   r   pseudo_never_matches  s    z&GenericTranslator.pseudo_never_matchesr@   )r]   r   r|   r*   c                 C  s   |rJ | | |S r+   r   r,   r]   r   r|   r   r   r   xpath_attrib_exists  s    
z%GenericTranslator.xpath_attrib_existsc                 C  s*   |d usJ | | d| |  |S )Nr   r:   r<   r   r   r   r   r     s    z%GenericTranslator.xpath_attrib_equalsc              
   C  sR   |d usJ |r4| d| d| d| |  n| | d| |  |S )Nrx   z) or z != r   r   r   r   r   xpath_attrib_different  s
    $z(GenericTranslator.xpath_attrib_differentc                 C  sJ   |r<t |r<| d| d }|| d| d| d n
|d |S )NrG   z* and contains(concat(' ', normalize-space(z	), ' '), r9   ry   )is_non_whitespacer<   r:   )r,   r]   r   r|   argr   r   r   r     s    
z'GenericTranslator.xpath_attrib_includesc                 C  sP   |d usJ |  |}|  |d }|| d| d| d| d| d
 |S )Nr   z and (r   z or starts-with(, z)))r<   r:   )r,   r]   r   r|   r   Zarg_dashr   r   r   xpath_attrib_dashmatch  s    
 z(GenericTranslator.xpath_attrib_dashmatchc              	   C  s6   |r(| | d| d| | d n
| d |S )Nz and starts-with(r   r9   ry   r   r   r   r   r   xpath_attrib_prefixmatch  s    
z*GenericTranslator.xpath_attrib_prefixmatchc                 C  sH   |r:| | d| d| dt|d  d| | 	 n
| d |S )Nz and substring(z, string-length(z)-r   z) = ry   )r:   r   r<   r   r   r   r   xpath_attrib_suffixmatch  s    ,
z*GenericTranslator.xpath_attrib_suffixmatchc              	   C  s6   |r(| | d| d| | d n
| d |S )Nz and contains(r   r9   ry   r   r   r   r   r   xpath_attrib_substringmatch  s    
z-GenericTranslator.xpath_attrib_substringmatchN)rO   )rO   F)FT)Gr   r   r   r   rs   r   Zid_attributelang_attributer   r   r   r    r_   rY   rS   ra   staticmethodr<   r]   rv   rz   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   xpath_link_pseudoZxpath_visited_pseudoZxpath_hover_pseudoZxpath_active_pseudoZxpath_focus_pseudoZxpath_target_pseudoxpath_enabled_pseudoxpath_disabled_pseudoxpath_checked_pseudor   r   r   r   r   r   r   r   r   r   r   r   r;      s     #			   	
r;   c                   @  sx   e Zd ZdZdZddddddZd	d	d
ddZd	dd	dddZd	d	d
ddZd	d	d
ddZ	d	d	d
ddZ
dS )HTMLTranslatora  
    Translator for (X)HTML documents.

    Has a more useful implementation of some pseudo-classes based on
    HTML-specific element names and attribute names, as described in
    the `HTML5 specification`_. It assumes no-quirks mode.
    The API is the same as :class:`GenericTranslator`.

    .. _HTML5 specification: http://www.w3.org/TR/html5/links.html#selectors

    :param xhtml:
        If false (the default), element names and attribute names
        are case-insensitive.

    langFr$   r%   )xhtmlr*   c                 C  s   || _ |sd| _d| _d S )NT)r   r   r   )r,   r   r   r   r   r-   3  s    zHTMLTranslator.__init__r    r   c                 C  s
   | dS )Nz(@selected and name(.) = 'option') or (@checked and (name(.) = 'input' or name(.) = 'command')and (@type = 'checkbox' or @type = 'radio'))r   r   r   r   r   r   :  s    z#HTMLTranslator.xpath_checked_pseudor   r   c                 C  sd   |  dgdgfvr$td|j|jd j}|s8J | | d }|d| j d| dS )	Nr   r   r   r   r   z<ancestor-or-self::*[@lang][1][starts-with(concat(translate(@zE, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '-'), z)])r   r   r   r|   r<   rn   r:   r   )r,   r]   r   r|   r   r   r   r   r   C  s    
z"HTMLTranslator.xpath_lang_functionc                 C  s
   | dS )NzA@href and (name(.) = 'a' or name(.) = 'link' or name(.) = 'area')r   r   r   r   r   r   S  s    z HTMLTranslator.xpath_link_pseudoc                 C  s
   | dS )Na  
        (
            @disabled and
            (
                (name(.) = 'input' and @type != 'hidden') or
                name(.) = 'button' or
                name(.) = 'select' or
                name(.) = 'textarea' or
                name(.) = 'command' or
                name(.) = 'fieldset' or
                name(.) = 'optgroup' or
                name(.) = 'option'
            )
        ) or (
            (
                (name(.) = 'input' and @type != 'hidden') or
                name(.) = 'button' or
                name(.) = 'select' or
                name(.) = 'textarea'
            )
            and ancestor::fieldset[@disabled]
        )
        r   r   r   r   r   r   [  s    z$HTMLTranslator.xpath_disabled_pseudoc                 C  s
   | dS )Na'  
        (
            @href and (
                name(.) = 'a' or
                name(.) = 'link' or
                name(.) = 'area'
            )
        ) or (
            (
                name(.) = 'command' or
                name(.) = 'fieldset' or
                name(.) = 'optgroup'
            )
            and not(@disabled)
        ) or (
            (
                (name(.) = 'input' and @type != 'hidden') or
                name(.) = 'button' or
                name(.) = 'select' or
                name(.) = 'textarea' or
                name(.) = 'keygen'
            )
            and not (@disabled or ancestor::fieldset[@disabled])
        ) or (
            name(.) = 'option' and not(
                @disabled or ancestor::optgroup[@disabled]
            )
        )
        r   r   r   r   r   r   y  s    z#HTMLTranslator.xpath_enabled_pseudoN)F)r   r   r   r   r   r-   r   r   r   r   r   r   r   r   r   r      s   	r   ))r   
__future__r   recollections.abcr   typingr   r   r   Zcssselect.parserr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   Ztyping_extensionsr   RuntimeErrorr   r    compilesplitri   matchr   r   r;   r   r   r   r   r   <module>   s&   LD     