
    Dg	              	           d dl mZ d dlmZ d dlmZ 	 ddedee         ded	efd
Z	 ddedee         ded	efdZ		 ddedee         ded	efdZ
	 ddedee         ded	efdZ	 ddedee         ded	efdZdS )    )Optional)warn)
StrOrBytesNstricttextencodingerrorsreturnc                     t          dt          d           |d}t          | t                    r|                     ||          S | S )Nz^The w3lib.utils.str_to_unicode function is deprecated and will be removed in a future release.   
stacklevelutf-8)r   DeprecationWarning
isinstancebytesdecoder   r   r	   s      ?/var/www/sysmax/venv/lib/python3.11/site-packages/w3lib/util.pystr_to_unicoder      s^     		/	    $ -{{8V,,,K    c                     t          dt          d           |d}t          | t                    r|                     ||          S | S )Nz^The w3lib.utils.unicode_to_str function is deprecated and will be removed in a future release.r   r   r   )r   r   r   strencoder   s      r   unicode_to_strr      s^     		/	    $ -{{8V,,,Kr   c                     t          | t                    r| S t          | t          t          f          s$t          dt	          |           j                   |d}|                     ||          S )zxReturn the unicode representation of a bytes object `text`. If `text`
    is already an unicode object, return it as-is.z*to_unicode must receive bytes or str, got Nr   )r   r   r   	TypeErrortype__name__r   r   s      r   
to_unicoder    '   sx    
 $ dUCL)) 
Nd9LNN
 
 	
 ;;x(((r   c                     t          | t                    r| S t          | t                    s$t          dt	          |           j                   |d}|                     ||          S )zeReturn the binary representation of `text`. If `text`
    is already a bytes object, return it as-is.z(to_bytes must receive str or bytes, got Nr   )r   r   r   r   r   r   r   r   s      r   to_bytesr"   7   st    
 $ dC   
LtDzz7JLL
 
 	
 ;;x(((r   c                 R    t          dt          d           t          | ||          S )z#Return str representation of `text`zThe w3lib.utils.to_native_str function is deprecated and will be removed in a future release. Please use w3lib.utils.to_unicode instead.r   r   )r   r   r    r   s      r   to_native_strr$   G   s<     		* 	    dHf---r   )Nr   )typingr   warningsr   w3lib._typesr   r   r   r   r   r    r"   r$    r   r   <module>r)      s               # # # # # # EM 
 (>A   " EM 
 (>A
   " EM) )
) ()>A)) ) ) )" EM) )
) ()>A)
) ) ) )" EM. .
. (.>A.. . . . . .r   