def get_lookup(args, session=None, recreate=False):
 if (recreate and (not session)):
  raise ValueError('get_lookup() needs an explicit session to regen the index')
 index_dir = args.index_dir
 got_from = 'command line'
 if (index_dir is None):
  (index_dir, got_from) = defaults.get_default_index_dir_with_origin()
 if args.verbose:
  print(('Opened lookup index %(index_dir)s (from %(got_from)s)' % dict(index_dir=index_dir, got_from=got_from)))
 lookup = pokedex.lookup.PokedexLookup(index_dir, session=session)
 if recreate:
  lookup.rebuild_index()
 return lookup

def get_lookup ( args , session = None , recreate = False ) : if ( recreate and ( not session ) ) : raise ValueError ( 'get_lookup() needs an explicit session to regen the index' ) index_dir = args . index_dir got_from = 'command line' if ( index_dir is None ) : ( index_dir , got_from ) = defaults . get_default_index_dir_with_origin ( ) if args . verbose : print ( ( 'Opened lookup index %(index_dir)s (from %(got_from)s)' % dict ( index_dir = index_dir , got_from = got_from ) ) ) lookup = pokedex . lookup . PokedexLookup ( index_dir , session = session ) if recreate : lookup . rebuild_index ( ) return lookup
given a parsed options object .