Did I find the right examples for you? yes no

All Samples(9)  |  Call(3)  |  Derive(0)  |  Import(6)

        def readConfig( cmdargs ):

    parser = OptionParser()
    parser.add_option( '--dry-run', action = 'store_true', dest = 'dry_run', help = 'show commands, do not execute except collection-status' )
    parser.add_option( '--cleanup', action = 'store_true', dest = 'cleanup', help = 'cleanup only, implies --dry-run' )
    parser.add_option( '--remove-older', action = 'store', type = 'int', dest = 'remove_older', default = None, help = 'run remove_old only, with the given value. implies --dry-run (set the value in the config to customize for each run and do other operations)' )
    parser.add_option( '--config', action = 'store', type = 'string', dest = 'configFile', default = 'config.cfg.example', help = 'use this config file' )
    parser.add_option( '--full', action = 'store_true', dest = 'full', help = 'force a full backup. will retry for each backup target if necessary until full backups are done' )
    ( options, args ) = parser.parse_args( cmdargs )
    
    globals = {}
    locals = {}
    try:
        execfile( options.configFile, globals, locals )
    except:
        print 'exception raised while reading config file %s' % options.configFile
        raise
    if ( not locals.has_key( 'DupiConfig' ) ):
        raise 'DupiConfig dictionary was not defined'
    DupiConfig = locals['DupiConfig']
    
    # setup default backup class if needed
    if ( not DupiConfig.has_key( 'backup' ) ):
        from backup import Backup
        DupiConfig['backup'] = Backup( DupiConfig )

    DupiConfig['backup'].commandLineOverrides( options )
    
    return DupiConfig
        


src/r/a/rawesome-HEAD/studies/kitemhe.py   rawesome(Download)
from casadi import pi
 
from config import readConfig
import models
from newton.nmhe import Nmhe
    print "reading config..."
#    conf = readConfig('stingray.ini','configspec.ini')
    conf = readConfig('config.ini','configspec.ini')
 
    print "creating model..."

src/d/u/dupinanny-HEAD/backup.py   dupinanny(Download)
if ( __name__ == '__main__' ):
    import config
    backup = config.readConfig( sys.argv )
    backup['backup'].Run()