parameters: (file_handle)
return_statement: return data
docstring: 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.
docstring_summary: Read the z-file and return the content as a string
docstring_tokens: Read the z - file and return the content as a string
function: def read_zfile(file_handle):
      """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.
      """
      file_handle.seek(0)
      assert _read_magic(file_handle) == _ZFILE_PREFIX, \
          "File does not have the right magic"
      header_length = len(_ZFILE_PREFIX) + _MAX_LEN
      length = file_handle.read(header_length)
      length = length[len(_ZFILE_PREFIX):]
      length = int(length, 16)
  
      # With python2 and joblib version <= 0.8.4 compressed pickle header is one
      # character wider so we need to ignore an additional space if present.
      # Note: the first byte of the zlib data is guaranteed not to be a
      # space according to
      # https://tools.ietf.org/html/rfc6713#section-2.1
      next_byte = file_handle.read(1)
      if next_byte != b' ':
          # The zlib compressed data has started and we need to go back
          # one byte
          file_handle.seek(header_length)
  
      # We use the known length of the data to tell Zlib the size of the
      # buffer to allocate.
      data = zlib.decompress(file_handle.read(), 15, length)
      assert len(data) == length, (
          "Incorrect data length while decompressing %s."
          "The file could be corrupted." % file_handle)
      return data
function_tokens: def read_zfile ( file_handle ) : file_handle . seek ( 0 ) assert _read_magic ( file_handle ) == _ZFILE_PREFIX , "File does not have the right magic" header_length = len ( _ZFILE_PREFIX ) + _MAX_LEN length = file_handle . read ( header_length ) length = length [ len ( _ZFILE_PREFIX ) : ] length = int ( length , 16 ) # With python2 and joblib version <= 0.8.4 compressed pickle header is one # character wider so we need to ignore an additional space if present. # Note: the first byte of the zlib data is guaranteed not to be a # space according to # https://tools.ietf.org/html/rfc6713#section-2.1 next_byte = file_handle . read ( 1 ) if next_byte != b' ' : # The zlib compressed data has started and we need to go back # one byte file_handle . seek ( header_length ) # We use the known length of the data to tell Zlib the size of the # buffer to allocate. data = zlib . decompress ( file_handle . read ( ) , 15 , length ) assert len ( data ) == length , ( "Incorrect data length while decompressing %s." "The file could be corrupted." % file_handle ) return data