o
    "“iÍ  ã                   @  s  d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZm	Z	 G dd„ de
ƒZeZeZeZeZeZejdkrBejeeef ZnejZd-dd„Zd.dd„Zd/d0dd„ZG dd„ deƒZG dd„ dƒZG dd„ dejƒZ	d/d1d$d%„Z d2d)d*„Z!G d+d,„ d,ej"ƒZ"dS )3é    )ÚannotationsN)ÚCallableÚSequencec                   @  ó   e Zd ZdS )ÚCryptographyDeprecationWarningN©Ú__name__Ú
__module__Ú__qualname__© r   r   úR/var/www/html/premium_crap/venv/lib/python3.10/site-packages/cryptography/utils.pyr      ó    r   )é   é	   ÚnameÚstrÚvalueÚbytesÚreturnÚNonec                 C  s   t |tƒst| › d�ƒ‚d S )Nz must be bytes)Ú
isinstancer   Ú	TypeError©r   r   r   r   r   Ú_check_bytes)   s   
ÿr   ÚBufferc                 C  s,   zt |ƒ W d S  ty   t| › d�ƒ‚w )Nz must be bytes-like)Ú
memoryviewr   r   r   r   r   Ú_check_byteslike.   s
   ÿr   ÚintegerÚintÚlengthú
int | Nonec                 C  s0   |dkrt dƒ‚|  |p|  ¡ d d pdd¡S )Nr   zlength argument can't be 0é   é   é   Úbig)Ú
ValueErrorÚto_bytesÚ
bit_length)r   r   r   r   r   Úint_to_bytes5   s
   ÿr(   c                   @  r   )ÚInterfaceNotImplementedNr   r   r   r   r   r)   =   r   r)   c                   @  s   e Zd Zddd„ZdS )	Ú_DeprecatedValuer   ÚobjectÚmessager   c                 C  s   || _ || _|| _d S ©N)r   r,   Úwarning_class)Úselfr   r,   r.   r   r   r   Ú__init__B   s   
z_DeprecatedValue.__init__N)r   r+   r,   r   )r   r	   r
   r0   r   r   r   r   r*   A   s    r*   c                      sF   e Zd Zd‡ fdd„Zdd	d
„Zddd„Zddd„Zddd„Z‡  ZS )Ú_ModuleWithDeprecationsÚmoduleútypes.ModuleTypec                   s   t ƒ  |j¡ || jd< d S ©NÚ_module)Úsuperr0   r   Ú__dict__)r/   r2   ©Ú	__class__r   r   r0   I   s   z _ModuleWithDeprecations.__init__Úattrr   r   r+   c                 C  s4   t | j|ƒ}t|tƒrtj|j|jdd� |j}|S ©Né   )Ú
stacklevel)	Úgetattrr5   r   r*   ÚwarningsÚwarnr,   r.   r   ©r/   r:   Úobjr   r   r   Ú__getattr__M   s
   
z#_ModuleWithDeprecations.__getattr__r   r   c                 C  s   t | j||ƒ d S r-   )Úsetattrr5   )r/   r:   r   r   r   r   Ú__setattr__T   s   z#_ModuleWithDeprecations.__setattr__c                 C  s:   t | j|ƒ}t|tƒrtj|j|jdd� t| j|ƒ d S r;   )	r>   r5   r   r*   r?   r@   r,   r.   ÚdelattrrA   r   r   r   Ú__delattr__W   s   
z#_ModuleWithDeprecations.__delattr__úSequence[str]c                 C  s   dgt | jƒ¢S r4   )Údirr5   ©r/   r   r   r   Ú__dir__^   s   z_ModuleWithDeprecations.__dir__)r2   r3   )r:   r   r   r+   )r:   r   r   r+   r   r   )r:   r   r   r   )r   rH   )	r   r	   r
   r0   rC   rE   rG   rK   Ú__classcell__r   r   r8   r   r1   H   s    


r1   r+   Úmodule_namer,   r.   útype[Warning]ú
str | Nonec                 C  sJ   t j| }t|tƒst|ƒ t j|< }t| ||ƒ}|d ur#t|||ƒ |S r-   )ÚsysÚmodulesr   r1   r*   rD   )r   rM   r,   r.   r   r2   Údvr   r   r   Ú
deprecatedb   s   

rS   Úfuncr   Úpropertyc                   s*   dˆ› �‰ t ƒ ‰d‡ ‡‡fdd„}t|ƒS )NÚ_cached_Úinstancer+   c                   s0   t | ˆ ˆƒ}|ˆur|S ˆ| ƒ}t| ˆ |ƒ |S r-   )r>   rD   )rW   ÚcacheÚresult©Úcached_namerT   Úsentinelr   r   Úinnerw   s   zcached_property.<locals>.inner)rW   r+   )r+   rU   )rT   r]   r   rZ   r   Úcached_propertys   s   
r^   c                   @  s    e Zd Zddd„Zddd„ZdS )	ÚEnumr   r   c                 C  s    d| j j› d| j› d| j›d�S )Nú<Ú.z: ú>)r9   r   Ú_name_Ú_value_rJ   r   r   r   Ú__repr__…   s    zEnum.__repr__c                 C  s   | j j› d| j› �S )Nra   )r9   r   rc   rJ   r   r   r   Ú__str__ˆ   s   zEnum.__str__N)r   r   )r   r	   r
   re   rf   r   r   r   r   r_   „   s    
r_   )r   r   r   r   r   r   )r   r   r   r   r   r   r-   )r   r   r   r    r   r   )r   r+   rM   r   r,   r   r.   rN   r   rO   r   r*   )rT   r   r   rU   )#Ú
__future__r   ÚenumrP   ÚtypesÚtypingr?   Úcollections.abcr   r   ÚUserWarningr   ÚDeprecatedIn36ÚDeprecatedIn40ÚDeprecatedIn41ÚDeprecatedIn42ÚDeprecatedIn43Úversion_infoÚUnionr   Ú	bytearrayr   r   Ú
ByteStringr   r   r(   Ú	Exceptionr)   r*   Ú
ModuleTyper1   rS   r^   r_   r   r   r   r   Ú<module>   s4   


û
