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   X/var/www/html/fyndo/pharma/fyndo/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   


