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ƒrÀd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*   


