U :e@sddlmZddlZddlZddlZddlZddlZGdddeZeZ eZ eZ eZ eZ ddddd d Zddddd d Zd*d dddddZdddddZGdddeZGdddZGdddejZd+ddddddd d!d"Zd#d$d%d&d'ZGd(d)d)ejZdS),) annotationsNc@s eZdZdS)CryptographyDeprecationWarningN__name__ __module__ __qualname__rrE/usr/local/python38/lib/python3.8/site-packages/cryptography/utils.pyrsrstrbytesNone)namevaluereturncCst|tst|ddS)Nz must be bytes) isinstancer TypeErrorr rrrr _check_bytess rcCs4z t|Wn"tk r.t|dYnXdS)Nz must be bytes-like) memoryviewrrrrr _check_byteslike#s rintz int | None)integerlengthrcCs ||p|ddpddS)Nbig)to_bytes bit_length)rrrrr int_to_bytes*srz typing.Anyztuple[typing.Any, int])objrcCs.ddlm}|j|}|t|jd|fS)Nr)_opensslZ uintptr_t)Z"cryptography.hazmat.bindings._rustr!ffiZ from_bufferrcast)r r!bufrrr _extract_buffer_length0s  r%c@s eZdZdS)InterfaceNotImplementedNrrrrr r&7sr&c@seZdZdddddZdS)_DeprecatedValueobjectr )rmessagecCs||_||_||_dSN)rr) warning_class)selfrr)r+rrr __init__<sz_DeprecatedValue.__init__N)rrrr-rrrr r';sr'csbeZdZddfdd Zddddd Zddd d d d Zdd dddZddddZZS)_ModuleWithDeprecationsztypes.ModuleType)modulecst|j||jd<dS)N_module)superr-r__dict__)r,r/ __class__rr r-Csz _ModuleWithDeprecations.__init__r r()attrrcCs4t|j|}t|tr0tj|j|jdd|j}|SN) stacklevel) getattrr0rr'warningswarnr)r+rr,r5r rrr __getattr__Gs   z#_ModuleWithDeprecations.__getattr__r )r5rrcCst|j||dSr*)setattrr0)r,r5rrrr __setattr__Nsz#_ModuleWithDeprecations.__setattr__cCs:t|j|}t|tr*tj|j|jddt|j|dSr6) r9r0rr'r:r;r)r+delattrr<rrr __delattr__Qs  z#_ModuleWithDeprecations.__delattr__ztyping.Sequence[str]rcCsdt|jS)Nr0)r0)dirr0r,rrr __dir__Xsz_ModuleWithDeprecations.__dir__) rrrr-r=r?rArE __classcell__rrr3r r.Bs r.r(z type[Warning]z str | None)r module_namer)r+r rcCsJtj|}t|ts&t|tj|<}t|||}|dk rFt||||Sr*)sysmodulesrr.r'r>)rrGr)r+r r/Zdvrrr deprecated\s    rJztyping.Callableproperty)funcrcs.dtddfdd }t|S)NZ_cached_r()instancecs0t|}|k r|S|}t|||Sr*)r9r>)rMcacheresultZ cached_namerLsentinelrr innerqs   zcached_property..inner)r(rK)rLrRrrPr cached_propertyms rSc@s(eZdZddddZddddZdS)Enumr rBcCs d|jjd|jd|jdS)N<.z: >)r4r_name__value_rDrrr __repr__sz Enum.__repr__cCs|jjd|jS)NrV)r4rrXrDrrr __str__sz Enum.__str__N)rrrrZr[rrrr rT~srT)N)N) __future__renumrHtypestypingr: UserWarningrZDeprecatedIn36ZDeprecatedIn37ZDeprecatedIn40ZDeprecatedIn41ZDeprecatedIn42rrrr% Exceptionr&r' ModuleTyper.rJrSrTrrrr s,