#NEWLINE# def _allocate_data( data , data_buffer , data_shape , dtype ) : #NEWLINE# #INDENT# 'Helper to data in memory or in memmap for preloading' #NEWLINE# if ( data is None ) : #NEWLINE# #INDENT# if isinstance ( data_buffer , string_types ) : #NEWLINE# #INDENT# data = np . memmap ( data_buffer , mode = 'w+' , dtype = dtype , shape = data_shape ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data = np . zeros ( data_shape , dtype = dtype ) #NEWLINE# #UNINDENT# #UNINDENT# return data