o
    Th-                     @  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ZejdkrFe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/home/air/segue/gpt/backup/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_byteslike0   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_bytes7   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__D   s   
z_DeprecatedValue.__init__N)r   r+   r,   r   )r   r	   r
   r0   r   r   r   r   r*   C   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   K   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__O   s
   
z#_ModuleWithDeprecations.__getattr__r   r   c                 C  s   t | j|| d S r-   )setattrr5   )r/   r:   r   r   r   r   __setattr__V   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__Y   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   J   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   
deprecatedd   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   innery   s   zcached_property.<locals>.inner)rW   r+   )r+   rU   )rT   r]   r   rZ   r   cached_propertyu   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DeprecatedIn37DeprecatedIn40DeprecatedIn41DeprecatedIn42DeprecatedIn43DeprecatedIn45version_infoUnionr   	bytearrayr   r   
ByteStringr   r   r(   	Exceptionr)   r*   
ModuleTyper1   rS   r^   r_   r   r   r   r   <module>   s8   



