Ejemplo n.º 1
0
    def test_skip_dns_update(self):
        class WWWUpdatingDNSManager(MockDNSManager):
            def get_current_ip(self, subdomain):
                if subdomain.name == 'www':
                    return '9.8.7.6'
                else:
                    return '1.2.3.4'

        self.dns = WWWUpdatingDNSManager()
        self.ssl.do_update = False

        app.main()

        for message_type, message in self.notifications.events:
            if message_type == 'Message':
                self.assertIn('Application starting', message)
                self.assertIn('version: unknown', message)
                self.assertIn('built: 1970-01-01 00:00:00', message)
                break

        else:
            self.fail('Startup message not found')

        self.assertIn(('DNS', 'www', 'OK'), self.notifications.events)
        self.assertNotIn(('DNS', 'test', 'OK'), self.notifications.events)
        self.assertEqual(len(self.notifications.events), 2)
Ejemplo n.º 2
0
def main():
    os.chdir("../CSV")
    # converte de CSV para JSON
    #XML2Json.main()
    #NormalizaEntradas.main()
    #NormalizaSaidas.main()
    #Rede.train('radiacao+3')
    '''Rede.train('radiacao+3')
    Rede.train('radiacao+4')
    Rede.train('radiacao+5')
    Rede.train('radiacao+6')'''
    #Rede.train('t+6')
    #Rede.train('t+1')
    #Rede.train('t_Proximas6Horas')
    '''vars = ['t', 'chuva', 'radiacao']
    for i in range(1, 7):
        for var in vars:
            Rede.train(var + '+' + str(i))'''
    #for i in range(1, 7):
    #    Rede.train('radiacao+%d' % i)
    #for i in range(1, 7):
    #    Verificacao.verificar('chuva+%d' % i)
    #Verificacao.verificar('t_Proximas6Horas')
    #Verificacao.verificar('t+6')
    #for i in range(1, 7):
        #Verificacao.verificar('radiacao+%d' % i)

    #Verificacao.verificar('radiacao+3')
    app.main()
    def main(self):
        curses.resize_term(49, 165)
        self.window.clear()
        self.window.refresh()

        # draw the logo, set it to yellow colour
        curses.init_pair(1, curses.COLOR_YELLOW, 0)
        self.window.attron(curses.color_pair(1))
        with open("./assets/ASCII_Art/leaderboard.txt", "r") as logo:
            text = logo.readlines()
            for row in range(1, len(text) + 1):
                self.window.addstr(row, 43, text[row - 1])
        self.window.refresh()
        self.window.attroff(curses.color_pair(1))

        six_seven = curses.newwin(40, 70, 7, 13)
        six_nine = curses.newwin(40, 70, 7, 84)
        score_board.ScoreBoard(six_seven, 59, 34,
                               '6:7').draw_score_board('6:7')
        score_board.ScoreBoard(six_nine, 59, 34, '6:9').draw_score_board('6:9')

        self.window.addstr(42, 64, "Press Enter to return to menu")
        self.window.refresh()

        key = self.window.getch()
        if key == curses.KEY_ENTER or key in [10, 13]:
            import winsound
            winsound.PlaySound('./assets/music/clicking.wav',
                               winsound.SND_FILENAME)
            import app
            app.main(self.window)
Ejemplo n.º 4
0
Archivo: GUI.py Proyecto: andrzejwl/io
def button_start():
    k = 1
    x = root.filename
    top = Toplevel()
    make_sure_path_exists(os.path.abspath(os.path.dirname(__file__)) + "\\PV")
    while True:
        if e.get() != "":
            shutil.copy(x,
                        os.path.abspath(os.path.dirname(__file__)) + "\\PV\\" +
                        e.get() +
                        ".mp4")  #copies the selected file (as we wish)
            app.main(
                input_file_path=(os.path.abspath(os.path.dirname(__file__)) +
                                 "\\PV\\" + e.get() + ".mp4"))
            break
        elif not os.path.isfile(
                os.path.abspath(os.path.dirname(__file__)) + "\\PV\\" +
                str(k) + ".mp4"):
            shutil.copy(
                x,
                os.path.abspath(os.path.dirname(__file__)) + "\\PV\\" +
                str(k) + ".mp4")
            app.main(
                input_file_path=(os.path.abspath(os.path.dirname(__file__)) +
                                 "\\PV\\" + str(k) + ".mp4"))
            break
        else:
            k = k + 1
            continue

    my_label2 = Label(
        top, text="Your processed video is in the PVs folder.").pack()
    btn = Button(top, text="Close", command=top.destroy).pack(
    )  #Close Button (after clicking Start Button)
