def main(): options.parse_command_line() http_server = tornado.httpserver.HTTPServer(Application()) http_server.listen(options.port) print "Development server is running at http://127.0.0.1:%s" % options.port print "Quit the server with control+c" tornado.ioloop.IOLoop.instance().start()
def main(): set_log_setting() options.add_parse_callback(set_log_setting) options.parse_command_line() print_server_info() application = Application() sockets = bind_sockets(options.port) # tornado.process.fork_processes(0) server = HTTPServer(application, xheaders=settings.XHEADERS) server.add_sockets(sockets) IOLoop.current().start()
def main(): tornado.options.options.log_file_prefix = option['log_path'] tornado.options.options.logging = option['log_level'] tornado.options.parse_command_line() app = Application() app.listen(option['port']) try: ioloop.IOLoop.current().start() except KeyboardInterrupt: ioloop.IOLoop.current().stop() print("Program exit!")
def __init__(self): app = Application([QImage("img/accueil.jpg")]) ordre = WindowOrdre() ordre.hide() jeuV = WindowJeuV(app, ordre) jeuV.hide() jeuC = WindowJeuC(app, ordre) jeuC.hide() win = WindowMenu(app, jeuC, jeuV) app.exec_()
def main(): "main function" root = Tk() # set title root.title("Visual Dictionary Tree") app = Application(root) app.mainloop()
def __init__(self, checkpoint_path, model_selector, cuda=False): #cuda = True self.dh = DataHelper() # 数据库读取 self.checkpoint_path = checkpoint_path self.model_selector = model_selector self.cuda = cuda l.info("[I] Model Loading....") self.compute_app = Application(checkpoint_path, cuda=cuda, model_name=model_selector) l.info("[I] Model loaded...")
def main(): tornado.options.parse_command_line() http_server = tornado.httpserver.HTTPServer(Application()) http_server.listen(options.port) logging.info(''' ************ **************** ****************server {} is running******************** ************ **************** '''.format(options._options['port'].default)) tornado.ioloop.IOLoop.instance().start()
def test_not_a_file(self): conf = copy.copy(self.DUMMY_CONF) conf['ffmpeg_path'] = 'nonexistentfile' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf) conf = copy.copy(self.DUMMY_CONF) conf['ffprobe_path'] = 'nonexistentfile' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf)
def __init__(self, model, name, partnername, applicationname): """ Create a Relation object from a juju status output """ # Default Values self.name = name self.application = model.get_application(applicationname) if model.get_application(partnername): self.partner = model.get_application(partnername) else: self.partner = Application(partnername)
def app(request): # Fixture for Selenium Web driver global fixture browser = request.config.getoption("--browser") project = request.config.getoption("--project") fixture = Application(browser, project) def fin(): fixture.destroy() # function for destroy Selenium fixture request.addfinalizer(fin) return fixture
def __init__(self, parent, w=400, h=70): super().__init__(parent, width=w, height=h, borderwidth=2) self.parent = parent self.centerTaskbar(w=w, h=h) self.recorderWindow = None ppt = Application(self, 'Images/presentation.png', 'Images/presentationsel.png') browser = Application(self, 'Images/browser.png', 'Images/browsersel.png') self.recorder = Application(self, 'Images/recorder.png', 'Images/recordersel.png') ppt.grid(row=0, column=0, padx=10) browser.grid(row=0, column=1, padx=10) self.recorder.grid(row=0, column=2, padx=10) ppt.bind('<Button-1>', self.openPowerPoint) self.recorder.bind('<Button-1>', self.openRecorder)
def main(): tornado.options.parse_command_line() application = Application() httpServer = tornado.httpserver.HTTPServer(application) httpServer.listen(options.port, options.host) print("=" * 100) print "* Server: Success!" print "* Host: http://" + options.host + ":%s" % options.port print "* Quit the server with Control-C" print("=" * 100) tornado.ioloop.IOLoop.instance().start()
def run(self, gen: Generator): #print("********************* %s ********************\n" % (gen,)) for ct in self.controllers: ct.setSLA(self.sla) m = Monitoring(self.window) ct.setMonitoring(m) a = Application(self.sla) s = Simulation(self.horizon, a, gen, m, ct) # print(ct) s.run() self.simulations.append(s) ct.reset()
def __read_instance__(self, path_kinderen, path_schools): with open(path_schools, "r") as file: schools_content = json.load(file) with open(path_kinderen, 'r') as file: kinderen_content = json.load(file) self.school_ids_uniek = list(schools_content.keys()) self.student_ids = list(kinderen_content.keys()) # initialize schools for school_id, school_info in schools_content.items(): preferences = school_info.get("applicaties") preferences = [(kind_id, preferences.get(kind_id).get('toeval')) for kind_id in preferences.keys()] preferences.sort(key=lambda x: x[1]) preferences = [i[0] for i in preferences ] # drop toeval, enkel rangorde in lijst telt nu school = School(unique_id=school_info.get("school_id_uniek"), school_id=school_info.get("school_id"), ind_capacity=school_info.get('INDCapaciteit'), n_ind_capacity=school_info.get('nINDCapaciteit'), preferences=preferences) self.schools.update({school_id: school}) # initialize alle kinderen for kind_id, kind_info in kinderen_content.items(): preferences = kind_info.get('applicaties') preferences = [(school_id, preferences.get(school_id).get('voorkeur')) for school_id in preferences.keys()] preferences.sort(key=lambda x: x[1]) preferences = [i[0] for i in preferences] applicaties = [ Application(periode=item.get("periode"), student_id=kind_id, school_id=key, voorkeur_student=item.get("voorkeur"), toeval=item.get('toeval')) for key, item in kind_info.get('applicaties').items() ] kind = Student(id=kind_id, school_preferences=preferences, indicator_status=kind_info.get("indicator_status"), applicaties=applicaties) self.kinderen.update({kind_id: kind})
def setUp(self): self.env = simpy.Environment() env = self.env contrs = [ Container(env, str(cid), rnd.uniform(0, 10), rnd.uniform(1024, 10240), rnd.uniform(1024, 10240), rnd.uniform(0, 10), rnd.uniform(0, 100)) for cid in range(10) ] for c in contrs: c.add_dependencies(*[str(i) for i in range(int(c.id))]) self.app = Application(env, 'test', contrs)
def MK_AP(next, val): func = lookup(get_app().func.consts[val]) if isinstance(func, tuple): func = func[1] if len(stack) < func.arity: raise SystemError, "MK_AP tried to pop %i arguments from a stack with %i elements for function %s. Stack contents = %s" % ( func.arity, len(stack), str(func), str(stack)) args = [stack.pop() for x in range(func.arity)] stack.push(Application(func, args)) return next
def main(): parser = argparse.ArgumentParser(description=""" Matchmaking application for speed friending events """) parser.add_argument('-i', '--input', help='Input plugin and parameters e.g. csv:somefile.csv', required=True) parser.add_argument('-o', '--output', help='Output plugins and parameters e.g. todo:mytodo.txt', required=True) args = parser.parse_args() app = Application(args.input, args.output) app.process() sys.exit(0)
def connect(port): """start server with assigned port. Note that Application is inherited from Tornado! # Arguments: port: a int number passed from argparse # Returns: None: """ application = Application() application.listen(port) tornado.ioloop.IOLoop.instance().start()
def main(): #--------------------------------------------------------------------------- import sys, argparse #application local from gui import GUI from application import Application #--------------------------------------------------------------------------- #parse command line arguments parser = argparse.ArgumentParser() parser.add_argument( "--skip-test", default=False, action='store_true', help="skip over device tests", ) parser.add_argument( "--no-detach", dest="detach", default=True, action='store_false', help="remain bound to terminal session", ) parser.add_argument("--ignore-device-errors", dest="ignore_device_errors", default=False, action='store_true', help="ignore initial device errors") args = parser.parse_args() #initialize the control application app = Application( skip_test=args.skip_test, ignore_device_errors=args.ignore_device_errors, ) #parse and loads the configuration objects app.load(config_filepath=OLMpstat.pkg_info.platform['config_filepath']) #initialize the controllers app.initialize() if args.detach: #detach the process from its controlling terminal from automat.system_tools.daemonize import detach app.print_comment("Process Detached.") app.print_comment("You may now close the terminal window...") detach() #start the graphical interface gui = GUI(app) #give the app the ability to print to the GUI's textbox app.setup_textbox_printer(gui.print_to_text_display) #launch the GUI gui.load() gui.launch()
def main(): app = Application() renderer = Renderer() renderer.register_with_app(app) app.request_update_on_draw(Test(renderer).update) r = Renderer.Rectangle(1, 2, 20, 30, renderer=renderer) try: r = Renderer.Rectangle(40, 40, 20, 30) except: pass app.run()
def app(browser_init, request): """Instantiation of all pages, making screenshot""" selenium_test_base = Application(browser_init) def teardown(): if request.node.rep_call.failed: allure.attach(browser_init.driver.get_screenshot_as_png(), name="Screenshot", attachment_type=AttachmentType.PNG) browser_init.driver.quit() request.addfinalizer(teardown) return selenium_test_base
def skencil_run(): """Skencil application launch routine.""" global config _pkgdir = __path__[0] config = get_app_config(_pkgdir) __path__.insert(0, os.path.join(_pkgdir, 'modules')) from application import Application app = Application(_pkgdir) app.run()
def html_to_application(html): heading = html.find('a') metainfo = html.find('p', class_='metaInfo').get_text() ref = re.search(r'Ref\.\sNo:\s*([\d\w/]*)', metainfo).group(1) received = re.search(r'Received:\s*([\d\w]+(\s[\d\w]+)*)', metainfo).group(1) validated = re.search(r'Validated:\s*([\d\w]+(\s[\d\w]+)*)', metainfo).group(1) status = re.search(r'Status:\s*(\w+)', metainfo).group(1) return Application(heading.string.strip(), heading.get('href'), html.find('p', class_='address').string.strip(), ref, df.format_from_site(received), df.format_from_site(validated), status)
def __ODM_Added(self, evt): gevent.sleep(2) rhtype = string.lower("{0}".format(evt.sourceCategory)) if ('device_manager' == rhtype): for dm in self._obj.devMgrs: if (dm._get_identifier() == evt.sourceId): self._children.append( Device_Manager(dm, self, self._outbox)) elif ('application' == rhtype): for wave in self._obj.apps: if (wave._get_identifier() == evt.sourceId): self._children.append(Application(wave, self, self._outbox))
def main(log): try: from application import Application app = Application(is_raspi=is_raspi(), debug=False) rtn_msg = app.run() if rtn_msg: log.debug(f'Quitting: app returned {rtn_msg}') return True except KeyboardInterrupt: log.debug('Quitting: KeyboardInterrupt') return True except BaseException as e: log.exception(f'app crashed: {e}')
def setup_from_cmd(): """ Gets arguments from command line :return: application: implementation of algorithm """ # live demo if len(sys.argv) == 1: application = Application() # TO CHECK print "Using web-cam, device ", constants.OPENED_VIDEO_DEVICE, "needs to be connected" # video demo elif len(sys.argv) == 2: if path.isfile(sys.argv[1]): application = Application(sys.argv[1]) print "Given video", sys.argv[1] else: print "File not exist" sys.exit(0) else: print "Too Many Arguments" sys.exit(0) return application
def application_start(self): try: app = Application() httpServer = tornado.httpserver.HTTPServer(app) port = config.options["port"] httpServer.bind(port) self.logger.info("服务IP地址为{}".format(self.hostIp)) self.logger.info("服务绑定端口为{}".format(port)) httpServer.start(1) self.logger.info("服务启动成功……") tornado.ioloop.IOLoop.current().start() except Exception as e: self.logger.exception(e)
def __init__(self, parent=None): """construction method """ super(ControllerMainApps, self).__init__(parent=parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.plugins = Application("plugins") self.ui.comboBox.addItems(self.plugins.name_application) self.ui.Open_btn.clicked.connect(self.open_application) self.ui.Delete_btn.clicked.connect(self.delete_apps) self.ui.install_mor_application.clicked.connect( self.add_application_plugin) self.ui.btn_Exit.clicked.connect(self.exit) self.ui.pushButton.clicked.connect(self.open_help)
def _get_app_node(self, network_node, app): assert self._lock.locked() name = "a%s" % app if network_node.has_child(name): return network_node.get_child(name) # Obviously an app factory based on app id, someday... application_node = Application() application_node.configure({ "parent": network_node, "name": name, "app": app }) application_node.start() return application_node
def __init__(self, base=None): ''' Class constructor. ''' # Disable this for now, it doesn't work. self.use_native_malloc = False self.allocated_addresses = {} self.app = Application() self.cpu = Architecture() if base is not None: self.MP = self.BASE_MP = base else: self.MP = self.BASE_MP = idc.BADADDR