
_P_U«  ã               @   s–   d  Z  d d l Z d d l Z e j d d k Z e rI e f Z e Z n e f Z e	 Z d d „  Z
 y e j Z Wn e k
 r‘ d d „  Z Yn Xd S)z–
The `compat` module provides support for backwards compatibility with older
versions of python, and compatibility wrappers around optional packages.
é    Né   c             C   sL   y |  j  Wn. t k
 r; |  j d d d |  j } Yn X|  j  ƒ  } | S)Né   é<   )Útotal_secondsÚAttributeErrorZdaysZseconds)Zdeltar   © r   ú,/usr/lib/python3/dist-packages/jwt/compat.pyÚtimedelta_total_seconds   s    !r	   c             C   sf   t  |  ƒ t  | ƒ k r d Sd } x7 t |  | ƒ D]& \ } } | t | ƒ t | ƒ AO} q2 W| 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Úyr   r   r   Úconstant_time_compare&   s    r   )Ú__doc__ÚsysZhmacÚversion_infoZPY3ÚstrZstring_typesZ	text_typeZ
basestringZunicoder	   Zcompare_digestr   r   r   r   r   r   Ú<module>   s   			