Ejemplo n.º 5
0
def start():
    import logging
    from app import main
    try:
        main()
    except Exception:
        logging.exception()
Ejemplo n.º 6
0
    def test_multiple_notification_managers(self):
        events = list()

        class RecordingNotificationManager(NotificationManager):
            def __init__(self, prefix):
                super(RecordingNotificationManager, self).__init__()
                self.prefix = prefix

            def dns_updated(self, subdomain, result):
                events.append(('%s_DNS' % self.prefix, subdomain.name, result))

            def ssl_updated(self, subdomain, result):
                events.append(('%s_SSL' % self.prefix, subdomain.name, result))

        self.notifications = NotificationManager(
            RecordingNotificationManager('X'),
            RecordingNotificationManager('Y'))

        app.main()

        self.assertIn(('X_DNS', 'www', 'OK'), events)
        self.assertIn(('X_DNS', 'test', 'OK'), events)
        self.assertIn(('X_SSL', 'www', 'Updated'), events)
        self.assertIn(('X_SSL', 'test', 'Updated'), events)
        self.assertIn(('Y_DNS', 'www', 'OK'), events)
        self.assertIn(('Y_DNS', 'test', 'OK'), events)
        self.assertIn(('Y_SSL', 'www', 'Updated'), events)
        self.assertIn(('Y_SSL', 'test', 'Updated'), events)
Ejemplo n.º 7
0
    def test_skip_ssl_update(self):
        class NonChangingDNSManager(MockDNSManager):
            def get_current_ip(self, subdomain):
                return self.get_current_public_ip()

        class TestUpdatingSSLManager(MockSSLManager):
            def needs_update(self, subdomain):
                return subdomain.name == 'test'

        self.dns = NonChangingDNSManager()
        self.ssl = TestUpdatingSSLManager()

        app.main()

        for message_type, message in self.notifications.events:
            if message_type == 'Message':
                self.assertIn('Application starting', message)
                self.assertIn('version: unknown', message)
                self.assertIn('built: 1970-01-01 00:00:00', message)
                break

        else:
            self.fail('Startup message not found')

        self.assertIn(('SSL', 'test', 'Updated'), self.notifications.events)
        self.assertNotIn(('SSL', 'www', 'Updated'), self.notifications.events)
        self.assertEqual(len(self.notifications.events), 2)
Ejemplo n.º 8
0
def Power_Off(reset=False):
    if reset == True:
        pygame.quit()
        app.main()

    else:
        pygame.quit()
        raise SystemExit
