U
    ù¹cX  ã                   @   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   ú./tmp/pip-unpacked-wheel-eh6jf6x0/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   é   é   ÚbigF)Úsigned)r   )ÚvalÚ	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ÚstructÚpackr   )r   ÚbufÚ	remainderr   r   r   r   =   s    )Ú__doc__Úhmacr   ÚsysÚversion_infoÚPY3ÚstrÚ	text_typeÚbytesÚbinary_typeÚunicodeÚstring_typesÚcollections.abcr   r   ÚImportErrorÚcollectionsÚcompare_digestr   ÚAttributeErrorÚgetattrÚintr   r   r   r   r   Ú<module>   s*   


