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


Python Handler.set_server方法代码示例

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


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

示例1: handle_process

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import set_server [as 别名]
    def handle_process(self, process, input_process=None):
        '''handle the individual process

        @params
        process - the name of the process to be handled
        input_process - the name of the input process that called
            this process
        '''

        # get the handler and instantiate it
        handler_class = self.pipeline.get_handler_class(process)
        if handler_class:
            try:
                handler = Common.create_from_class_path(handler_class)
            except ImportError:
                raise ImportError("Could not import handler class [%s]" % handler_class)

        else:
            handler = Handler()

        # pass the options to the handler
        options = self.pipeline.get_action_options(process)
        handler.set_options(options)
        
        # pass relevant information to the handler
        handler.set_process_name(process)
        handler.set_server(self.server)
        handler.set_pipeline(self.pipeline)
        handler.set_package(self.package)

        # if this is the first process (no input process, then the package
        # is the input 
        if not input_process:
            output = self.package.copy()
        else:
            # get input processes and hand over the delivery
            input_handler = self.handlers_dict.get(input_process)
            if input_handler:
                output = input_handler.get_output()
            else:
                output = {}

        # By default, inputs travel through
        handler.set_input( output )
        handler.set_output( output )


        # store the handler and execute
        self.handlers.append(handler)
        self.handlers_dict[process] = handler
        handler.execute()

        # process all of the output handlers.  First ask the current handler
        # for the next process
        output_processes = handler.get_next_processes()

        # if output processes is None, then stop this branch completely
        if output_processes == None:
            return

        # otherwise, use the pipeline
        if not output_processes:
            output_processes = self.pipeline.get_output_process_names(process)

        for output_process in output_processes:
            self.handle_process(output_process, process)
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:68,代码来源:interpreter.py


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