a oe@s ddlmZddlZddlZddlZddlZddlZGdddeZeZ eZ eZ eZ ddddd d Z ddddd d Zd*d dddddZdddddZGdddeZGdddZGdddejZd+ddddddd d!d"Zd#d$d%d&d'ZGd(d)d)ejZdS),) annotationsNc@s eZdZdS)CryptographyDeprecationWarningN__name__ __module__ __qualname__rr3C:\Program Files\Certbot\pkgs\cryptography\utils.pyrsrstrbytesNone)namevaluereturncCst|tst|ddS)Nz must be bytes) isinstancer TypeErrorr rrrr _check_bytess rcCs2z t|Wn ty,t|dYn0dS)Nz must be bytes-like) memoryviewrrrrr _check_byteslike"s  rintztyping.Optional[int])integerlengthrcCs ||p|ddpddS)NZbig)to_bytes bit_length)rrrrr int_to_bytes)srz typing.Anyztyping.Tuple[typing.Any, int])objrcCs.ddlm}|j|}|t|jd|fS)Nr)_opensslZ uintptr_t)Z"cryptography.hazmat.bindings._rustr ZffiZ from_bufferrcast)rr bufrrr _extract_buffer_length/s  r#c@s eZdZdS)InterfaceNotImplementedNrrrrr r$6sr$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<dSN_module)superr+r__dict__)r*r- __class__rr r+Bsz _ModuleWithDeprecations.__init__r r&)attrrcCs4t|j|}t|tr0tj|j|jdd|j}|SN) stacklevel) getattrr/rr%warningswarnr'r)rr*r4rrrr __getattr__Fs   z#_ModuleWithDeprecations.__getattr__r )r4rrcCst|j||dSr()setattrr/)r*r4rrrr __setattr__Msz#_ModuleWithDeprecations.__setattr__cCs:t|j|}t|tr*tj|j|jddt|j|dSr5) r8r/rr%r9r:r'r)delattrr;rrr __delattr__Ps  z#_ModuleWithDeprecations.__delattr__ztyping.Sequence[str]rcCsdgt|jSr.)dirr/r*rrr __dir__Wsz_ModuleWithDeprecations.__dir__) rrrr+r<r>r@rD __classcell__rrr2r r,As r,r&ztyping.Type[Warning]ztyping.Optional[str])r module_namer'r)r rcCsJtj|}t|ts&t|tj|<}t|||}|durFt||||Sr()sysmodulesrr,r%r=)rrFr'r)r r-Zdvrrr deprecated[s    rIztyping.Callableproperty)funcrcs.dtddfdd }t|S)NZ_cached_r&)instancecs0t|}|ur|S|}t|||Sr()r8r=)rLcacheresultZ cached_namerKsentinelrr innerps   zcached_property..inner)r&rJ)rKrQrrOr cached_propertyls rRc@s(eZdZddddZddddZdS)Enumr rAcCs d|jjd|jd|jdS)N<.z: >)r3r_name__value_rCrrr __repr__~sz Enum.__repr__cCs|jjd|jS)NrU)r3rrWrCrrr __str__sz Enum.__str__N)rrrrYrZrrrr rS}srS)N)N)Z __future__renumrGtypestypingr9 UserWarningrZDeprecatedIn36ZDeprecatedIn37ZDeprecatedIn40ZDeprecatedIn41rrrr# Exceptionr$r% ModuleTyper,rIrRrSrrrr s*