ó
¦–Õ\c           @` s<  d  d l  m Z m Z m Z d  d l Z d  d l Z d d l m Z g  Z y d  d l	 Z	 Wn e
 k
 rm n) Xe	 j d k r– d „  Z e j e ƒ n  y d  d l Z Wn e
 k
 r¹ n Xd „  Z e j e ƒ y d  d l Z Wn e
 k
 ró n Xd „  Z e j e ƒ d	 „  Z e j e ƒ d d
 „ Z d d „ Z d S(   i    (   t   absolute_importt   divisiont   print_functionNi   (   t   PY2s   0.2.2c         C` s:   t  j |  ƒ } t s% | j d d ƒ St j d | ƒ Sd S(   sJ   
            Produce a 16-bytes hash of *buf* using CityHash.
            i   t   littles   %032xN(   t   cityhasht   CityHash128R   t   to_bytest   binasciit   a2b_hex(   t   buft   h(    (    s+   lib/python2.7/site-packages/dask/hashing.pyt   _hash_cityhash   s    c         C` s   t  j |  ƒ j ƒ  S(   s?   
        Produce a 8-bytes hash of *buf* using xxHash.
        (   t   xxhasht   xxh64t   digest(   R
   (    (    s+   lib/python2.7/site-packages/dask/hashing.pyt   _hash_xxhash,   s    c         C` s   t  j |  ƒ S(   sD   
        Produce a 16-bytes hash of *buf* using MurmurHash.
        (   t   mmh3t
   hash_bytes(   R
   (    (    s+   lib/python2.7/site-packages/dask/hashing.pyt   _hash_murmurhash9   s    c         C` s   t  j |  ƒ j ƒ  S(   s6   
    Produce a 20-bytes hash of *buf* using SHA1.
    (   t   hashlibt   sha1R   (   R
   (    (    s+   lib/python2.7/site-packages/dask/hashing.pyt
   _hash_sha1B   s    c         C` s   | d k	 r7 y | |  ƒ SWq7 t t f k
 r3 q7 Xn  x6 t D]. } y | |  ƒ SWq> t t f k
 rk q> Xq> Wt d t |  ƒ f ƒ ‚ d S(   sç   
    Hash a bytes-like (buffer-compatible) object.  This function returns
    a good quality hash but is not cryptographically secure.  The fastest
    available algorithm is selected.  A fixed-length bytes object is returned.
    s    unsupported type for hashing: %sN(   t   Nonet	   TypeErrort   OverflowErrort   hasherst   type(   R
   t   hasher(    (    s+   lib/python2.7/site-packages/dask/hashing.pyt   hash_bufferL   s    c         C` s2   t  |  | ƒ } t j | ƒ } t s. | j ƒ  S| S(   sJ   
    Same as hash_buffer, but returns its result in hex-encoded form.
    (   R   R   t   b2a_hexR   t   decode(   R
   R   R   t   s(    (    s+   lib/python2.7/site-packages/dask/hashing.pyt   hash_buffer_hexa   s    (   t
   __future__R    R   R   R   R   t   compatibilityR   R   R   t   ImportErrort   __version__R   t   appendR   R   R   R   R   R   R   R!   (    (    (    s+   lib/python2.7/site-packages/dask/hashing.pyt   <module>   s6   		
			