def initialize_database(args, default_dir):
'''Performs the necessary checks and initialization procedures to initialize the database
Returns the database to be used.
'''
if args.database is None:
args.database = default_dir
ret_db = Database(args.database)
if args.reset:
ret_db.reset()
if ret_db.properties['highest_population'] == 0:
if args.size is None:
print('ERROR: Population size must be specified when starting a new run.')
sys.exit()
ret_db.set_property('population_size', args.size)
else:
ret_db.select()
return ret_db
评论列表
文章目录