Format: application/x-python-code
⬇ Download File (2.8 KB)
   1  o
   2  
   3  .'h�	�@s�ddlmZddlZddlZddlmZddlmZddlm	Z	ddl
   4  mZddlm
   5  Z
   6  dd	lmZdd
   7  lmZGdd�dee�ZGd
   8  d�deee�ZGdd�deee�ZdS)�)�annotationsN�)�_CompactJSON)�
   9  base64_decode)�
  10  base64_encode)�
  11  BadPayload)�_PDataSerializer)�
  12  Serializer)�TimedSerializercsDeZdZUdZeZded<dd�d�fdd�Zd�fdd�Z�Z	S)�URLSafeSerializerMixinz�Mixed in with a regular serializer it will attempt to zlib
  13      compress the string to make it shorter if necessary. It will also
  14      base64 encode the string so that it can safely be placed in a URL.
  15      z_PDataSerializer[str]�default_serializerN)�
  16  serializer�payload�bytes�args�t.Anyr
  17  �t.Any | None�kwargs�returnc
  18  s�d}|�d�r|dd�}d}zt|�}Wnty(}ztd|d�|�d}~ww|rFzt�|�}WntyE}ztd|d�|�d}~wwt�j|g|�Ri|��S)NF�.rTz;Could not base64 decode the payload because of an exception)�original_errorzACould not zlib decompress the payload before decoding the payload)�
  19  startswithr�	Exceptionr�zlib�
  20  decompress�super�load_payload)�selfrr
  21  rrr�json�e��	__class__��KC:\Users\shubh\Videos\agent\nova\Lib\site-packages\itsdangerous/url_safe.pyrs8
  22  ��������z#URLSafeSerializerMixin.load_payload�objcsNt��|�}d}t�|�}t|�t|�dkr|}d}t|�}|r%d|}|S)NFrTr)r�dump_payloadr�compress�lenr)rr$rZ
  23  is_compressed�
  24  compressedZbase64dr r"r#r%7s
  25  z#URLSafeSerializerMixin.dump_payload)
  26  rrrrr
  27  rrrrr)r$rrr)
  28  �__name__�
  29  __module__�__qualname__�__doc__rr�__annotations__rr%�
  30  __classcell__r"r"r r#rs
  31  � rc@�eZdZdZdS)�URLSafeSerializerz�Works like :class:`.Serializer` but dumps and loads into a URL
  32      safe string consisting of the upper and lowercase character of the
  33      alphabet as well as ``'_'``, ``'-'`` and ``'.'``.
  34      N�r)r*r+r,r"r"r"r#r0H�r0c@r/)�URLSafeTimedSerializerz�Works like :class:`.TimedSerializer` but dumps and loads into a
  35      URL safe string consisting of the upper and lowercase character of
  36      the alphabet as well as ``'_'``, ``'-'`` and ``'.'``.
  37      Nr1r"r"r"r#r3Or2r3)�
  38  __future__r�typing�tr�_jsonr�encodingrr�excrr
  39  rr	Ztimedr
  40  �strrr0r3r"r"r"r#�<module>s9