Files
cms-website/.deps_siteforge_v812/itsdangerous/__pycache__/timed.cpython-312.pyc
T

84 lines
8.5 KiB
Plaintext
Raw Normal View History

Ë
êÅÙj“ãóú—ddlmZddlmZddlZddlZddlmZddlm Z ddl
m Z ddl
m Z ddl
m
Z
dd l
mZdd
l
mZdd lmZdd lmZdd
lmZddlmZddlmZddlmZGd„de«ZGd„dee«Zy)é)Ú annotationsN)Údatetime)Útimezoneé)Ú
base64_decode)Ú
base64_encode)Ú bytes_to_int)Ú int_to_bytes)Ú
want_bytes)Ú BadSignature)ÚBadTimeSignature)ÚSignatureExpired)Ú _TSerialized)Ú
Serializer)ÚSignercó·—eZdZdZd d„Zd
d„Zd d„Zej d d
d„«Z ej d dd„«Z d dˆfd„
Z ddd„Z
ˆxZ S)ÚTimestampSignerzþWorks like the regular :class:`.Signer` but also records the time
of the signing and can be used to expire signatures. The
:meth:`unsign` method can raise :exc:`.SignatureExpired` if the
unsigning failed because the signature is expired.
có<—ttj««S)zTReturns the current timestamp. The function must return an
integer.
)ÚintÚtime)Úselfs úVC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\itsdangerous/timed.pyÚ
get_timestampzTimestampSigner.get_timestamps€ô”4—9‘9“;ÓÐócóL—tj|tj¬«S)a Convert the timestamp from :meth:`get_timestamp` into an
aware :class`datetime.datetime` in UTC.
.. versionchanged:: 2.0
The timestamp is returned as a timezone-aware ``datetime``
in UTC rather than a naive ``datetime`` assumed to be UTC.
)Útz)rÚ
fromtimestamprÚutc)rÚtss rÚtimestamp_to_datetimez%TimestampSigner.timestamp_to_datetime#s€ô×%Ñ% b¬X¯\©\Ô:Ð:rcóÄ—t|«}tt|j«««}t|j«}||z|z}||z|j |«zS)z:Signs the given string and also attaches time information.)r rr
rÚsepÚ
get_signature)rÚvalueÚ timestampr"s rÚsignzTimestampSigner.sign-sZ€ä˜5Ó!ˆÜ!¤,¨t×/AÑ/AÓ/CÓ"DÓEˆ ܘŸ™Ó"ˆØ˜‘ ˜iÑ'ˆØ�s‰{˜T×/Ñ/°Ó6Ñ6Ð6rcó—y©N©©rÚ signed_valueÚmax_ageÚreturn_timestamps rÚunsignzTimestampSigner.unsign8s€ð rcó—yr(r)r*s rr.zTimestampSigner.unsign@s€ð "%rcó
•— t‰|�|«}d}t |j
«}||vr|r|‚t
d|¬«‚|j|d«\}} d}
d} tt| ««}
|�+|
� |j|
«} t
t|«|| ¬«‚|
€
t
d|¬«‚|�b|j!«|
z
}
|
|kDr$t#d|
›d |›d
�||j|
«¬«‚|
d kr!t#d|
›d �||j|
«¬«‚|r||j|
«fS|S#t$r}|}|jxsd}Yd}~�Œ0d}~wwxYw#t$rYŒëwxYw#tttf$r} t
d|¬«| ‚d} ~ wwxYw)
aíWorks like the regular :meth:`.Signer.unsign` but can also
validate the time. See the base docstring of the class for
the general behavior. If ``return_timestamp`` is ``True`` the
timestamp of the signature will be returned as an aware
:class:`datetime.datetime` object in UTC.
.. versionchanged:: 2.0
The timestamp is returned as a timezone-aware ``datetime``
in UTC rather than a naive ``datetime`` assumed to be UTC.
Nrztimestamp missing)ÚpayloadrzMalformed timestamp)r1Ú date_signedzSignature age z > z secondsrz < 0 seconds)Úsuperr.r r1r r"r
Úrsplitr rÚ Exceptionr Ú
ValueErrorÚOSErrorÚ
OverflowErrorÚstrrr)rr+r,r-ÚresultÚ sig_errorÚer"r$Úts_bytesÚts_intÚts_dtÚexcÚageÚ __class__s €rr.zTimestampSigner.unsignHs×ø€ð  &Ü‘W‘^ LÓ1ˆF؈Iô
˜Ÿ™Ó"ˆð �fÑ ÙØ�ä"Ð#6ÀÔGÐ Gà Ÿ-™-¨¨QÓ/‰ˆˆxØ!ˆØ!%ˆð Ü!¤-°Ó"9Ó:ˆFð Ð ØÐ!ðØ ×6Ñ6°vÓ>�Eô#¤3 y£>¸5ÈeÔTÐ Tð ˆ>Ü"Ð#8À%ÔHÐ Hð Ð Ø×$Ñ$Ó&¨Ñ/ˆCà�WŠ}Ü&Ø$ S E¨¨W¨I°XÐ>Ø!Ø $× :Ñ :¸6Ó Bôðð �QŠwÜ&Ø$ S E¨Ð6Ø!Ø $× :Ñ :¸6Ó Bôðñ ؘ$×4Ñ4°VÓ<Ð<Ð <àˆ øôGò &؈IØ—Y‘YÒ% #ŽFûð &ûô.ò Ù ð ûô#¤G¬]Ð;òô+Ø-°uôàðûðúsAƒD#ÁE Á1EÄ# E Ä,EÅE Å EÅEÅFÅ/E=Å=FcóJ— |j||¬«y#t$rYywxYw)zeOnly validates the given signed value. Returns ``True`` if
the signature exists and is valid.)r,TF)r.r )rr+r,s rÚvalidatezTimestampSigner.validate s,€ð Ø �K‰K˜ ¨gˆKÔ 6ØøÜò Ùð ús ‚– "¡")Úreturnr)rrrEr)r$ú str | bytesrEÚbytes)NF)r+rFr,ú
int | Noner-zt.Literal[False]rErG)NT)r+rFr,rHr-zt.Literal[True]rEztuple[bytes, datetime])r+rFr,rHr-ÚboolrEztuple[bytes, datetime] | bytesr()r+rFr,rHrErI) Ú__name__Ú
__module__Ú __qualname__Ú__doc__rr r&ÚtÚoverloadr.rDÚ
__classcell__©rBs@rrrsæø„ñó  ó ;ó7ð‡Z�Zð#Ø-2ð à!ðððð+ð ð
ò óðð‡Z�Zð#Ø,0ð %à!ð%ðð%ð*ð %ð
ò %óð%ð#Ø!&ð Và!ðVððVðð Vð
(õ V÷pðrrcó|‡—eZdZUdZeZded< d dˆfd„
Z d d
d„Z d d d„Z ˆxZ