Current File : //kunden/lib64/python3.9/site-packages/cryptography/__pycache__/utils.cpython-39.pyc
a

�am�@shddlZddlZddlZddlZddlZddlZddlZGdd�de�ZeZ	eZ
eZeZeZ
eedd�dd�Zeedd�dd�Zed	�d
d�Zejr�ddlmZejd
ed�ZGdd�de�Zejdd�dd�Zd*eejeed�dd�ZGdd�de�Z dd�Z!dd�dd�Z"Gdd �d e#�Z$Gd!d"�d"ej%�Z&d#d$�Z'd%d&�Z(e'ej)e*d'e�Z+Gd(d)�d)ej,�Z,dS)+�Nc@seZdZdS)�CryptographyDeprecationWarningN��__name__�
__module__�__qualname__�rr�8/usr/lib64/python3.9/site-packages/cryptography/utils.pyrsr)�name�value�returncCst|t�std�|���dS)Nz{} must be bytes)�
isinstance�bytes�	TypeError�format�r	r
rrr�_check_bytess
rcCs2zt|�Wn ty,td�|���Yn0dS)Nz{} must be bytes-like)�
memoryviewrrrrrr�_check_byteslike$sr�r	cst�fdd��S)Ncs
t|��S�N)�getattr��selfrrr�<lambda>,�z$read_only_property.<locals>.<lambda>)�propertyrrrr�read_only_property+sr)�Protocol�_T_class)�boundc@s$eZdZdd�eeed�dd�ZdS)�_RegisterDecoratorTypeF��check_annotations��klassr"rcCsdSrr)rr$r"rrr�__call__5sz_RegisterDecoratorType.__call__N)rrrr�boolr%rrrrr 4s
��r )�ifacercs dd�dtdd��fdd�}|S)NFr!rr#cst�||d���|�|S)Nr!)�verify_interface�register)r$r"�r'rr�register_decorator<s
z.register_interface.<locals>.register_decorator)r&)r'r+rr*r�register_interface;s��r,)�integer�lengthrcCs |�|p|��ddpdd�S)N���Zbig)�to_bytes�
bit_length)r-r.rrr�int_to_bytesFs�r4c@seZdZdS)�InterfaceNotImplementedNrrrrrr5Lsr5cCst�dd�|j��D��S)NcSsg|]}|jtjjd��qS))�
annotation)�replace�inspectZ	Parameter�empty)�.0Zparamrrr�
<listcomp>Rs�z$strip_annotation.<locals>.<listcomp>)r8Z	Signature�
parameters�values)�	signaturerrr�strip_annotationPs
��r?Fr!cCs�|jD]�}t||�s$td�||���tt||�tj�r8qt�	t||��}t�	t||��}|rf||k}nt
|�t
|�k}|std�||||���qdS)Nz{} is missing a {!r} methodzK{}.{}'s signature differs from the expected. Expected: {!r}. Received: {!r})�__abstractmethods__�hasattrr5rrr�abc�abstractpropertyr8r>r?)r'r$r"�methodZsig�actual�okrrrr(Ys$


�
��r(c@seZdZdd�ZdS)�_DeprecatedValuecCs||_||_||_dSr)r
�message�
warning_class)rr
rHrIrrr�__init__psz_DeprecatedValue.__init__N)rrrrJrrrrrGosrGcs<eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Z�ZS)�_ModuleWithDeprecationscst��|j�||jd<dS�N�_module)�superrJr�__dict__)r�module��	__class__rrrJwsz _ModuleWithDeprecations.__init__cCs4t|j|�}t|t�r0tj|j|jdd�|j}|S�N�)�
stacklevel)	rrMrrG�warnings�warnrHrIr
�r�attr�objrrr�__getattr__{s

z#_ModuleWithDeprecations.__getattr__cCst|j||�dSr)�setattrrM)rrYr
rrr�__setattr__�sz#_ModuleWithDeprecations.__setattr__cCs:t|j|�}t|t�r*tj|j|jdd�t|j|�dSrS)	rrMrrGrVrWrHrI�delattrrXrrr�__delattr__�s
z#_ModuleWithDeprecations.__delattr__cCsdgt|j�SrL)�dirrMrrrr�__dir__�sz_ModuleWithDeprecations.__dir__)	rrrrJr[r]r_ra�
__classcell__rrrQrrKvs
rKcCs.tj|}t|t�s"t|�tj|<t|||�Sr)�sys�modulesrrKrG)r
Zmodule_namerHrIrPrrr�
deprecated�s

�
recs(d����t�����fdd�}t|�S)Nz
_cached_{}cs0t|���}|�ur|S�|�}t|�|�|Sr)rr\)�instance�cache�result�Zcached_name�func�sentinelrr�inner�szcached_property.<locals>.inner)r�objectr)rjrlrrir�cached_property�s
rnz8int_from_bytes is deprecated, use int.from_bytes insteadc@seZdZdd�Zdd�ZdS)�EnumcCs d|jj�d|j�d|j�d�S)N�<�.z: �>)rRr�_name_�_value_rrrr�__repr__�sz
Enum.__repr__cCs|jj�d|j��S)Nrq)rRrrsrrrr�__str__�szEnum.__str__N)rrrrurvrrrrro�sro)N)-rB�enumr8rc�types�typingrV�UserWarningrZPersistentlyDeprecated2017ZPersistentlyDeprecated2019ZDeprecatedIn34ZDeprecatedIn35ZDeprecatedIn36�strr
rrr�
TYPE_CHECKINGZtyping_extensionsr�TypeVar�typerr �ABCMetar,�int�Optionalr4�	Exceptionr5r?r(rmrG�
ModuleTyperKrern�
from_bytesrZint_from_bytesrorrrr�<module>sF		