def _download_and_uncompress_dataset(dataset_dir):
 filename = _DATA_URL.split('/')[(-1)]
 filepath = os.path.join(dataset_dir, filename)
 if (not os.path.exists(filepath)):
  def _progress(count, block_size, total_size):
   sys.stdout.write(('\r>> Downloading %s %.1f%%' % (filename, ((float((count * block_size)) / float(total_size)) * 100.0))))
   sys.stdout.flush()
  (filepath, _) = urllib.request.urlretrieve(_DATA_URL, filepath, _progress)
  print()
  statinfo = os.stat(filepath)
  print('Successfully downloaded', filename, statinfo.st_size, 'bytes.')
  tarfile.open(filepath, 'r:gz').extractall(dataset_dir)

def _download_and_uncompress_dataset ( dataset_dir ) : filename = _DATA_URL . split ( '/' ) [ ( - 1 ) ] filepath = os . path . join ( dataset_dir , filename ) if ( not os . path . exists ( filepath ) ) : def _progress ( count , block_size , total_size ) : sys . stdout . write ( ( '\r>> Downloading %s %.1f%%' % ( filename , ( ( float ( ( count * block_size ) ) / float ( total_size ) ) * 100.0 ) ) ) ) sys . stdout . flush ( ) ( filepath , _ ) = urllib . request . urlretrieve ( _DATA_URL , filepath , _progress ) print ( ) statinfo = os . stat ( filepath ) print ( 'Successfully downloaded' , filename , statinfo . st_size , 'bytes.' ) tarfile . open ( filepath , 'r:gz' ) . extractall ( dataset_dir )
downloads cifar10 and uncompresses it locally .