o
    CZh                     @  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Zd/ddZd0d1ddZd2ddZG dd deZG dd dZG dd dejZ	d0d3d&d'Zd4d+d,ZG d-d. d.ejZdS )5    )annotationsNc                   @     e Zd ZdS )CryptographyDeprecationWarningN__name__
__module____qualname__ r	   r	   I/var/www/html/lang_env/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   c                 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  s    |  |p|  d d pddS )N         big)to_bytes
bit_length)r   r   r	   r	   r
   int_to_bytes*   s   r"   obj
typing.Anytuple[typing.Any, int]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                   @  r   )InterfaceNotImplementedNr   r	   r	   r	   r
   r+   7   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.   r0   r	   r	   r
   __init__<   s   
z_DeprecatedValue.__init__N)r   r-   r.   r   )r   r   r   r2   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)superr2   r   __dict__)r1   r4   	__class__r	   r
   r2   C   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)	getattrr7   r   r,   warningswarnr.   r0   r   r1   r<   r#   r	   r	   r
   __getattr__G   s
   
z#_ModuleWithDeprecations.__getattr__r   r   c                 C  s   t | j|| d S r/   )setattrr7   )r1   r<   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 r=   )	r@   r7   r   r,   rA   rB   r.   r0   delattrrC   r	   r	   r
   __delattr__Q   s   
z#_ModuleWithDeprecations.__delattr__typing.Sequence[str]c                 C  s   dgt | jS r6   )dirr7   r1   r	   r	   r
   __dir__X   s   z_ModuleWithDeprecations.__dir__)r4   r5   )r<   r   r   r-   )r<   r   r   r-   r   r   )r<   r   r   r   )r   rI   )	r   r   r   r2   rD   rF   rH   rL   __classcell__r	   r	   r:   r
   r3   B   s    


r3   r-   module_namer.   r0   type[Warning]
str | Nonec                 C  sJ   t j| }t|tst| t j|< }t| ||}|d ur#t||| |S r/   )sysmodulesr   r3   r,   rE   )r   rN   r.   r0   r   r4   Zdvr	   r	   r
   
deprecated\   s   

rS   functyping.Callablepropertyc                   s*   d  t  d fdd}t|S )NZ_cached_instancer-   c                   s0   t |  }|ur|S | }t|  | |S r/   )r@   rE   )rW   cacheresultZcached_namerT   sentinelr	   r
   innerq   s   zcached_property.<locals>.inner)rW   r-   )r-   rV   )rT   r\   r	   rZ   r
   cached_propertym   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: >)r;   r   _name__value_rK   r	   r	   r
   __repr__   s    zEnum.__repr__c                 C  s   | j j d| j S )Nr`   )r;   r   rb   rK   r	   r	   r
   __str__   s   zEnum.__str__N)r   r   )r   r   r   rd   re   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-   rN   r   r.   r   r0   rO   r   rP   r   r,   )rT   rU   r   rV   )
__future__r   enumrQ   typestypingrA   UserWarningr   ZDeprecatedIn36ZDeprecatedIn37ZDeprecatedIn40ZDeprecatedIn41ZDeprecatedIn42r   r   r"   r*   	Exceptionr+   r,   
ModuleTyper3   rS   r]   r^   r	   r	   r	   r
   <module>   s.   



