o
    VhU                     @  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e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d.d&d'ZG d(d) d)ejZdS )/    )annotationsNc                   @     e Zd ZdS )CryptographyDeprecationWarningN__name__
__module____qualname__ r	   r	   f/var/www/html/construction_image-detection-poc/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   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  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_bytes+   s
   r#   c                   @  r   )InterfaceNotImplementedNr   r	   r	   r	   r
   r$   3   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__8   s   
z_DeprecatedValue.__init__N)r   r&   r'   r   )r   r   r   r+   r	   r	   r	   r
   r%   7   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*   r-   	__class__r	   r
   r+   ?   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)	getattrr0   r   r%   warningswarnr'   r)   r   r*   r5   objr	   r	   r
   __getattr__C   s
   
z#_ModuleWithDeprecations.__getattr__r   r   c                 C  s   t | j|| d S r(   )setattrr0   )r*   r5   r   r	   r	   r
   __setattr__J   s   z#_ModuleWithDeprecations.__setattr__c                 C  s:   t | j|}t|trtj|j|jdd t| j| d S r6   )	r9   r0   r   r%   r:   r;   r'   r)   delattrr<   r	   r	   r
   __delattr__M   s   
z#_ModuleWithDeprecations.__delattr__typing.Sequence[str]c                 C  s   dgt | jS r/   )dirr0   r*   r	   r	   r
   __dir__T   s   z_ModuleWithDeprecations.__dir__)r-   r.   )r5   r   r   r&   )r5   r   r   r&   r   r   )r5   r   r   r   )r   rC   )	r   r   r   r+   r>   r@   rB   rF   __classcell__r	   r	   r3   r
   r,   >   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%   r?   )r   rH   r'   r)   r   r-   dvr	   r	   r
   
deprecatedX   s   

rN   functyping.Callablepropertyc                   s*   d  t  d fdd}t|S )N_cached_instancer&   c                   s0   t |  }|ur|S | }t|  | |S r(   )r9   r?   )rS   cacheresultcached_namerO   sentinelr	   r
   innerm   s   zcached_property.<locals>.inner)rS   r&   )r&   rQ   )rO   rY   r	   rV   r
   cached_propertyi   s   
rZ   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: >)r4   r   _name__value_rE   r	   r	   r
   __repr__{   s    zEnum.__repr__c                 C  s   | j j d| j S )Nr]   )r4   r   r_   rE   r	   r	   r
   __str__~   s   zEnum.__str__N)r   r   )r   r   r   ra   rb   r	   r	   r	   r
   r[   z   s    
r[   )r   r   r   r   r   r   r(   )r   r   r   r   r   r   )r   r&   rH   r   r'   r   r)   rI   r   rJ   r   r%   )rO   rP   r   rQ   )
__future__r   enumrK   typestypingr:   UserWarningr   DeprecatedIn36DeprecatedIn37DeprecatedIn40DeprecatedIn41DeprecatedIn42DeprecatedIn43r   r   r#   	Exceptionr$   r%   
ModuleTyper,   rN   rZ   r[   r	   r	   r	   r
   <module>   s.   


