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


Python defer.execute函数代码示例

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


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

示例1: _handle_event

 def _handle_event(self, event_type, args=(), respond_to=False):
     """handles event dispatch"""
     for event in self.events[event_type]:
         if self.config['threaded']:
             threads.deferToThread(self._event, event, args, respond_to)
         else:
             defer.execute(self._event, event, args, respond_to)
开发者ID:zeekay,项目名称:chii,代码行数:7,代码来源:chii.py

示例2: handle_line

 def handle_line(self, line):
     """Deal with a line of input."""
     # TODO this should be part of debug output in the irc shell, too, and
     # not baked in here
     log.msg("received: " + repr(line))
     from twisted.internet import defer
     # XXX this is here cause it allows exceptions to actually be caught; be more careful with that in general
     defer.execute(self._handle_line, line)
开发者ID:Motoma,项目名称:dywypi,代码行数:8,代码来源:shell.py

示例3: _start_tasks

 def _start_tasks(self):
     """starts all tasks"""
     if self.tasks:
         for task in self.tasks:
             func, repeat, scale = self.tasks[task]
             if self.config['threaded']:
                 threads.deferToThread(self._task, task, func, repeat, scale)
             else:
                 defer.execute(self._task, task, func, repeat, scale)
开发者ID:zeekay,项目名称:chii,代码行数:9,代码来源:chii.py

示例4: _handle_command

 def _handle_command(self, channel, nick, host, msg):
     """handles command dispatch"""
     msg = msg.split()
     command = self.commands.get(msg[0][1:].lower(), None)
     if command:
         if self._check_permission(command._restrict, nick, host):
             if self.config['threaded']:
                 threads.deferToThread(self._command, command, channel, nick, host, msg)
             else:
                 defer.execute(self._command, command, channel, nick, host, msg)
开发者ID:zeekay,项目名称:chii,代码行数:10,代码来源:chii.py

示例5: listen

 def listen(self, protocolFactory):
     """
     Implement L{IStreamServerEndpoint.listen} to listen on a TCP socket
     """
     return defer.execute(
         self._reactor.listenTCP, self._port, protocolFactory, backlog=self._backlog, interface=self._interface
     )
开发者ID:pombredanne,项目名称:toppatch,代码行数:7,代码来源:endpoints.py

示例6: wrapper

 def wrapper(*args, **kwargs):
     assert len(kwargs) == 0, (
         "The Provisioning API is meant to be used via XML-RPC, "
         "for now, so its methods are prevented from use with "
         "keyword arguments, which XML-RPC does not support.")
     # TODO: Convert exceptions into Faults.
     return defer.execute(func, *args)
开发者ID:deepakhajare,项目名称:maas,代码行数:7,代码来源:fakeapi.py

示例7: loadModel

    def loadModel(self, path, request):
        """Load a model, for the given path and request.

        @rtype: L{Deferred}
        """
        from twisted.internet.defer import execute
        return execute(self.loadModelNow, path, request)
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:7,代码来源:tapestry.py

示例8: wrapper

 def wrapper(*args, **kwargs):
     if not _testing:
         return deferToThreadPool(reactor, _threadpool,
                                  run_in_tx, fun, *args, **kwargs)
     else:
         # No threading during testing
         return defer.execute(run_in_tx, fun, *args, **kwargs)
开发者ID:bbc88ks,项目名称:opennode-management,代码行数:7,代码来源:db.py

示例9: listen

 def listen(self, protocolFactory):
     return defer.execute(twisted.listenTLS,
                          self._reactor,
                          self._port,
                          protocolFactory,
                          self._credentials,
                          backlog=self._backlog,
                          interface=self._interface)
开发者ID:bekomy,项目名称:xmppserver,代码行数:8,代码来源:tls.py

示例10: listen

 def listen(self, protocolFactory):
     """
     Implement L{IStreamServerEndpoint.listen} to listen on a UNIX socket.
     """
     return defer.execute(self._reactor.listenUNIX, self._address,
                          protocolFactory,
                          backlog=self._backlog,
                          mode=self._mode,
                          wantPID=self._wantPID)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:9,代码来源:endpoints.py

示例11: callRemote

 def callRemote(self, method, *args, **kw):
     if hasattr(self.interfaceClass, method):
         result = defer.execute(self._callMethod, method, *args, **kw)
         return result
     elif self.failWhenNotImplemented:
         return defer.fail(
             Failure(NotImplementedError,
                     "No Such Method in Interface: %s" % method))
     else:
         return defer.succeed(None)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:10,代码来源:util.py

示例12: get_state

    def get_state(self):
        """
        Reads state from the file.

        :returns: `Deferred` that fires with the current state.
        """
        def _read():
            if os.path.exists(self.filename):
                return open(self.filename).read()

        return defer.execute(_read)
开发者ID:MariaAbrahms,项目名称:otter,代码行数:11,代码来源:state.py

示例13: lookupAddress

 def lookupAddress(self, name, timeout=None):
     """
     The twisted function which is called when an A record lookup is
     requested.
     :param name: The domain name being queried for (e.g. example.org).
     :param timeout: Time in seconds to wait for the query response.
     (optional, default: None)
     :return: A DNS response for the record query.
     """
     log.msg("Query for %s" % name)
     d = defer.execute(queryAddress, name)
     return d
开发者ID:rail,项目名称:ec2-dns,代码行数:12,代码来源:ec2-dns.py

示例14: connectionMade

    def connectionMade(self):

        if not self.factory.retrieved_file_queue:
            # Create once, queue persists in the factory
            self.factory.retrieved_file_queue = collections.deque('', SEARCH_SIZE)

        # Only need to scan the local directory during startup
        if len(self.factory.retrieved_file_queue) == 0:
            d = defer.execute(self._process_local_files)
            d.addErrback(self._process_local_files_errback)
            d.addCallback(lambda ignore: self._change_directory())    # suppress the returned result
        else:
            self._change_directory()
开发者ID:ronkyo,项目名称:ooi_port_agent,代码行数:13,代码来源:zplsc_agent.py

示例15: freeze_commit

    def freeze_commit(self, events):
        """Unfreezes the frozen path, sending received events if not dirty.

        If events for that path happened:
            - return True
        else:
            - push the here received events, return False
        """
        if self._processor.frozen_path is None:
            raise ValueError("Committing with nothing frozen!")

        d = defer.execute(self._processor.freeze_commit, events)
        return d
开发者ID:magicicada-bot,项目名称:magicicada-client,代码行数:13,代码来源:fsevents_daemon.py


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