Ejemplo n.º 9
0
def test_should_the_ouput_equal_14_and_14(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', input_values)
    app.main()
    captured = capsys.readouterr()
    out = str(captured.out).replace('How many operations?',
                                    '').replace('Input the operation:',
                                                '').strip()
    assert out == '14\n14'
Ejemplo n.º 10
0
 def test_appMainInitLogger(self):
     """
     The application main function must initialize the logger.
     """
     with patch('app.initLogger') as mockedInitLogger, \
             patch('app.AppComposer'):
         app.main()
         mockedInitLogger.assert_called_once()
Ejemplo n.º 11
0
def test_main(mocker):
    mocker.patch.object(logging, 'getLogger')
    mocker.patch.object(asyncio, 'get_event_loop')
    mocker.patch.object(app, 'supervisor')
    app.main()
    logging.getLogger.assert_called_once()
    asyncio.get_event_loop.assert_called_once()
    app.supervisor.assert_called_once()
Ejemplo n.º 12
0
    def application_didFinishLaunchingWithOptions_(
            self, application: ObjCInstance,
            launchOptions: ObjCInstance) -> bool:
        #utils.NSLog("App finished launching. Options: %s",str(py_from_ns(launchOptions) if launchOptions else dict()))

        app.main()

        return True
Ejemplo n.º 13
0
def test_app(infile, ofile, checkfile):
    direc = os.path.dirname(__file__)
    main(os.path.join(direc, "input", infile),
         os.path.join(direc, "input", "percentile.txt"),
         os.path.join(direc, "output", ofile))
    assert (open(os.path.join(direc, "output", ofile),
                 "r").readlines() == open(
                     os.path.join(direc, "output", checkfile),
                     "r").readlines())
Ejemplo n.º 14
0
    def test_no_date_in_response(self):
        # Перевіряємо що у відповіді відсутнє поле дата (тобто передана направильна URL)
        with self.assertRaises(Exception):
            main(self.ip_url)

        def test_home_work(self):
            # Мій захист
            self.assertEqual("Доброго дня!", home_work("01:01:01 PM"))
            self.assertEqual("Доброї ночі!", home_work("01:01:01 AM"))
Ejemplo n.º 15
0
 def test_main_fails_bad_domain(self, connect_mock, config_mock):
     """Ensure we fail when domains are badly formatted."""
     test_prefix = "TEST_PREFIX_"
     config_mock.return_value = dict(domains=[f"cant_split_domain"],
                                     domain_prefix=test_prefix)
     connect_mock.return_value = None
     with mock.patch("app.flush_workers", return_value=None):
         app.main()
         connect_mock.assert_called_with()
Ejemplo n.º 16
0
 def test_main_success(self, connect_mock, config_mock):
     """Ensure we can execute main."""
     connect_mock.return_value = None
     test_prefix = "TEST_PREFIX_"
     config_mock.return_value = dict(domains=[f"{test_prefix}domain.one"],
                                     domain_prefix=test_prefix)
     with mock.patch("app.flush_workers", return_value=None):
         app.main()
         connect_mock.assert_called_with()
Ejemplo n.º 17
0
    def test_main(self, render_template):
        # Setup
        render_template.return_value = '<html />'

        # Execute
        main()

        # Verify
        render_template.assert_called_once_with('app.html',
                                                title='Address Book')
Ejemplo n.º 18
0
def start_JabkaBot():
    vk = login()

    if vk is None:
        open_new(token_url)
        exit()
    elif vk == 1:
        return 1

    main(vk)
Ejemplo n.º 19
0
    def _test_main(args):
        procon = config.procon_dir
        if os.path.exists(procon):
            shutil.rmtree(procon)
        tmp = sys.argv
        sys.argv = ["a"] + args
        main()
        sys.argv = tmp

        assert os.path.exists(procon)
        shutil.rmtree(procon)
Ejemplo n.º 20
0
    def navigation(self, current_button):
        # navigate here
        if current_button == 1:  # new game
            import GUI.game_newgame as newgame_page
            newgame_page.NewGameOptions(self.window)

        elif current_button == 2:  # continue game
            import GUI.game_continue_option as continue_page
            continue_page.ContinueGameOptions(self.window)
        elif current_button == 3:
            import app
            app.main(self.window)
Ejemplo n.º 21
0
 def test_appMainAppComposer(self):
     """
     The application main function must instaciated th AppComposer
     and run it.
     """
     logger = object()
     with patch('app.initLogger') as mockedInitLogger, \
             patch('app.AppComposer') as mockedAppComp:
         mockedInitLogger.return_value = logger
         app.main()
         mockedAppComp.assert_called_once_with(logger)
         mockedAppComp().run.assert_called_once()
Ejemplo n.º 22
0
def daemonize(debug, conf_path, log_file):
    """ daemonize. """
    ctx = daemon.DaemonContext(
            working_directory=DEF_WORKDIR,
            umask=DEF_UMASK,
            stdout=log_file,
            stderr=log_file,
            # pidfile=lockfile.FileLock(DEF_PID_FILE),
        )

    with ctx:
        main(debug, True)
Ejemplo n.º 23
0
def main():
	if len(sys.argv) > 2:
		from config import init_config
		init_config(sys.argv[1])
		from config import init_config
		from config import CONFIG
		from logger import CustomLogger
		cust_logger = CustomLogger(CONFIG.web_server.logger_name)
		cust_logger.add_file("log/"+CONFIG.web_server.logger_name, False)
		import app
		if bool(int(sys.argv[2])) == True:
			app.main()
Ejemplo n.º 24
0
def main():
    if len(sys.argv) > 2:
        from config import init_config
        init_config(sys.argv[1])
        from config import init_config
        from config import CONFIG
        from logger import CustomLogger
        cust_logger = CustomLogger(CONFIG.web_server.logger_name)
        cust_logger.add_file("log/" + CONFIG.web_server.logger_name, False)
        import app
        if bool(int(sys.argv[2])) == True:
            app.main()
Ejemplo n.º 25
0
def test_app():
    input_values = [2, 3]
    output = []

    def mock_input(s):
        output.append(s)
        return input_values.pop(0)

    app.input = mock_input
    app.print = print

    app.main()
Ejemplo n.º 26
0
def run_server():
    parser = argparse.ArgumentParser(description='Run Sandstone IDE.')
    parser.add_argument('--port')
    parser.add_argument('--prefix')
    args = parser.parse_args()

    kwargs = {}

    if args.port: kwargs['port'] = args.port
    if args.prefix: kwargs['prefix'] = args.prefix

    app.main(**kwargs)
Ejemplo n.º 27
0
def getTrending(woeid):
    lis = []
    try:
        data = api.trends_place(woeid)
    except Exception as e:
        op.popUp("Error","Can not get the trend. Network Error",0)
        app.main()
    data = data[0]
    trendsData = data["trends"]
    for elem in trendsData:
        lis.append(elem["name"])
    return lis
Ejemplo n.º 28
0
    def test_ignored_ssl_notification(self):
        class IgnoringSSLManager(MockSSLManager):
            def update(self, subdomain):
                if subdomain.name == 'www':
                    return 'Ignored'
                else:
                    return super(IgnoringSSLManager, self).update(subdomain)

        self.ssl = IgnoringSSLManager()

        app.main()

        self.assertIn(('SSL', 'www', 'Ignored'), self.notifications.events)
        self.assertIn(('SSL', 'test', 'Updated'), self.notifications.events)
Ejemplo n.º 29
0
 def test_graph_triangle_tree(self):
     self.n = 4
     sol = self.triangle_tree()
     app.main(True)
     op = open("test.out", 'r')
     testNumber = 1
     while 1:
         lec = op.readline().strip()
         if not lec:
             break
         mstTest = int(lec)
         self.assertEqual(
             sol, mstTest,
             "Wrongs Answer traingle tree correct answer is ".format(sol))
Ejemplo n.º 30
0
def test_app():
    input_values = ['I', 'am', 'legend']
    output = []

    def mock_inputs(s):
        output.append(s)
        return input_values.pop(0)

    app.input = mock_inputs
    app.print = lambda s: output.append(s)

    app.main()

    assert output == ['hello']
Ejemplo n.º 31
0
def test_app(capsys):
    input_values = [2, 3]

    def mock_input(s):
        return input_values.pop(0)

    app.input = mock_input

    app.main()

    out, err = capsys.readouterr()

    assert out == 'The result is 5\n'
    assert err == ''
Ejemplo n.º 32
0
def main_menu():
    while True:
        screen.fill((26, 83, 92))

        draw_text('HANGMAN for Everyone', title_font, (255, 255, 255), screen,
                  WIDTH / 2 - (493 / 2), 50)

        mx, my = pygame.mouse.get_pos()

        addWordsButton = pygame.Rect(500, 200, 260, 80)
        optionButton = pygame.Rect(500, 300, 150, 80)
        quitButton = pygame.Rect(500, 400, 150, 80)
        hangmanRect = pygame.Rect(50, 130, 340, 430)

        pygame.draw.rect(screen, (51, 96, 103), addWordsButton)
        pygame.draw.rect(screen, (255, 50, 100), optionButton)
        pygame.draw.rect(screen, (255, 50, 100), quitButton)
        pygame.draw.rect(screen, button_color2, hangmanRect)

        draw_text("Add Words", title_font, (255, 255, 255), screen, 500, 200)
        draw_text("Option", title_font, (255, 255, 255), screen, 510, 320)
        draw_text("Quit", title_font, (255, 255, 255), screen, 515, 420)

        if addWordsButton.collidepoint((mx, my)):
            if click:
                game()
        if optionButton.collidepoint((mx, my)):
            if click:
                app.main()

        if quitButton.collidepoint((mx, my)):
            if click:
                pygame.quit()
                sys.exit()

        click = False
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            elif event.type == KEYDOWN:
                if event.key == K_ESCAPE:
                    pygame.quit()
                    sys.exit()
            elif event.type == MOUSEBUTTONDOWN:
                if event.button == 1:
                    click = True

        pygame.display.update()
        mainClock.tick(60)
Ejemplo n.º 33
0
    def test_failing_dns_notification(self):
        class FailingDNSManager(MockDNSManager):
            def update(self, subdomain, public_ip):
                if subdomain.name == 'test':
                    return 'Failed'
                else:
                    return super(FailingDNSManager,
                                 self).update(subdomain, public_ip)

        self.dns = FailingDNSManager()

        app.main()

        self.assertIn(('DNS', 'www', 'OK'), self.notifications.events)
        self.assertIn(('DNS', 'test', 'Failed'), self.notifications.events)
    def test_it_returns_correct_statistic(self):
        os.environ["config"] = self.test_environment.get_config_path()
        app.main()
        report_path = '{dir}/{report_name}'.format(
            dir=self.test_environment.get_report_dir(),
            report_name=self._TEST_REPORT_NAME)
        # if a report exists
        if not os.path.exists(report_path):
            self.fail('A report file was not created')
        report_content = read_file(report_path)

        # check a presence of url values, seems it is enough for now
        for row in self._EXPECTED_REPORT_TABLE_CONTENT:
            if not any(row['url'] in line for line in report_content):
                self.fail('Could not find correct url values in the report')
Ejemplo n.º 35
0
    def test_main(self):
        # Creating Mock methods and objects to use in testing
        app.bot_manager.BotManager = MagicMock(return_value="dummy bot manager")
        dummy_resourcer = Mock()
        attrs = {'start.return_value': None}
        dummy_resourcer.configure_mock(**attrs)
        app.resourcer.Resourcer = MagicMock(return_value=dummy_resourcer)
        dummy_bot = Mock()
        bot_attrs = {'start.return_value': None}
        dummy_bot.configure_mock(**bot_attrs)
        app.SlackBot = MagicMock(return_value=dummy_bot)

        # Testing with an empty token and a dummy token
        app.os.getenv = MagicMock(return_value="")
        self.assertEqual(app.main(), None)
        app.os.getenv = MagicMock(return_value="dummy token")
        self.assertEqual(app.main(), None)
Ejemplo n.º 36
0
def main(args):
    settings = args.env_settings
    
    if args.reset_db:
        if args.use_reloader:
            print "--use-reloader set. Ignoring --reset-database."
        else:
            really_reset = raw_input(
                ("Resetting the databases (%s) " % ', '.join(
                    settings.DATABASES.values()))
                + " will permanently delete all the data in them!\nAre you sure "
                + "you want to do this? (Y/N)")
            
            if really_reset.upper() == "Y":
                print "\nWiping dbs and loading fixtures..."
               
                # Using keys() instead of values() because we want to
                # load the same fixtures whether or not we're testing.
                for db_key, db_name in settings.DATABASES.items():
                    pymongo.MongoClient().drop_database(db_name)
                    db = pymongo.MongoClient()[db_name]
                
                    # Go through every JSON file in the fixtures directory and
                    # insert the objects in the JSON files into collections named
                    # after the JSON files they came from.
                    for f in glob.iglob("%s/%s/*.json" % (
                    args.fixtures_path, db_key)):
                        print "Loading " + f
                    
                        with open(f, 'r') as fixture:
                            for rows in bson.json_util.loads(fixture.read()):
                                db[f.split('/')[-1].split('.')[0]].insert(rows)
                
                print "Fixtures successfully loaded!\n"
                
            else:
                print "Ignoring --reset-database this time, then."
           
    if args.run_unittests:
        nose.run(argv = sys.argv[:1])
        
    if args.run_apitests:
        nose.run(argv = ['nosetests', '-a', 'api_test', 'api/functional_tests.py'])
        
    if args.run_server:
        app.main(settings = settings, use_reloader = args.use_reloader)
Ejemplo n.º 37
0
    def run(self):
        while True:
            timeron = time.time()
            logger.info ('Iniciando rotina de extração de texto')
            try:
                main(domain,outpath)

            except (ConnectionError, Timeout):
                logger.error ('Não foi possivel estabelecer conexão com o servidor! ' + domain)
            # except:
            #     logger.error ('Erro inesperado')
            timeronff = time.time()
            tempo = (timeronff - timeron)
            tempo = str(tempo)
            str_sleep_time = str(sleep_time)
            logger.info ('Esta execução gastou ' + tempo + ' segundos. Agora uma pausa de ' + str_sleep_time + ' segundos.')
            time.sleep(sleep_time)
Ejemplo n.º 38
0
	def run(self):
                infilename = self.input['text'].get('0.0', END).rstrip()
                outfolder = self.output['text'].get('0.0', END).rstrip()
                
                if not os.path.exists(infilename):
                        pass
                else:
                        infile = open(infilename,'r')
                
                outfile = outfolder + "/" + os.path.basename(infilename)
                if outfile.rfind(".xml", len(outfile)-4) != -1:
                        outfile = outfile[0:len(outfile)-3] + "sql"
                self.status['text'].delete('0.0', END)
		self.status['text'].insert('0.0', "Running")
		self.master.update_idletasks()
                Peter.main(infile, outfile, 1, True, True)
                self.status['text'].delete('0.0', END)
		self.status['text'].insert('0.0', "Finished")
Ejemplo n.º 39
0
def cli(debug, service, conf_path):
    """ command line interface. """
    DEF_CONF_FILE = conf_path

    fp = codecs.open(DEF_CONF_FILE, 'rb', encoding='utf-8')
    conf_contents = fp.read()
    fp.close()

    cf = jsontree.loads(conf_contents, encoding="utf-8")

    logger.d("log filename: {0}".format(cf.log_file))
    if cf.log_file is not None:
        log_file = open(cf.log_file, 'w')

    if service:
        daemonize(debug, conf_path, log_file)
    else:
        main(debug, False)
Ejemplo n.º 40
0
def main(args):
    settings = args.env_settings

    if args.reset_db:
        if args.use_reloader:
            print "--use-reloader set. Ignoring --reset-database."
        else:
            really_reset = raw_input(
                "Resetting the %s database" % settings.DATABASE
                + " will permanently delete all the data in it!\nAre you sure "
                + "you want to do this? (Y/N)"
            )

            if really_reset.upper() == "Y":
                print "\nWiping db and loading fixtures..."

                pymongo.MongoClient().drop_database(settings.DATABASE)
                db = pymongo.MongoClient()[settings.DATABASE]

                # Go through every JSON file in the fixtures directory and
                # insert the objects in the JSON files into collections named
                # after the JSON files they came from.
                for f in glob.iglob("%s/*.json" % args.fixtures_path):
                    print "Loading " + f

                    with open(f, "r") as fixture:
                        for rows in bson.json_util.loads(fixture.read()):
                            db[f.split("/")[-1].split(".")[0]].insert(rows)

                print "Fixtures successfully loaded!\n"

            else:
                print "Ignoring --reset-database this time, then."

    if args.run_unittests:
        nose.run(argv=sys.argv[:1])

    if args.run_server:
        app.main(settings=settings, use_reloader=args.use_reloader)
Ejemplo n.º 41
0
def text_request():
    from_number = request.values.get('From', None)
    message = request.values.get('Body', None).strip()

    p = Panlist.query.filter(Panlist.name=='textlist').first()
    user = User.query.filter(User.number==from_number).filter(User.panlist_id==p.id).first()

    returnmessage = main(from_number, message, p.id, user)

    resp = twilio.twiml.Response()
    if returnmessage is not None:
        resp.sms(returnmessage)
    return str(resp)
#!/usr/bin/env python
import os
cwd = os.path.dirname(os.path.abspath(__file__))
os.environ['PYTHON_EGG_CACHE'] = os.path.join(cwd, '..', 'misc/virtenv/lib/python2.6/site-packages')
virtualenv = os.path.join(cwd, '..', 'misc/virtenv/bin/activate_this.py')
execfile(virtualenv, dict(__file__=virtualenv))

import app
app.main(os.environ['OPENSHIFT_DIY_IP'],os.environ['OPENSHIFT_MYSQL_DB_HOST'],os.environ['OPENSHIFT_MYSQL_DB_PORT'])
Ejemplo n.º 43
0
 def setUp(self):
     from app import main
     app = main()
     self.app = TestApp(app)
Ejemplo n.º 44
0
def runserver():
    print "++++++++++++++++++++++++++runserver+++++++++++++++++++++++++++++++++"
    app.main()
Ejemplo n.º 45
0
#!/usr/bin/python3
# |Contribuidores              | No. USP |
# |----------------------------|---------|
# |Christian M. T. Takagi      | 7136971 |
# |Cinthia M Tanaka            | 5649479 |
# |Daniel A. Nagata            | 7278048 |
# |Fernando T. Tanaka          | 6920230 |
# ------------------------------------------------------------------------------
# Disciplina: Laboratório de Programação II       
# Prof. Alfredo Goldman
# Exercicio Programa - Etapa 2
# Arquivo: app.py
# ------------------------------------------------------------------------------

import sys
import app
import cliente


if __name__ == '__main__':
    if sys.argv[1] == '--server':
       app.main()
    if sys.argv[1] == '--client':
       cliente.main()
Ejemplo n.º 46
0
def test_main():
    status = app.main()
    assert status == 'Everything is alright'
Ejemplo n.º 47
0
# -*- coding: utf-8 -*-
'''
Created on 11/12/2013

@author: jmorales
'''
from __init__ import *
from app import main

main()
Ejemplo n.º 48
0
import daemon
from flask import Flask

import app as watcher

app = Flask(__name__)


@app.route("/")
def run():
    """ run. """

@app.route("/api/conf/reloaded")
def reloaded():
    """ reloaded. """
    watcher.load_configuration()
    return "completed reload configuration"


def start():
    """ start. """
    watcher.main()



if __name__ == '__main__':
    app.run(port=8487, threaded=True)
    watcher.main()

Ejemplo n.º 49
0
def start():
    """ start. """
    watcher.main()
Ejemplo n.º 50
0
 def test_main(self):
     self.assertEqual(main(), 'Hello World!')
Ejemplo n.º 51
0
 def setUp(self):
     from app import main
     app = main({})
     from webtest import TestApp
     self.testapp = TestApp(app)
Ejemplo n.º 52
0
def main():
    #override paths with local paths
    #start application
    import app
    app.main(init_config_paths(), app_file=__file__)
Ejemplo n.º 53
0
def app_main(lang,page=None):
    return app.main(request,lang,page)
Ejemplo n.º 54
0
 def setUp(self):
     from app import main
     the_app = main({}, **self.settings)
     from webtest import TestApp
     self.testapp = TestApp(the_app)
def main():
    app.main()
    cherrypy.engine.start()
    cherrypy.engine.block()
Ejemplo n.º 56
0

"""
Name:
	longframe

Usage:
	long-frame (-f <frames> | --frames <frames>)
	long-frame (-h | --help | --version)

Description:
	Take a long, blended screenshot using a webcam.

Options:
	-f <frames>, --frames <frames>     the number of frames to merge.
"""

from docopt import docopt
import app





if __name__ == '__main__':

	arguments = docopt(__doc__)
	app.main(arguments)
Ejemplo n.º 57
0
import sys

# If this script is called without load the bajoo package
if __package__ == '':
    import os

    path = os.path.dirname(os.path.dirname(__file__))
    sys.path.insert(0, path)

import app

if __name__ == '__main__':
    sys.exit(app.main())
Ejemplo n.º 58
0
def run_server():
    app.main()
Ejemplo n.º 59
0
#!/usr/bin/env python
import os
cwd = os.path.dirname(os.path.abspath(__file__))
os.environ['PYTHON_EGG_CACHE'] = os.path.join(cwd, '..', 'misc/virtenv/lib/python2.6/site-packages')
virtualenv = os.path.join(cwd, '..', 'misc/virtenv/bin/activate_this.py')
execfile(virtualenv, dict(__file__=virtualenv))

import app
app.main(os.environ['OPENSHIFT_DIY_IP'])
Ejemplo n.º 60
0
def serve():
    """
    Serve the "cooked" app.
    """
    import app
    app.main()