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


Python App.run方法代码示例

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


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

示例1: main

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
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,代码行数:31,代码来源:main.py

示例2: AppTestCase

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
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,代码行数:31,代码来源:test_app.py

示例3: RtAgent

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
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,代码行数:31,代码来源:rta.py

示例4: handle_command

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
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,代码行数:14,代码来源:manage.py

示例5:

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
from app import App as application

if __name__ == "__main__":
   application.run()
开发者ID:martyni,项目名称:app,代码行数:6,代码来源:wsgi.py

示例6: App

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
import logging
logging.basicConfig(level=logging.DEBUG)

from widget import Widget
from app import App

import hooks

app = App("console.json")

app.run()
开发者ID:chazu,项目名称:jinxes,代码行数:13,代码来源:console.py

示例7: main

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
def main():
    args = get_cmd_arguments()
    app = App(os.path.abspath(args.config))
    app.run()
开发者ID:zolkko,项目名称:blumenplace-front,代码行数:6,代码来源:front.py

示例8:

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
#!flask/bin/python

from app import App
App.run(debug = True)
开发者ID:mjevans93308,项目名称:microblog,代码行数:6,代码来源:run.py

示例9: main

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
def main():
  app = App(GameFactory())
  app.run()
开发者ID:doctordesh,项目名称:pygame-tetris,代码行数:5,代码来源:main.py

示例10:

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
from app import App
App.run(host='0.0.0.0')
开发者ID:tushar-rishav,项目名称:Apeksha,代码行数:4,代码来源:runserver.py

示例11: BaseLyricSourcePlugin

# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import run [as 别名]
class BaseLyricSourcePlugin(DBusObject):
    """ Base class for implementing a lyric source plugin
    """

    def __init__(self, id, name=None, watch_daemon=True):
        """
        Create a new lyric source instance. 

        Arguments:

        - `id`: The unique ID of the lyric source plugin. The full bus
          name of the plugin will be `org.osdlyrics.LyricSourcePlugin.id`
        - `name`: (optional) The name of the plugin, which should be properly
          localized. If `name` is missing, the plugin will take `id` as its
          name.
        - `watch_daemon`: Whether to watch daemon bus.
        """
        self._id = id
        self._app = App('LyricSourcePlugin.' + id,
                        watch_daemon=watch_daemon)
        DBusObject.__init__(self,
                            conn=self._app.connection,
                            object_path=LYRIC_SOURCE_PLUGIN_OBJECT_PATH_PREFIX + self._id)
        self._search_count = 0
        self._download_count = 0
        self._search_tasks = {}
        self._download_tasks = {}
        self._name = name if name is not None else id
        self._config = None

    def do_search(self, metadata):
        """
        Do the real search work by plugins. All plugins MUST implement this method.

        This method runs in a seperate thread, so don't worry about block IO.

        Parameters:

        - `metadata`: The metadata of the track to search. The type of `metadata`
          is osdlyrics.metadata.Metadata

        Returns: A list of SearchResult objects
        """
        raise NotImplementedError()

    @onmainthread
    def do_searchsuccess(self, ticket, results):
        if ticket in self._search_tasks:
            del self._search_tasks[ticket]
            dbusresults = [result.to_dict() for result in results]
            self.SearchComplete(ticket, SEARCH_SUCCEED, dbusresults)

    @onmainthread
    def do_searchfailure(self, ticket, e):
        if ticket in self._search_tasks:
            del self._search_tasks[ticket]
            logging.info('Search fail, %s' % e)
            self.SearchComplete(ticket, SEARCH_FAILED, [])

    @dbus.service.method(dbus_interface=LYRIC_SOURCE_PLUGIN_INTERFACE,
                         in_signature='a{sv}',
                         out_signature='i')
    def Search(self, metadata):
        ticket = self._search_count
        self._search_count = self._search_count + 1
        thread = BaseTaskThread(onfinish=lambda result: self.do_searchsuccess(self._app, ticket, result),
                                onerror=lambda e: self.do_searchfailure(self._app, ticket, e),
                                target=self.do_search,
                                kwargs={'metadata': Metadata.from_dict(metadata)})
        self._search_tasks[ticket] = thread
        thread.start()
        return ticket

    @dbus.service.method(dbus_interface=LYRIC_SOURCE_PLUGIN_INTERFACE,
                         in_signature='i',
                         out_signature='')
    def CancelSearch(self, ticket):
        if ticket in self._search_tasks:
            del self._search_tasks[ticket]
            self.SearchComplete(ticket, SEARCH_CANCELLED, [])


    def do_download(self, downloadinfo):
        """
        Do the real download work by plugins. All plugins MUST implement this
        method.

        This method runs in a seperate thread, so don't worry about block IO.

        Parameters:

        - `downloadinfo`: The additional info taken from `downloadinfo` field in
          SearchResult objects. 

        Returns: A string of the lyric content
        """
        raise NotImplementedError()

    @onmainthread
    def do_downloadsuccess(self, ticket, content):
#.........这里部分代码省略.........
开发者ID:ihacklog,项目名称:osdlyrics,代码行数:103,代码来源:lyricsource.py


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