Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib
/
python3.5
/
site-packages
/
joblib
/
__pycache__
/
File Content:
numpy_pickle_compat.cpython-35.pyc
���W� � @ s d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d � Z e r� d d � Z n e Z e e d � � Z d Z d d � Z d d d � Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z d d � Z d S)z%Numpy pickle compatibility functions.� N)�BytesIO� )�PY3_OR_LATER)� _ZFILE_PREFIX)� Unpicklerc C s d j | � S)z(Convert an int to an hexadecimal string.z{0:#x})�format)Zan_int� r �/numpy_pickle_compat.py�hex_str s r c C s t | t � r | S| j d � S)N�latin1)� isinstance�bytes�encode)�sr r r �asbytes s r � �@ i c C s� | j d � t t � t } | j | � } | t t � d � } t | d � } | j d � } | d k ry | j | � t j | j � d | � } t | � | k s� t d | � � | S)z�Read the z-file and return the content as a string. Z-files are raw data compressed with zlib used internally by joblib for persistence. Backward compatibility is not guaranteed. Do not use for external purposes. r N� r � � zIIncorrect data length while decompressing %s.The file could be corrupted.) �seek�lenr �_MAX_LEN�read�int�zlib� decompress�AssertionError)�file_handleZ header_length�lengthZ next_byte�datar r r � read_zfile s r! c C s^ | j t � t t | � � } | j t | j t � � � | j t j t | � | � � d S)z�Write the data in the given file as a Z-file. Z-files are raw data compressed with zlib used internally by joblib for persistence. Backward compatibility is not guarantied. Do not use for external purposes. N) �writer r r r �ljustr r �compress)r r r$ r r r r �write_zfile>