本文整理汇总了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()
示例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()
示例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))