def run_supernova(): """ Handles all of the prep work and error checking for the supernova executable. """ config.run_config() parser = argparse.ArgumentParser() parser.add_argument("-x", "--executable", default="nova", help="command to run instead of nova") parser.add_argument("-l", "--list", action=_ListAction, help="list all configured environments") parser.add_argument("-d", "--debug", action="store_true", help="show novaclient debug output") parser.add_argument( "env", help=("environment to run nova against. " "valid options: %s" % sorted(config.nova_creds.sections())) ) # Allow for passing --options all the way through to novaclient supernova_args, nova_args = parser.parse_known_args() # Did we get any arguments to pass on to nova? if not nova_args: utils.warn_missing_nova_args() sys.exit(1) # Is our environment argument a single environment or a supernova group? if utils.is_valid_group(supernova_args.env): envs = utils.get_envs_in_group(supernova_args.env) else: envs = [supernova_args.env] snobj = SuperNova() for env in envs: snobj.nova_env = env snobj.run_novaclient(nova_args, supernova_args)
def create_app(): app = Flask(__name__) app.config.from_object(run_config()) db.init_app(app) Migrate().init_app(app, db) app.permanent_session_lifetime = timedelta( minutes=20) # add session expire time app.register_blueprint(room_b) app.register_blueprint(staff_b) app.register_blueprint(tenants_b) app.register_blueprint(create_db) return app
def create_app(): my_app = Flask(__name__) my_app.config.from_object(run_config()) db.init_app(my_app) Migrate(my_app, db) my_app.register_blueprint(create_db) my_app.register_blueprint(users_bp) my_app.register_blueprint(books_bp) my_app.register_blueprint(library_bp) return my_app
def create_app(): app = Flask(__name__) app.config.from_object(run_config()) db.init_app(app) app.register_blueprint(app_tenant) app.register_blueprint(app_room) app.register_blueprint(app_staff) db.create_all(app=app) return app
def create_app(): app = Flask(__name__) app.config.from_object(run_config()) db.init_app(app) migrate.init_app(app, db) app.permanent_session_lifetime = timedelta(minutes=20) app.register_blueprint(create_db) app.register_blueprint(name_bp) return app
def create_app(): app = Flask(__name__) app.config.from_object(run_config()) db.init_app(app) app.register_blueprint(create_db_bp) app.register_blueprint(tenant_bp) app.register_blueprint(room_bp) app.register_blueprint(staff_bp) return app
def run_app(): app.config.from_object(run_config()) db.init_app(app) app.permanent_session_lifetime = timedelta( minutes=20) # add session expire time app.register_blueprint(auth) app.register_blueprint(create_db) app.register_blueprint(news) app.register_blueprint(one_to_many) app.register_blueprint(many_to_many) return app
def create_app(): app = Flask(__name__, static_folder="static") app.config.from_object(run_config()) db.init_app(app) migrate = Migrate(app, db) app.permanent_session_lifetime = timedelta( minutes=20) # add session expire time UserManager(app, db, User) app.register_blueprint(blueprint, url_prefix='/api') app.register_blueprint(user_bp) app.register_blueprint(game_bp) app.register_blueprint(base_bp) app.register_blueprint(wish_list_bp) return app
def create_app(): app = Flask(__name__) app.register_blueprint(room) app.register_blueprint(tenant) app.register_blueprint(stuff) app.config.from_object(run_config()) @app.errorhandler(404) def page_not_found(e): code = 404 if isinstance(e, HTTPException): code = e.code return jsonify(error=str(e)), code return app
def create_app(env='DEV'): app = Flask(__name__) app.register_blueprint(app_user) app.register_blueprint(app_book) app.register_blueprint(app_library) app.register_blueprint(app_home) app.config.from_object(run_config(env)) db.init_app(app) db.create_all(app=app) @app.errorhandler(404) def page_not_found(error): return render_template('page_not_found.html'), 404 return app
def runSim(input): """ Call Vissim application through com object, load Vissim inpx file and run simulation with input parameters. :type input: dictionary :param input: decoded parameters :return: pandas dataframe """ cfg = config.run_config() path = 'C:\Users\\nli\PycharmProjects\GA sim\hwy_1_corridor(autorun).inpx' run = cfg['run'] period = cfg['period'] def genQuery(input): x = 'TravTm(' + str(input) + ',1,All)' return x Vissim = com.Dispatch('Vissim.Vissim') Vissim.LoadNet(path) db = Vissim.Net.DrivingBehaviors.ItemByKey(3) Vissim.Graphics.CurrentNetworkWindow.SetAttValue("QuickMode",1) Vissim.SuspendUpdateGUI() Vissim.Simulation.SetAttValue('UseMaxSimSpeed', True) Vissim.Simulation.SetAttValue('NumRuns', run) Vissim.Simulation.SetAttValue('SimPeriod', period) db.SetAttValue('W99cc0', input['cc0']) db.SetAttValue('W99cc1Distr', input['cc1']) db.SetAttValue('W99cc4', input['cc4']) db.SetAttValue('W99cc5', input['cc5']) Vissim.Simulation.RunContinuous() # append results from each simulation run to table result = [] for i in range(1, run+1): r = Vissim.Net.VehicleTravelTimeMeasurements.GetMultipleAttributes(('Name', genQuery(i))) result.append(list(r)) df = pd.DataFrame(np.array(result).reshape(run,2), columns=['Route','TravTm']) df['TravTm'] = df['TravTm'].apply(pd.to_numeric) return df
def create_app(): app = Flask(__name__) app.config.from_object(run_config()) db.init_app(app) @app.before_first_request def create_tables(): db.drop_all(app=app) db.create_all(app=app) db.session = db_init_room(db) db.session = db_init_stuff(db) db.session = db_init_tenant(db) db.session = db_init_stuff_to_room(db) db.session.commit() app.register_blueprint(healthcheck) app.register_error_handler(404, page_not_found) app.register_blueprint(room) app.register_blueprint(tenant) app.register_blueprint(stuff) return app
from functools import wraps from flask import Flask, request from errors import errors from config import run_config from flask_restful import Api, Resource, reqparse, fields, marshal_with app = Flask(__name__) api = Api(app, errors=errors) app.config.from_object(run_config()) class HelloRest(Resource): def get(self): return {"key": "value"}, 200, {"custom_header": "value"} def post(self): return "post" a = ["Apple", "Amazon", "Alphabet", "Microsoft"] parser = reqparse.RequestParser(bundle_errors=True) parser.add_argument('page', type=int, help="wrong page expecting int") parser.add_argument('filter', type=int, help="wrong filter type") parser_2 = parser.copy() parser_2.add_argument('new_value') def cache(f): @wraps(f)
from discord.ext import commands import discord from keep_alive import keep_alive import os from config import run_config run_config() bot = commands.Bot(command_prefix="m!", case_insensitive=True, description="Hypnotics Music ModMail Bot") @bot.event async def on_ready(): # When the bot is ready await bot.change_presence(activity=discord.Activity( type=discord.ActivityType.watching, name='your DMs!')) print("READY,", bot.user) @bot.event async def on_command_error(ctx, exception): if int(os.environ.get('DEBUG')): await ctx.send(exception) elif isinstance(exception, commands.errors.MissingRequiredArgument): await ctx.send(exception) extensions = ['cogs.modmail', 'jishaku']
def __init__(self): config.run_config() self.nova_env = None self.env = os.environ.copy()
parser = argparse.ArgumentParser() parser.add_argument( "execution_name", help="Name to identify the train execution - used to name the log files" ) parser.add_argument("-d", "--default", help="Use default options when configuring execution", action='store_true') args = parser.parse_args() #Run pre-train config try: import config print("Running config from config.py") config.run_config() except ImportError: print( "Unable to load config.py - Executing program with no pre-runtime configuration" ) #General imports import os, shutil import math, json from time import time, strftime if __name__ == '__main__': #TODO Determine how to use learning rate multipliers #TODO Determine how to use grouping in convolutional layer #Keras imports