
    ]h                     D   d Z ddlmZmZmZmZ dZdZddlZddl	Z	ddl
Z
e
j                  d   dk\  rddlmZ nddlmZ  G d d	e      Z e	j$                  d
      j&                  Zd Zd Zd Zd Zd Z e	j$                  de	j4                        j6                  Zd Zd Zy)zcss_parser helper TEST
    )unicode_literalsdivisionabsolute_importprint_functionrestructuredtextz8$Id: errorhandler.py 1234 2008-05-22 20:26:12Z cthedot $N   )pathname2urlc                       e Zd ZdZd Zd Zy)
Deprecateda.  This is a decorator which can be used to mark functions
    as deprecated. It will result in a warning being emitted
    when the function is used.

    It accepts a single paramter ``msg`` which is shown with the warning.
    It should contain information which function or method to use instead.
    c                     || _         y )N)msg)selfr   s     /home/pod-website-builder.sw7ft.com/pod-website-builder/website-analyzer/venv/lib/python3.12/site-packages/css_parser/helper.py__init__zDeprecated.__init__   s	        c                       fd}j                   |_         j                  |_        |j                  j                  j                         |S )Nc                      dd l }|j                  dj                  dj                  t        d        | i |S )Nr   zCall to deprecated method z.    )category
stacklevel)warningswarn__name__r   DeprecationWarning)argskwargsr   funcr   s      r   newFuncz$Deprecated.__call__.<locals>.newFunc   sA    MM==$((4#5%&  ( (((r   )r   __doc____dict__update)r   r   r   s   `` r   __call__zDeprecated.__call__   s>    	)  ==,,.r   N)r   
__module____qualname__r   r   r"    r   r   r   r      s    r   r   z(\\[^0-9a-fA-F])c                 H    | rd }t        ||       } | j                         S | S )z
    normalizes x, namely:

    - remove any \ before non unicode sequences (0-9a-zA-Z) so for
      x=="c\olor\" return "color" (unicode escape sequences should have
      been resolved by the tokenizer already)
    - lowercase
    c                 *    | j                  d      dd  S )Nr      )group)matchobjs    r   removeescapeznormalize.<locals>.removeescape:   s    >>!$QR((r   )_simpleescapeslower)xr+   s     r   	normalizer/   0   s)     		)<+wwyr   c                 X    dt        t        j                  j                  |             z   S )zReturn file URL of `path`zfile:)urllib_pathname2urlospathabspath)r3   s    r   path2urlr5   B   s     ()>???r   c              #   *   K   |  |D ]  }|  yw)zQReturn new generator starting with token followed by all tokens in
    ``tokens``Nr%   )tokentokensts      r   	pushtokenr:   G   s!      K s   c                     | j                  dd      j                  dd      j                  dd      j                  dd      } | j                  d	      r| d
d dz   } d| z  S )zV
    Serialize value with quotes e.g.::

        ``a 'string`` => ``'a 'string'``
    
z\a z\d z\c "z\"\Nz\\z"%s")replaceendswithvalues    r   stringrF   P   sm     MM$'//fgfgU 

 ~~dcr
V#E>r   c                 >    | j                  d| d   z   | d         dd S )z
    Retrieve actual value of string without quotes. Escaped
    quotes inside the value are resolved, e.g.::

        ``'a 'string'`` => ``a 'string``
    r@   r   r(   rA   )rB   )rF   s    r   stringvaluerH   b   s(     >>$vay.&)4Qr::r   z.*?[\(\)\s\;,'"]c                 8    t        |       rt        |       } d| z  S )zm
    Serialize value by adding ``url()`` and with quotes if needed e.g.::

        ``"`` => ``url(""")``
    zurl(%s))_match_forbidden_in_urirF   rD   s    r   urirK   o   s      u%uur   c                     | | j                  d      dz   d j                         } | r| d   dv r| d   | d   k(  rt        |       S | S )z
    Return actual content without surrounding "url(" and ")"
    and removed surrounding quotes too including contained
    escapes of quotes, e.g.::

         ``url(""")`` => ``"``
    (r(   rA   r   z'")findstriprH   )rK   s    r   urivaluerP   z   sQ     chhsmAob
!
'
'
)C
A%c!fB&73
r   )r   
__future__r   r   r   r   __docformat____version__r2   resysversion_infourllib.requestr	   r1   urllibobjectr   compilesubr,   r/   r5   r:   rF   rH   UmatchrJ   rK   rP   r%   r   r   <module>r^      s    R R"H 	 	 
A!B: 6 /044$@
$; %"**%<bddCII r   