o
    okj                     @  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 G dd de	Z
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)d+d#d$ZG d%d& d&ej Z dS ),    )annotationsN)Sequencec                   @     e Zd ZdS )CryptographyDeprecationWarningN__name__
__module____qualname__ r
   r
   P/home/djax/ivt_ai_plugin/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@   t |tttfr
d S zt| W d S  ty   t|  dw )Nz must be bytes-like)r   r   	bytearray
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_bytes6   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__C   s   
z_DeprecatedValue.__init__N)r   r)   r*   r   )r   r   r	   r.   r
   r
   r
   r   r(   B   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.   J   s   z _ModuleWithDeprecations.__init__r   r   r   
typing.Anyc                 C  sB   t | j|}t|trtj|j|jdd |j}|S || j	|< |S N   )
stacklevel)
getattrr3   r   r(   warningswarnr*   r,   r   r5   )r-   r   objr
   r
   r   __getattr__N   s   
	
z#_ModuleWithDeprecations.__getattr__attrr   r)   r   c                 C  s6   t |tr| j|d  n|| j|< t| j|| d S r+   )r   r(   r5   popsetattrr3   )r-   rA   r   r
   r
   r   __setattr__]   s   

z#_ModuleWithDeprecations.__setattr__c                 C  sH   t | j|}t|trtj|j|jdd | j	|d  t
| j| d S r9   )r<   r3   r   r(   r=   r>   r*   r,   r5   rB   delattr)r-   rA   r?   r
   r
   r   __delattr__d   s
   
z#_ModuleWithDeprecations.__delattr__Sequence[str]c                 C  s   dgt | jS r2   )dirr3   r-   r
   r
   r   __dir__l   s   z_ModuleWithDeprecations.__dir__)r0   r1   )r   r   r   r8   )rA   r   r   r)   r   r   )rA   r   r   r   )r   rG   )	r   r   r	   r.   r@   rD   rF   rJ   __classcell__r
   r
   r6   r   r/   I   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(   rC   )r   rL   r*   r,   r   r0   dvr
   r
   r   
deprecatedp   s   

rR   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_rI   r
   r
   r   __repr__   s    zEnum.__repr__c                 C  s   | j j d| j S )NrU   )r7   r   rW   rI   r
   r
   r   __str__   s   zEnum.__str__N)r   r   )r   r   r	   rY   rZ   r
   r
   r
   r   rS      s    
rS   )r   r   r   r   r   r   )r   r   r   r   r   r   r+   )r   r   r   r   r   r   )r   r)   rL   r   r*   r   r,   rM   r   rN   r   r(   )!
__future__r   enumrO   typestypingr=   collections.abcr   UserWarningr   DeprecatedIn36DeprecatedIn40DeprecatedIn41DeprecatedIn42DeprecatedIn43DeprecatedIn47DeprecatedIn50Unionr   r   r   r   r   r   r&   	Exceptionr'   r(   
ModuleTyper/   rR   rS   r
   r
   r
   r   <module>   s2   

	,