o
    Þ­j¹  ã                   @  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Zejeeef Zd,dd„Zd-dd„Zd.d/dd„ZG dd„ deƒZG dd„ dƒZG dd„ dejƒZ	d.d0d#d$„Zd1d(d)„Z G d*d+„ d+ej!ƒZ!dS )2é    )ÚannotationsN)ÚCallableÚSequencec                   @  ó   e Zd ZdS )ÚCryptographyDeprecationWarningN©Ú__name__Ú
__module__Ú__qualname__© r   r   úO/var/www/html/CropPilot/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_bytes3   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__@   s   
z_DeprecatedValue.__init__N)r   r)   r*   r   )r   r	   r
   r.   r   r   r   r   r(   ?   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)Úsuperr.   r   Ú__dict__)r-   r0   ©Ú	__class__r   r   r.   G   s   z _ModuleWithDeprecations.__init__r   r   r   ú
typing.Anyc                 C  s4   t | j|ƒ}t|tƒrtj|j|jdd� |j}|S ©Né   )Ú
stacklevel)	Úgetattrr3   r   r(   ÚwarningsÚwarnr*   r,   r   )r-   r   Úobjr   r   r   Ú__getattr__K   s
   
z#_ModuleWithDeprecations.__getattr__Úattrr   r)   r   c                 C  s   t | j||ƒ d S r+   )Úsetattrr3   )r-   rA   r   r   r   r   Ú__setattr__R   s   z#_ModuleWithDeprecations.__setattr__c                 C  s:   t | j|ƒ}t|tƒrtj|j|jdd� t| j|ƒ d S r9   )	r<   r3   r   r(   r=   r>   r*   r,   Údelattr)r-   rA   r?   r   r   r   Ú__delattr__U   s   
z#_ModuleWithDeprecations.__delattr__úSequence[str]c                 C  s   dgt | jƒ¢S r2   )Údirr3   ©r-   r   r   r   Ú__dir__\   s   z_ModuleWithDeprecations.__dir__)r0   r1   )r   r   r   r8   )rA   r   r   r)   r   r   )rA   r   r   r   )r   rF   )	r   r	   r
   r.   r@   rC   rE   rI   Ú__classcell__r   r   r6   r   r/   F   s    


r/   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   r/   r(   rB   )r   rK   r*   r,   r   r0   Údvr   r   r   Ú
deprecated`   s   

rQ   Úfuncr   Úpropertyc                   s*   dˆ› �‰ t ƒ ‰d‡ ‡‡fdd„}t|ƒS )NÚ_cached_Úinstancer)   c                   s0   t | ˆ ˆƒ}|ˆur|S ˆ| ƒ}t| ˆ |ƒ |S r+   )r<   rB   )rU   ÚcacheÚresult©Úcached_namerR   Úsentinelr   r   Úinneru   s   zcached_property.<locals>.inner)rU   r)   )r)   rS   )rR   r[   r   rX   r   Úcached_propertyq   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: ú>)r7   r   Ú_name_Ú_value_rH   r   r   r   Ú__repr__ƒ   s    zEnum.__repr__c                 C  s   | j j› d| j› �S )Nr_   )r7   r   ra   rH   r   r   r   Ú__str__†   s   zEnum.__str__N)r   r   )r   r	   r
   rc   rd   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)   rK   r   r*   r   r,   rL   r   rM   r   r(   )rR   r   r   rS   )"Ú
__future__r   ÚenumrN   ÚtypesÚtypingr=   Úcollections.abcr   r   ÚUserWarningr   ÚDeprecatedIn36ÚDeprecatedIn40ÚDeprecatedIn41ÚDeprecatedIn42ÚDeprecatedIn43ÚDeprecatedIn47ÚUnionr   Ú	bytearrayr   r   r   r   r&   Ú	Exceptionr'   r(   Ú
ModuleTyper/   rQ   r\   r]   r   r   r   r   Ú<module>   s2   

û
