ó
¦–Õ\c           @` s3  d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l m Z d d l m	 Z	 m
 Z
 m Z m Z d d l m Z d „  Z i e	 d 6e j d	 6e j d
 6e d 6Z i e
 d 6e j d	 6e j d
 6e d 6Z i d „  d 6e d 6Z i e d 6Z e e ƒ + d  d l Z e j e d <e j e d <Wd QXy0 d  d l Z e j j e d <e j j e d <WnO e k
 r­y* d  d l Z e j e d <e j e d <Wq®e k
 r©q®Xn Xe e ƒ ? d d l m Z m Z m Z e e d <e e d <e e d <Wd QXe sd  d l Z e j e d
 <n  d „  Z  d „  Z! d S(   i    (   t   print_functiont   divisiont   absolute_importN(   t   identityi   (   t   gzip_compresst   gzip_decompresst   GzipFilet   PY2(   t   ignoringc         K` s   |  S(   N(    (   t   filet   kwargs(    (    s5   lib/python2.7/site-packages/dask/bytes/compression.pyt	   noop_file   s    t   gzipt   zlibt   bz2c         K` s   t  d |  |  S(   Nt   fileobj(   R   (   t   fR
   (    (    s5   lib/python2.7/site-packages/dask/bytes/compression.pyt   <lambda>   t    t   snappyt   lz4(   t   LZMAFilet   lzma_compresst   lzma_decompresst   xzc         C` sY  d d l  m } m } m } m } |  j d d ƒ d „  } |  j ƒ  d | k  r` | d ƒ ‚ n  |  j d d ƒ d } x3 | |  d ƒ d	 k r« |  j d d ƒ | d 7} qy W|  j | d d ƒ | | |  | ƒ ƒ } |  j | j d ƒ | | |  | j ƒ | ƒ } i g  | D] \ }	 }
 |
 j ^ qd
 6g  | D] \ }	 }
 |
 j	 ^ q2d 6| j
 d 6S(   Ni    (   t   STREAM_HEADER_SIZEt   decode_stream_footert   decode_indext	   LZMAErrori   c         S` s$   |  j  | ƒ } |  j | d ƒ | S(   Ni   (   t   readt   seek(   R   t   sizet   data(    (    s5   lib/python2.7/site-packages/dask/bytes/compression.pyt   _peekI   s    s   file too smalliüÿÿÿi   i   s       t   offsetst   lengthst   check(   t   lzmaffiR   R   R   R   R   t   tellt   backward_sizet   compressed_file_offsett   unpadded_sizeR$   (   t   fpR   R   R   R   R!   t   paddingt   stream_flagst   indext   it   b(    (    s5   lib/python2.7/site-packages/dask/bytes/compression.pyt   get_xz_blocksD   s"    "	&#c      	   C` st   d d l  m } m } m } | |  d  ƒ } |  |  } | d | d | d t |  ƒ d | ƒ } | j |  t | ƒ ƒ S(   Ni    (   t   decode_block_header_sizet   LZMADecompressort   FORMAT_BLOCKi   t   formatt   headerR)   R$   (   R%   R1   R2   R3   t   lent
   decompress(   R    R$   R1   R2   R3   t   hsizeR5   t   dc(    (    s5   lib/python2.7/site-packages/dask/bytes/compression.pyt   xz_decompressc   s    
("   t
   __future__R    R   R   R   R   t   toolzR   t   compatibilityR   R   R   R   t   utilsR   R   t   compresst   NoneR7   t   filest   seekable_filest   ImportErrorR   t	   lz4.blockR   t   blockt   LZ4_compresst   LZ4_uncompressR   R   R   t   BZ2FileR0   R:   (    (    (    s5   lib/python2.7/site-packages/dask/bytes/compression.pyt   <module>   sT   "	










	