当前位置: 首页>>代码示例>>Python>>正文


Python app.App类代码示例

本文整理汇总了Python中app.App的典型用法代码示例。如果您正苦于以下问题:Python App类的具体用法?Python App怎么用?Python App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了App类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: postUpdate

 def postUpdate(self):
     State.postUpdate(self)
     if self.finished():
         self.movie.stop()
         App.Screen.fill((255, 0, 0))
         pygame.mixer.init()
         App.switchState(self.nextState())
开发者ID:jedStevens,项目名称:loki,代码行数:7,代码来源:state.py

示例2: wsgi_factory

def wsgi_factory():   # pragma: no cover
    morepath.autoscan()

    App.commit()
    setup_db()

    return App()
开发者ID:MTDdk,项目名称:FrameworkBenchmarks,代码行数:7,代码来源:run.py

示例3: test_participation_logic

 def test_participation_logic(self):
     rep = self._register()
     now = datetime.now()
     participant = StudyParticipant.objects.create(
                             reporter=rep, start_date = now.date(),
                             notification_time=now.time(), state="0",
                             next_question_time=now, next_start_time=now)
     
     app = App("")
     participant = app.update_participant(participant)
     self.assertEqual("1", participant.state)
     date = now + timedelta(hours=1)
     next_date = now + timedelta(days=7)
     self.assertEqual(date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
     
     participant = app.update_participant(participant)
     self.assertEqual("2", participant.state)
     date = now + timedelta(days=1)
     self.assertEqual(date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
     
     participant = app.update_participant(participant)
     self.assertEqual("3", participant.state)
     date = now + timedelta(days=2)
     self.assertEqual(date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
     
     participant = app.update_participant(participant)
     self.assertEqual("0", participant.state)
     self.assertEqual(next_date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
开发者ID:ITIDO,项目名称:rapidsms,代码行数:32,代码来源:tests.py

示例4: RtAgent

class RtAgent(object):
    def __init__(self, conf):
        self.gb = GeneralBase(conf)
        self.app = App(conf)
        self.vod = Vod(conf)
        self.guide = Guide(conf)
        self.cat = Cat(conf)

    def interrupt(self):
        pass

    def accept(self, p, isnew = True):
        if p.get('_type') != 'normal':
            return

        if p.get('_device', '').lower() not in ['a11', 'a21', 'k72', 'k82', 'ud10a', 'ds70a', 'lx750a', 'lx755a', 'lx850a', 'lx960a', 'k91', 's31', 's51', 's61', 'e31', 'e62']:
            return

        if p.get('event') not in ['video_exit', 'app_start', 'launcher_vod_click', 'video_category_out']:
            return

        if isnew:
            if self.gb.run(p):
                self.app.run(p)
                self.vod.run(p)
                self.guide.run(p)
                self.cat.run(p)
        else:
            self.vod.run(p)
开发者ID:ahua,项目名称:python,代码行数:29,代码来源:rta.py

示例5: main

def main( *args ):
    pathstr_source = os.path.dirname( __file__ )
    pathstr_conf_d = os.path.join( pathstr_source, 'config.yaml' )
    conf_inst = config.Config.load_yaml( pathstr_conf_d, pathstr_source )

    parser = argparse2.ArgParser2( description='Password Manager' )
    parser.add_argument(
        '-s', '--store', type=argparse2.PathType( canonical=True, check_write=True ),
        default=conf_inst.path_store, help='Store file. Default: %s' % conf_inst.path_store )
    parser.add_argument(
        '-c', '--config', type=argparse2.PathType( canonical=True ),
        default=conf_inst.path_config, help='Configuration file. Default: %s' % conf_inst.path_config )
    parser.add_argument(
        '-i', '--ui', default=conf_inst.ui, choices=conf_inst.ui_choices,
        help='UI to be used. Default: %s' % conf_inst.ui )
    parser.add_argument(
        '-l', '--logging', type=argparse2.LogType(), choices=argparse2.LogType.choices,
        default=conf_inst.logging, help='Logging level. Default: %s' % conf_inst.logging )

    if args:
        args = parser.parse_args( args )
    else:
        args = parser.parse_args()

    conf_inst.update2(
        path_store=args.store,
        path_config=args.config,
        ui=args.ui,
        logging=args.logging )
    conf_inst.load_user_conf()
    conf_inst.save_user_conf()

    App.instance( conf_inst ).run()
开发者ID:omer-akhter,项目名称:PasswdMan,代码行数:33,代码来源:main.py

示例6: main

def main():
    args = docopt(__doc__)

    schema = Schema({
        '--help': bool,
        '--headless': bool,
        '--width': Use(int),
        '--height': Use(int),
        '<save_path>': str,
    })

    try:
        args = schema.validate(args)
    except SchemaError as e:
        exit(e)

    model_path = 'models'

    loadPrcFileData('', 'window-title Babble')
    loadPrcFileData('', 'win-size %d %d' % (args['--width'], args['--height']))
    loadPrcFileData('', 'audio-library-name null') # suppress warning
    loadPrcFileData('', 'model-path %s' % model_path)
    loadPrcFileData('', 'bullet-filter-algorithm groups-mask')

    if args['--headless']:
        loadPrcFileData('', 'window-type none')

    app = App(args)
    app.run()
开发者ID:BarkingMouseStudio,项目名称:python-experiments,代码行数:29,代码来源:main.py

示例7: main

def main():
    client = App()

    while client.running:
        client.run_app()

    client.close()
开发者ID:willmeyers,项目名称:apynt,代码行数:7,代码来源:main.py

示例8: AppTestCase

class AppTestCase(unittest.TestCase):
    def setUp(self):
        self.input = MagicMock()
        # swipe somewhere (south):
        self.input.getline = MagicMock(return_value='s')

        self.output = MagicMock()
        self.output.write = MagicMock()

        self.app = App(self.input, self.output)
        self.app.renderer = create_autospec(Renderer)  # type: MagicMock

    def test_runZeroTimesRendersOnce(self):
        self.app.run(max_prompts=0)
        count = len(self.app.renderer.mock_calls)
        self.assertEqual(
            1,
            count,
            "Method render on Renderer should be called one time."
        )

    def test_runOneTimeSwipingSouthRendersTwice(self):
        self.app.run(max_prompts=1)
        count = len(self.app.renderer.mock_calls)
        self.assertEqual(
            2,
            count,
            "Method render on Renderer should be called two times."
        )
开发者ID:yeldiRium,项目名称:2048,代码行数:29,代码来源:test_app.py

示例9: testApp

	def testApp(self, n):
		a = App(0)
		urls = {}
		
		# Shorten n/2 URLS
		for url in range(0, n/2):
			short = a.get_short_url(url)
			assert type(short) == str
			assert short[0] == '0'
			urls[short] = url
	
		# Retrive n/2 long urls from short urls
		for shortUrl in urls.iterkeys():
			assert urls[shortUrl] == a.get_long_url(shortUrl)
			
		# Shorten n/2 URLS
		for url in range(n/2, n):
			short = a.get_short_url(url)
			assert type(short) == str
			assert short[0] == '0'
			urls[short] = url
	
		# Retrive n long urls from short urls
		for shortUrl in urls.iterkeys():
			assert urls[shortUrl] == a.get_long_url(shortUrl)
开发者ID:adcaes,项目名称:Wrpp,代码行数:25,代码来源:test.py

示例10: stage

	def stage(self, stage_dir, bundle):
		App.stage(self, stage_dir, bundle=bundle)

		contents = self.get_contents_dir()
		self.env.log(u'Copying kboot to %s' % contents)
		self.executable_path = p.join(self.contents, self.name)
		effess.copy(p.join(self.sdk_dir, 'kboot'), self.executable_path)
开发者ID:finglish,项目名称:titanium_desktop,代码行数:7,代码来源:linux_app.py

示例11: test_json_output

 def test_json_output(self):
   expected_results = {'container_id': 'test',
     'username': 'joe_user', 'hostname': 'test001', 'cpu_shares': 100,
     'ram': 100, 'port_list': [], 'host_server': 'test_server', 
     'volumes': ['/mnt/vol/test_vol'], 'ssh_port': 22}
   a = App('test', 'joe_user', 'test001', 100, 100, 'test_server', 22, 
     ['/mnt/vol/test_vol'])
   self.assertEqual(expected_results, a.get_json())
开发者ID:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py

示例12: should_ask_for_new_input

 def should_ask_for_new_input(self):
     app = App('1,2,3', self.output, self.input)
     self.input.input = "1,2"
     app.getNextUserInput()
     self.assertEqual("another input please", self.output.output[len(self.output.output)-2])
     
     
 
     
开发者ID:glebb,项目名称:Katas,代码行数:5,代码来源:testapp.py

示例13: test_server

def test_server(port):
    """Start a server to test against"""
    app = App(port=port)
    try:
        thread = threading.Thread(target=app.start)
        thread.daemon = True
        thread.start()
        yield app
    finally:
        app.stop()
开发者ID:PuZheng,项目名称:flask-report,代码行数:10,代码来源:splinter_tests.py

示例14: loadAPP

 def loadAPP(app_path):
     app = App(app_path)
     try:
         app.load()
     # except (yaml.scanner.ScannerError, yaml.parser.ParserError) as e:
     except Exception as e:
         print app_path
         print e
     app.shell_path = os.path.basename(os.path.dirname(app_path))
     return app
开发者ID:gahoo,项目名称:SNAP,代码行数:10,代码来源:pipe.py

示例15: handle_command

def handle_command():
    try:
        command = sys.argv[1]
        if command in ['runserver', 'initdb']:
            if command == 'runserver':
                App.run()
            elif command == 'initdb':
                db_utils.init_db('./schema.sql')
        else:
            print("Command Not Found, Avaliable commands [runserver, initdb]")
    except IndexError:
        print("Available commands are:\n\trunserver\n\tinitdb")
开发者ID:CATWebTeam,项目名称:git-workshop,代码行数:12,代码来源:manage.py


注:本文中的app.App类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。