<s> from . _base import Config <EOL> class DatabaseConfig ( Config ) : <EOL> def read_config ( self , config ) : <EOL> self . event_cache_size = self . parse_size ( <EOL> config . get ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ) <EOL> self . database_config = config . get ( "<STR_LIT>" ) <EOL> if self . database_config is None : <EOL> self . database_config = { <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:args>" : { } , <EOL> } <EOL> name = self . database_config . get ( "<STR_LIT:name>" , None ) <EOL> if name == "<STR_LIT>" : <EOL> pass <EOL> elif name == "<STR_LIT>" : <EOL> self . database_config . setdefault ( "<STR_LIT:args>" , { } ) . update ( { <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : False , <EOL> } ) <EOL> else : <EOL> raise RuntimeError ( "<STR_LIT>" % ( name , ) ) <EOL> self . set_databasepath ( config . get ( "<STR_LIT>" ) ) <EOL> def default_config ( self , ** kwargs ) : <EOL> database_path = self . abspath ( "<STR_LIT>" ) <EOL> return """<STR_LIT>""" % locals ( ) <EOL> def read_arguments ( self , args ) : <EOL> self . set_databasepath ( args . database_path ) <EOL> def set_databasepath ( self , database_path ) : <EOL> if database_path != "<STR_LIT>" : <EOL> database_path = self . abspath ( database_path ) <EOL> if self . database_config . get ( "<STR_LIT:name>" , None ) == "<STR_LIT>" : <EOL> if database_path is not None : <EOL> self . database_config [ "<STR_LIT:args>" ] [ "<STR_LIT>" ] = database_path <EOL> def add_arguments ( self , parser ) : <EOL> db_group = parser . add_argument_group ( "<STR_LIT>" ) <EOL> db_group . add_argument ( <EOL> "<STR_LIT>" , "<STR_LIT>" , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" <EOL> ) </s>
