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


Python Dispatcher.run方法代码示例

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


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

示例1: __init__

# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import run [as 别名]
class Plugin:
    
    def __init__(self,path):
        self.config = Configuration(path)
        self.dispatcher = Dispatcher()
        
    def initialize(self):
        self.config.load()
        self.dispatcher.setConfig(self.config)
    
    def run(self):
        self.dispatcher.run()
            
开发者ID:jdgwartney,项目名称:boundary-plugin-shell,代码行数:14,代码来源:plugin.py

示例2: main

# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import run [as 别名]
def main():
    # Setting up dispatcher for math operations.
    math_opts = [('Square', square_input),
                 ('Double', double_input),
                 ('Negate', negate_input)]
    math_level = Dispatcher("Which math function would you like to use? ", options=math_opts)

    # Setting up dispatcher for string operations
    str_opts = [('Downcase', downcase_input),
                ('Repeat', repeat_input),
                ('Reverse',reverse_input)]
    str_level = Dispatcher("Which string operation do you need? 1", options = str_opts)

    # Top level dispatcher
    top_opts = [('Math functions', math_level.run),
                ('String functions', str_level.run)]
    top_level = Dispatcher('CLI Template demo', cycle=True, clear=False, options=top_opts)
    top_level.run()
开发者ID:edgelord,项目名称:CLI-Template,代码行数:20,代码来源:demo.py

示例3: run

# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import run [as 别名]
 def run(self, driver=True, asynch=True):
     disp = Dispatcher(self.eval_func, asynch)
     
     while True:
         if disp.run(): #jobs done
             if driver:
                 if drive_optimization(population_size=self.population_size, dim=self.dim, lower_bounds=self.lower_bounds, upper_bounds=self.upper_bounds):
                     continue
         
         # wait between 5 and 15 seconds to prevent several VMs from accessing GAE simultaneously
         time.sleep(random.randrange(5, 15))
开发者ID:henrique,项目名称:DistEvo,代码行数:13,代码来源:optimizer.py


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