a
    xd	                     @   s   d dl mZ d dlmZ d dlmZ deee eedddZdeee eedd	d
Z	deee eedddZ
deee eedddZdeee eedddZdS )    )warn)Optional)
StrOrBytesNstrict)textencodingerrorsreturnc                 C   s4   t dtdd |d u rd}t| tr0| ||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    r   B/var/www/html/Ranjet/env/lib/python3.9/site-packages/w3lib/util.pystr_to_unicode   s    
r   c                 C   s4   t dtdd |d u rd}t| tr0| ||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   r   r   r   unicode_to_str   s    
r   c                 C   sH   t | tr| S t | ttfs0tdt| j |du r<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   r   r   r   
to_unicode'   s    
r   c                 C   sD   t | tr| S t | ts,tdt| j |du r8d}| ||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   r   r   r   to_bytes7   s    

r   c                 C   s   t dtd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   r   r   r   to_native_strG   s    r   )Nr   )Nr   )Nr   )Nr   )Nr   )warningsr   typingr   Zw3lib._typesr   r   r   r   r   r   r   r   r   r   r   r   <module>   s6    
 
 
 
 
