a
    còfU  ã                   @  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dœd	d
„Zddddœdd„Zd%dd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ddddœdd„Zddd œd!d"„ZG d#d$„ d$ejƒZdS )'é    )ÚannotationsNc                   @  s   e Zd ZdS )ÚCryptographyDeprecationWarningN©Ú__name__Ú
__module__Ú__qualname__© r   r   úO/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/cryptography/utils.pyr      s   r   ÚstrÚbytesÚNone)ÚnameÚvalueÚreturnc                 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  s2   zt |ƒ W n  ty,   t| › d�ƒ‚Y n0 d S )Nz must be bytes-like)Ú
memoryviewr   r   r   r   r	   Ú_check_byteslike$   s    r   Úintz
int | None)ÚintegerÚlengthr   c                 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                   @  s   e Zd ZdS )ÚInterfaceNotImplementedNr   r   r   r   r	   r!   3   s   r!   c                   @  s   e Zd Zdddœdd„ZdS )Ú_DeprecatedValueÚobjectr
   )r   Úmessagec                 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"   7   s   r"   c                      sb   e Zd Zddœ‡ fdd„Zdddœdd	„Zddd
dœdd„Zdd
dœdd„Zddœdd„Z‡  ZS )Ú_ModuleWithDeprecationsztypes.ModuleType)Úmodulec                   s   t ƒ  |j¡ || jd< d S ©NÚ_module)Úsuperr(   r   Ú__dict__)r'   r*   ©Ú	__class__r   r	   r(   ?   s    z _ModuleWithDeprecations.__init__r
   r#   )Úattrr   c                 C  s4   t | j|ƒ}t|tƒr0tj|j|jdd� |j}|S ©Né   )Ú
stacklevel)	Úgetattrr,   r   r"   ÚwarningsÚwarnr$   r&   r   ©r'   r1   Úobjr   r   r	   Ú__getattr__C   s
    
z#_ModuleWithDeprecations.__getattr__r   )r1   r   r   c                 C  s   t | j||ƒ d S r%   )Úsetattrr,   )r'   r1   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 r2   )	r5   r,   r   r"   r6   r7   r$   r&   Údelattrr8   r   r   r	   Ú__delattr__M   s    
z#_ModuleWithDeprecations.__delattr__ztyping.Sequence[str]©r   c                 C  s   dgt | jƒ¢S r+   )Údirr,   ©r'   r   r   r	   Ú__dir__T   s    z_ModuleWithDeprecations.__dir__)	r   r   r   r(   r:   r<   r>   rB   Ú__classcell__r   r   r/   r	   r)   >   s
   r)   r#   ztype[Warning]z
str | None)r   Úmodule_namer$   r&   r   r   c                 C  sJ   t j| }t|tƒs&t|ƒ t j|< }t| ||ƒ}|d urFt|||ƒ |S r%   )ÚsysÚmodulesr   r)   r"   r;   )r   rD   r$   r&   r   r*   Zdvr   r   r	   Ú
deprecatedX   s    

rG   ztyping.CallableÚproperty)Úfuncr   c                   s.   dˆ› �‰ t ƒ ‰ddœ‡ ‡‡fdd„}t|ƒS )NZ_cached_r#   )Úinstancec                   s0   t | ˆ ˆƒ}|ˆur|S ˆ| ƒ}t| ˆ |ƒ |S r%   )r5   r;   )rJ   ÚcacheÚresult©Zcached_namerI   Úsentinelr   r	   Úinnerm   s    zcached_property.<locals>.inner)r#   rH   )rI   rO   r   rM   r	   Úcached_propertyi   s    
rP   c                   @  s(   e Zd Zddœdd„Zddœdd„ZdS )ÚEnumr
   r?   c                 C  s    d| j j› d| j› d| j›d�S )Nú<Ú.z: ú>)r0   r   Ú_name_Ú_value_rA   r   r   r	   Ú__repr__{   s    zEnum.__repr__c                 C  s   | j j› d| j› �S )NrS   )r0   r   rU   rA   r   r   r	   Ú__str__~   s    zEnum.__str__N)r   r   r   rW   rX   r   r   r   r	   rQ   z   s   rQ   )N)N)Ú
__future__r   ÚenumrE   ÚtypesÚtypingr6   ÚUserWarningr   ZDeprecatedIn36ZDeprecatedIn37ZDeprecatedIn40ZDeprecatedIn41ZDeprecatedIn42ZDeprecatedIn43r   r   r    Ú	Exceptionr!   r"   Ú
ModuleTyper)   rG   rP   rQ   r   r   r   r	   Ú<module>   s,    û