/usr/local/lib/python3.6/site-packages/itsdangerous/__pycache__
Edit: /usr/local/lib/python3.6/site-packages/itsdangerous/__pycache__/timed.cpython-36.pyc (6192B)
3
_TBg @ s d dl Z d dlZd dlZd dlmZ d dlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm
Z
dd
lmZ ddlm
Z
ddlmZ dd
lmZ ddlmZ ejeef Zeje Zeje Zejrd dlZG dd deZG dd deZdS ) N)datetime)timezone )
base64_decode)
base64_encode)bytes_to_int)int_to_bytes)
want_bytes)BadSignature)BadTimeSignature)SignatureExpired)
Serializer)Signerc s e Zd ZdZedddZeedddZee dd d
Z
ejdee
d
e dddZejdee
deje ef dddZdee
eejeje ef e f d fdd
Zdee
edddZ ZS )TimestampSignerzWorks 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.
)returnc C s t tj S )zTReturns the current timestamp. The function must return an
integer.
)inttime)self r :/tmp/pip-build-0s3hx122/itsdangerous/itsdangerous/timed.py
get_timestamp! s zTimestampSigner.get_timestamp)tsr c C s t j|tjdS )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 r r r r timestamp_to_datetime' s z%TimestampSigner.timestamp_to_datetime)valuer c C s@ t |}tt| j }t | j}|| | }|| | j| S )z:Signs the given string and also attaches time information.)r r r r sepZ
get_signature)r r timestampr r r r sign1 s
zTimestampSigner.signNFz_te.Literal[False])signed_valuemax_agereturn_timestampr c C s d S )Nr )r r r! r" r r r unsign<