def generate_examples_and_gallery(example_dir, rst_dir, cfg):
 if (not example_dir.exists):
  print ('No example directory found at', example_dir)
  return
 rst_dir.makedirs()
 with open(rst_dir.pjoin(('index' + cfg.source_suffix_str)), 'w') as gallery_index:
  write_gallery(gallery_index, example_dir, rst_dir, cfg)
  for d in sorted(example_dir.listdir()):
   example_sub = example_dir.pjoin(d)
   if example_sub.isdir:
    rst_sub = rst_dir.pjoin(d)
    rst_sub.makedirs()
    write_gallery(gallery_index, example_sub, rst_sub, cfg, depth=1)
  gallery_index.flush()

def generate_examples_and_gallery ( example_dir , rst_dir , cfg ) : if ( not example_dir . exists ) : print ( 'No example directory found at' , example_dir ) return rst_dir . makedirs ( ) with open ( rst_dir . pjoin ( ( 'index' + cfg . source_suffix_str ) ) , 'w' ) as gallery_index : write_gallery ( gallery_index , example_dir , rst_dir , cfg ) for d in sorted ( example_dir . listdir ( ) ) : example_sub = example_dir . pjoin ( d ) if example_sub . isdir : rst_sub = rst_dir . pjoin ( d ) rst_sub . makedirs ( ) write_gallery ( gallery_index , example_sub , rst_sub , cfg , depth = 1 ) gallery_index . flush ( )
generate rst from examples and create gallery to showcase examples .