B
    `                 @   s   d Z ddlmZmZ ddlZddlZdZedZe	dZ
e	dZedd	d
d ZG dd deZdddZdddZdd ZdS )zUtility.    )wraps	lru_cacheN   z(?:\r\n|(?!\r\n)[\n\r])|$AZi   )maxsizec             C   sR   g }xB| D ]:}t |}|t|  kr.tkr>n nt|d n| q
W d|S )zLower.     )ordappendUC_AUC_Zchrjoin)stringZ
new_stringco r   V/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/soupsieve/util.pylower   s
    
2r   c                   s"   e Zd ZdZd fdd	Z  ZS )SelectorSyntaxErrorzSyntax error in a CSS selector.Nc                s^   d| _ d| _d| _|dk	rJ|dk	rJt||\| _| _ | _d|| j | j}tt| | dS )zInitialize.Nz{}
  line {}:
{})linecolcontextget_pattern_contextformatsuperr   __init__)selfmsgpatternindex)	__class__r   r   r      s    zSelectorSyntaxError.__init__)NN)__name__
__module____qualname____doc__r   __classcell__r   r   )r"   r   r      s   r      c                s    fdd}|S )z
    Raise a `DeprecationWarning` when wrapped function/method is called.

    Borrowed from https://stackoverflow.com/a/48632082/866026
    c                s   t   fdd}|S )Nc                 s$   t jd jtd  | |S )Nz'{}' is deprecated. {})category
stacklevel)warningswarnr   r#   DeprecationWarning)argskwargs)funcmessager*   r   r   _func3   s
    z-deprecated.<locals>._decorator.<locals>._func)r   )r0   r2   )r1   r*   )r0   r   
_decorator2   s    zdeprecated.<locals>._decoratorr   )r1   r*   r3   r   )r1   r*   r   
deprecated+   s    
r4   c             C   s   t j| t|d dS )zWarn deprecated.)r)   r*   N)r+   r,   r-   )r1   r*   r   r   r   warn_deprecated?   s    r5   c             C   s.  d}d}d}g }d}xt | D ]}| ||d }t|dsdt|sdd}	d}
|| d }nR||  kr~|dk rn n,d}	||dkrdndd }
|| d }nd}	d}
t|r|d	 |d
|	| |
dk	r|d	 |d||
  d  |}|d7 }|d}q"W d|||fS )zGet the pattern context.r   r   r	   z-->    z    N
z{}{} ^)	RE_PATTERN_LINE_SPLITfinditerstartlengroupendr   r   r   )r    r!   lastcurrent_liner   textr   mZlinetextindentoffsetr   r   r   r   I   s6    


r   )r(   )r(   )r&   	functoolsr   r   r+   reDEBUGcompiler;   r
   r   r   r   	Exceptionr   r4   r5   r   r   r   r   r   <module>   s   



