← Back
Editing: timed.cpython-311.pyc
� ʉ<b� � �N � 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 ej eef Zej e Zej e Zej rd dlZ G d� de� � Z G d� de� � ZdS )� N)�datetime)�timezone� )� base64_decode)� base64_encode)�bytes_to_int)�int_to_bytes)� want_bytes)�BadSignature)�BadTimeSignature)�SignatureExpired)� Serializer)�Signerc �: � � e Zd ZdZdefd�Zdedefd�Zdede fd�Z ej dd ede dd de fd�� � Zej dd ede dddej e ef fd�� � Z dd ede dedej ej e ef e f f� fd� Zdd ede defd�Z� xZS )�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. �returnc �B � t t j � � � � S )zTReturns the current timestamp. The function must return an integer. )�int�time)�selfs �4/usr/lib/python3/dist-packages/itsdangerous/timed.py� get_timestampzTimestampSigner.get_timestamp! s � � �4�9�;�;���� �tsc �B � t j |t j �� � 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 r s r �timestamp_to_datetimez%TimestampSigner.timestamp_to_datetime'