U
    b[X                     @   s   d Z ddlZddlZddlZejd dkZer8eZeZ	ne
ZeZ	ee	fZzddlmZmZ W n$ ek
r   ddlmZmZ Y nX z
ejZW n ek
r   dd ZY nX eeddrdd	 Znd
d	 ZdS )z
The `compat` module provides support for backwards compatibility with older
versions of python, and compatibility wrappers around optional packages.
    N   )IterableMappingc                 C   sH   t | t |krdS d}t| |D ]\}}|t|t|A O }q"|dkS )z
        Returns True if the two strings are equal, False otherwise.

        The time taken is independent of the number of characters that match.
        Fr   )lenzipord)Zval1Zval2resultxy r   ,/usr/lib/python3/dist-packages/jwt/compat.pyconstant_time_compare!   s    r   to_bytesc                 C   s2   | }d}|dkr"|d? }|d7 }q| j |dddS )Nr         ZbigF)Zsigned)r   )valZ	remainingZbyte_lengthr   r   r   bytes_from_int3   s    
r   c                 C   sB   g }| r"t | d\} }|| q|  tjdt| f| S )N   z%sB)divmodappendreversestructZpackr   )r   ZbufZ	remainderr   r   r   r   =   s    )__doc__Zhmacr   sysversion_infoZPY3strZ	text_typebytesZbinary_typeZunicodeZstring_typesZcollections.abcr   r   ImportErrorcollectionsZcompare_digestr   AttributeErrorgetattrintr   r   r   r   r   <module>   s*   


