a
    ϏPf                     @  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G dd deZeZ	eZ
eZeZeZddddd	d
ZddddddZd*ddddddZdddddZG dd deZG dd dZG dd dejZd+ddddddd d!d"Zd#d$d%d&d'ZG d(d) d)ejZdS ),    )annotationsNc                   @  s   e Zd ZdS )CryptographyDeprecationWarningN__name__
__module____qualname__ r   r   S/var/www/html/python-backend/venv/lib/python3.9/site-packages/cryptography/utils.pyr      s   r   strbytesNone)namevaluereturnc                 C  s   t |tst|  dd S )Nz must be bytes)
isinstancer   	TypeErrorr   r   r   r   r	   _check_bytes   s    
r   c                 C  s2   zt | W n  ty,   t|  dY n0 d S )Nz must be bytes-like)
memoryviewr   r   r   r   r	   _check_byteslike#   s    r   intz
int | None)integerlengthr   c                 C  s    |  |p|  d d pddS )N         big)to_bytes
bit_length)r   r   r   r   r	   int_to_bytes*   s    r   z
typing.Anyztuple[typing.Any, int])objr   c                 C  s.   ddl m} |j| }|t|jd|fS )Nr   )_opensslZ	uintptr_t)Z"cryptography.hazmat.bindings._rustr!   ffiZfrom_bufferr   cast)r    r!   bufr   r   r	   _extract_buffer_length0   s    r%   c                   @  s   e Zd ZdS )InterfaceNotImplementedNr   r   r   r   r	   r&   7   s   r&   c                   @  s   e Zd ZdddddZdS )_DeprecatedValueobjectr
   )r   messagec                 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'   ;   s   r'   c                      sb   e Zd Zdd fddZddddd	Zddd
dddZdd
dddZddddZ  ZS )_ModuleWithDeprecationsztypes.ModuleType)modulec                   s   t  |j || jd< d S N_module)superr-   r   __dict__)r,   r/   	__class__r   r	   r-   C   s    z _ModuleWithDeprecations.__init__r
   r(   )attrr   c                 C  s4   t | j|}t|tr0tj|j|jdd |j}|S N   )
stacklevel)	getattrr1   r   r'   warningswarnr)   r+   r   r,   r6   r    r   r   r	   __getattr__G   s
    
z#_ModuleWithDeprecations.__getattr__r   )r6   r   r   c                 C  s   t | j|| d S r*   )setattrr1   )r,   r6   r   r   r   r	   __setattr__N   s    z#_ModuleWithDeprecations.__setattr__c                 C  s:   t | j|}t|tr*tj|j|jdd t| j| d S r7   )	r:   r1   r   r'   r;   r<   r)   r+   delattrr=   r   r   r	   __delattr__Q   s    
z#_ModuleWithDeprecations.__delattr__ztyping.Sequence[str]r   c                 C  s   dgt | jS r0   )dirr1   r,   r   r   r	   __dir__X   s    z_ModuleWithDeprecations.__dir__)	r   r   r   r-   r>   r@   rB   rF   __classcell__r   r   r4   r	   r.   B   s
   r.   r(   ztype[Warning]z
str | None)r   module_namer)   r+   r   r   c                 C  sJ   t j| }t|ts&t| t j|< }t| ||}|d urFt||| |S r*   )sysmodulesr   r.   r'   r?   )r   rH   r)   r+   r   r/   Zdvr   r   r	   
deprecated\   s    

rK   ztyping.Callableproperty)funcr   c                   s.   d  t  dd fdd}t|S )NZ_cached_r(   )instancec                   s0   t |  }|ur|S | }t|  | |S r*   )r:   r?   )rN   cacheresultZcached_namerM   sentinelr   r	   innerq   s    zcached_property.<locals>.inner)r(   rL   )rM   rS   r   rQ   r	   cached_propertym   s    
rT   c                   @  s(   e Zd ZddddZddddZdS )Enumr
   rC   c                 C  s    d| j j d| j d| jdS )N<.z: >)r5   r   _name__value_rE   r   r   r	   __repr__   s    zEnum.__repr__c                 C  s   | j j d| j S )NrW   )r5   r   rY   rE   r   r   r	   __str__   s    zEnum.__str__N)r   r   r   r[   r\   r   r   r   r	   rU   ~   s   rU   )N)N)
__future__r   enumrI   typestypingr;   UserWarningr   ZDeprecatedIn36ZDeprecatedIn37ZDeprecatedIn40ZDeprecatedIn41ZDeprecatedIn42r   r   r   r%   	Exceptionr&   r'   
ModuleTyper.   rK   rT   rU   r   r   r   r	   <module>   s,    