#NEWLINE# def __init__( self , filename , subfile = '' , mode = 'r' , chunksize = 131072 , autoflush = True ) : #NEWLINE# #INDENT# 'Create a ChunkedFile object with given filename, I/O mode (r,w,a),\n        and preferred chunk size. If you wish to manually control the chunk\n        boundaries using bookmark() or flush(), set autoflush=False.' #NEWLINE# if ( autoflush not in 'rwa' ) : #NEWLINE# #INDENT# raise ValueError ( 'Mode must be r or w or a' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . zip = ZipFile ( filename , mode , ZIP_DEFLATED ) #NEWLINE# self . _is_gzip = False #NEWLINE# #UNINDENT# except BadZipfile : #NEWLINE# #INDENT# assert ( mode == 'r' ) #NEWLINE# self . zip = GzipFile ( filename , mode ) #NEWLINE# self . _is_gzip = True #NEWLINE# #UNINDENT# self . prefix = ( ( '%s/c.' % str ( subfile ) ) if subfile else 'c.' ) #NEWLINE# self . mode = mode #NEWLINE# self . chunksize = chunksize #NEWLINE# self . autoflush = autoflush #NEWLINE# if ( not self . _is_gzip ) : #NEWLINE# #INDENT# self . chunks = self . _chunks ( ) #NEWLINE# #UNINDENT# if ( mode == 'r' ) : #NEWLINE# #INDENT# self . eof = False #NEWLINE# self . chunkidx = ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . eof = True #NEWLINE# self . chunkidx = ( len ( self . chunks ) - 1 ) #NEWLINE# #UNINDENT# if ( self . chunkidx >= 0 ) : #NEWLINE# #INDENT# info = self . zip . getinfo ( self . chunks [ self . chunkidx ] . name ) #NEWLINE# self . pos = ( self . chunks [ self . chunkidx ] . pos + info . file_size ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . pos = 0 #NEWLINE# #UNINDENT# self . nextbuf = [ ] #NEWLINE# self . readbuf = '' #NEWLINE# self . writebuf = '' #NEWLINE# self . _last_bookmark = None