• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python log.deferr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: connectionReady

    def connectionReady(self):
        """Initialize.
        """

        # Some terms:
        #  PUID: process unique ID; return value of id() function.  type "int".
        #  LUID: locally unique ID; an ID unique to an object mapped over this
        #        connection. type "int"
        #  GUID: (not used yet) globally unique ID; an ID for an object which
        #        may be on a redirected or meta server.  Type as yet undecided.
        self.sendCall("version", self.version)
        self.currentRequestID = 0
        self.currentLocalID = 0
        # Dictionary mapping LUIDs to local objects.
        # set above to allow root object to be assigned before connection is made
        # self.localObjects = {}
        # Dictionary mapping PUIDs to LUIDs.
        self.luids = {}
        # Dictionary mapping LUIDs to local (remotely cached) objects. Remotely
        # cached means that they're objects which originate here, and were
        # copied remotely.
        self.remotelyCachedObjects = {}
        # Dictionary mapping PUIDs to (cached) LUIDs
        self.remotelyCachedLUIDs = {}
        # Dictionary mapping (remote) LUIDs to (locally cached) objects.
        self.locallyCachedObjects = {}
        self.waitingForAnswers = {}
        for notifier in self.connects:
            try:
                notifier()
            except:
                log.deferr()
        self.connects = None
开发者ID:fxia22,项目名称:ASM_xf,代码行数:33,代码来源:pb.py


示例2: _doReadOrWrite

    def _doReadOrWrite(self, source, condition, faildict={
        error.ConnectionDone: failure.Failure(error.ConnectionDone()),
        error.ConnectionLost: failure.Failure(error.ConnectionLost()),
        }):
        why = None
        didRead = None
        if condition & POLL_DISCONNECTED and \
               not (condition & gobject.IO_IN):
            why = main.CONNECTION_LOST
        else:
            try:
                if condition & gobject.IO_IN:
                    why = source.doRead()
                    didRead = source.doRead
                if not why and condition & gobject.IO_OUT:
                    # if doRead caused connectionLost, don't call doWrite
                    # if doRead is doWrite, don't call it again.
                    if not source.disconnected and source.doWrite != didRead:
                        why = source.doWrite()
                        didRead = source.doWrite # if failed it was in write
            except:
                why = sys.exc_info()[1]
                log.msg('Error In %s' % source)
                log.deferr()

        if why:
            self._disconnectSelectable(source, why, didRead == source.doRead)
开发者ID:P13RR3,项目名称:FrostCore,代码行数:27,代码来源:gtk2reactor.py


示例3: connectionFailed

 def connectionFailed(self):
     for notifier in self.failures:
         try:
             notifier()
         except:
             log.deferr()
     self.failures = None
开发者ID:fxia22,项目名称:ASM_xf,代码行数:7,代码来源:pb.py


示例4: display

 def display(self, request):
     tm = []
     flip = 0
     namespace = {}
     self.prePresent(request)
     self.addVariables(namespace, request)
     # This variable may not be obscured...
     namespace['request'] = request
     namespace['self'] = self
     for elem in self.tmpl:
         flip = not flip
         if flip:
             if elem:
                 tm.append(elem)
         else:
             try:
                 x = eval(elem, namespace, namespace)
             except:
                 log.deferr()
                 tm.append(webutil.formatFailure(failure.Failure()))
             else:
                 if isinstance(x, types.ListType):
                     tm.extend(x)
                 elif isinstance(x, Widget):
                     val = x.display(request)
                     if not isinstance(val, types.ListType):
                         raise Exception("%s.display did not return a list, it returned %s!" % (x.__class__, repr(val)))
                     tm.extend(val)
                 else:
                     # Only two allowed types here should be deferred and
                     # string.
                     tm.append(x)
     return tm
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:33,代码来源:widgets.py


示例5: _doReadOrWrite

	def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log, faildict=None):
		if not faildict: faildict = {
		error.ConnectionDone: failure.Failure(error.ConnectionDone()),
		error.ConnectionLost: failure.Failure(error.ConnectionLost())
		}
		why = None
		inRead = False
		if event & POLL_DISCONNECTED and not (event & POLLIN):
			why = main.CONNECTION_LOST
		else:
			try:
				if event & POLLIN:
					why = selectable.doRead()
					inRead = True
				if not why and event & POLLOUT:
					why = selectable.doWrite()
					inRead = False
				if not selectable.fileno() == fd:
					why = error.ConnectionFdescWentAway('Filedescriptor went away')
					inRead = False
			except AttributeError, ae:
				if "'NoneType' object has no attribute 'writeHeaders'" not in ae.message:
					log.deferr()
					why = sys.exc_info()[1]
				else:
					why = None
			except:
开发者ID:Open-Plus,项目名称:opgui,代码行数:27,代码来源:e2reactor.py


示例6: _doReadOrWrite

 def _doReadOrWrite(self, selectable, fd, event):
     why = None
     inRead = False
     if event & POLL_DISCONNECTED and not (event & POLLIN):
         if fd in self._reads:
             why = main.CONNECTION_DONE
             inRead = True
         else:
             why = main.CONNECTION_LOST
     else:
         try:
             if event & POLLIN:
                 why = selectable.doRead()
                 inRead = True
             if not why and event & POLLOUT:
                 why = selectable.doWrite()
                 inRead = False
             if not selectable.fileno() == fd:
                 why = error.ConnectionFdescWentAway('Filedescriptor went away')
                 inRead = False
         except:
             log.deferr()
             why = sys.exc_info()[1]
     if why:
         self._disconnectSelectable(selectable, why, inRead)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:25,代码来源:pollreactor.py


示例7: _doReadOrWrite

    def _doReadOrWrite(self, source, condition, faildict=None):
        faildict = faildict or {
            error.ConnectionDone: failure.Failure(error.ConnectionDone()),
            error.ConnectionLost: failure.Failure(error.ConnectionLost()),
        }
        why = None
        inRead = False
        if condition & POLL_DISCONNECTED and not (condition & glib.IO_IN):
            if source in self._reads:
                why = main.CONNECTION_DONE
                inRead = True
            else:
                why = main.CONNECTION_LOST
        else:
            try:
                if condition & glib.IO_IN:
                    why = source.doRead()
                    inRead = True
                if not why and condition & glib.IO_OUT:
                    # if doRead caused connectionLost, don't call doWrite
                    # if doRead is doWrite, don't call it again.
                    if not source.disconnected:
                        why = source.doWrite()
            except:
                why = sys.exc_info()[1]
                log.msg('Error In %s' % source)
                log.deferr()

        if why:
            self._disconnectSelectable(source, why, inRead)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:30,代码来源:gtk2reactor.py


示例8: _doReadOrWrite

	def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log,
		faildict={
			error.ConnectionDone: failure.Failure(error.ConnectionDone()),
			error.ConnectionLost: failure.Failure(error.ConnectionLost())
		}):
		why = None
		inRead = False
		if event & POLL_DISCONNECTED and not (event & POLLIN):
			why = main.CONNECTION_LOST
		else:
			try:
				if event & POLLIN:
					why = selectable.doRead()
					inRead = True
				if not why and event & POLLOUT:
					why = selectable.doWrite()
					inRead = False
				if not selectable.fileno() == fd:
					why = error.ConnectionFdescWentAway('Filedescriptor went away')
					inRead = False
			except:
				log.deferr()
				why = sys.exc_info()[1]
		if why:
			self._disconnectSelectable(selectable, why, inRead)
开发者ID:0sc0d3r,项目名称:enigma2-1,代码行数:25,代码来源:e2reactor.py


示例9: _readAndWrite

    def _readAndWrite(self, source, condition):
        # note: gtk-1.2's gtk_input_add presents an API in terms of gdk
        # constants like INPUT_READ and INPUT_WRITE. Internally, it will add
        # POLL_HUP and POLL_ERR to the poll() events, but if they happen it
        # will turn them back into INPUT_READ and INPUT_WRITE. gdkevents.c
        # maps IN/HUP/ERR to INPUT_READ, and OUT/ERR to INPUT_WRITE. This
        # means there is no immediate way to detect a disconnected socket.

        # The g_io_add_watch() API is more suited to this task. I don't think
        # pygtk exposes it, though.
        why = None
        didRead = None
        try:
            if condition & gtk.GDK.INPUT_READ:
                why = source.doRead()
                didRead = source.doRead
            if not why and condition & gtk.GDK.INPUT_WRITE:
                # if doRead caused connectionLost, don't call doWrite
                # if doRead is doWrite, don't call it again.
                if not source.disconnected and source.doWrite != didRead:
                    why = source.doWrite()
                    didRead = source.doWrite # if failed it was in write
        except:
            why = sys.exc_info()[1]
            log.msg('Error In %s' % source)
            log.deferr()

        if why:
            self._disconnectSelectable(source, why, didRead == source.doRead)
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:29,代码来源:gtkreactor.py


示例10: _runOperationInTransaction

 def _runOperationInTransaction(self, trans, *args, **kwargs):
     try:
         return trans.execute(*args, **kwargs)
     except:
         log.msg('Exception in SQL operation %s %s'%(trans, args))
         log.deferr()
         raise
开发者ID:VoiSmart,项目名称:twistar,代码行数:7,代码来源:txconnectionpool.py


示例11: runUntilCurrent

    def runUntilCurrent(self):
        """Run all pending timed calls.
        """
        if self.threadCallQueue:
            # Keep track of how many calls we actually make, as we're
            # making them, in case another call is added to the queue
            # while we're in this loop.
            count = 0
            total = len(self.threadCallQueue)
            for (f, a, kw) in self.threadCallQueue:
                try:
                    f(*a, **kw)
                except:
                    log.err()
                count += 1
                if count == total:
                    break
            del self.threadCallQueue[:count]
            if len(self.threadCallQueue) > 0:
                if self.waker:
                    self.waker.wakeUp()


        # insert new delayed calls now
        self._insertNewDelayedCalls()

        now = seconds()
        while self._pendingTimedCalls and (self._pendingTimedCalls[0].time <= now):
            call = heappop(self._pendingTimedCalls)
            if call.cancelled:
                self._cancellations-=1
                continue

            if call.delayed_time > 0:
                call.activate_delay()
                heappush(self._pendingTimedCalls, call)
                continue

            try:
                call.called = 1
                call.func(*call.args, **call.kw)
            except:
                log.deferr()
                if hasattr(call, "creator"):
                    e = "\n"
                    e += " C: previous exception occurred in " + \
                         "a DelayedCall created here:\n"
                    e += " C:"
                    e += "".join(call.creator).rstrip().replace("\n","\n C:")
                    e += "\n"
                    log.msg(e)


        if (self._cancellations > 50 and
             self._cancellations > len(self._pendingTimedCalls) >> 1):
            self._cancellations = 0
            self._pendingTimedCalls = [x for x in self._pendingTimedCalls
                                       if not x.cancelled]
            heapify(self._pendingTimedCalls)
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:59,代码来源:base.py


示例12: errConnectionLost

 def errConnectionLost(self):
     self.lostErrorConnection = 1
     del self.err
     try:
         self.proto.errConnectionLost()
     except:
         log.deferr()
     self.maybeCallProcessEnded()
开发者ID:fxia22,项目名称:ASM_xf,代码行数:8,代码来源:process.py


示例13: _runAction

 def _runAction(self, action, fd):
     try:
         closed = getattr(fd, action)()
     except:
         closed = sys.exc_info()[1]
         log.deferr()
     if closed:
         self._disconnectSelectable(fd, closed, action == 'doRead')
开发者ID:sunu,项目名称:qt5reactor,代码行数:8,代码来源:core.py


示例14: inConnectionLost

 def inConnectionLost(self):
     try:
         self.proto.inConnectionLost()
     except:
         log.deferr()
     del self.writer
     self.lostInConnection = 1
     self.maybeCallProcessEnded()
开发者ID:fxia22,项目名称:ASM_xf,代码行数:8,代码来源:process.py


示例15: _continueSystemEvent

 def _continueSystemEvent(self, eventType):
     sysEvtTriggers = self._eventTriggers.get(eventType)
     for callList in sysEvtTriggers[1], sysEvtTriggers[2]:
         for callable, args, kw in callList:
             try:
                 callable(*args, **kw)
             except:
                 log.deferr()
开发者ID:fxia22,项目名称:ASM_xf,代码行数:8,代码来源:base.py


示例16: __del__

 def __del__(self):
     """Do distributed reference counting on finalize.
     """
     try:
         # log.msg( ' --- decache: %s %s' % (self, self.luid) )
         if self.broker:
             self.broker.decCacheRef(self.luid)
     except:
         log.deferr()
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:9,代码来源:flavors.py


示例17: addStdout

 def addStdout(self, data):
     if not self.decoder:
         return
     try:
         self.decoder.dataReceived(data)
     except BananaError:
         self.decoder = None
         log.msg("trial --jelly output unparseable, traceback follows")
         log.deferr()
开发者ID:abyx,项目名称:buildbot,代码行数:9,代码来源:step_twisted2.py


示例18: lineReceived

 def lineReceived(self, line):
     try:
         irc.IRCClient.lineReceived(self, line)
     except:
         # If you *don't* catch exceptions here, any unhandled exception
         # raised by anything lineReceived calls (which is most of the
         # client code) ends up making Connection Lost happen, which
         # is almost certainly not necessary for us.
         log.deferr()
开发者ID:fxia22,项目名称:ASM_xf,代码行数:9,代码来源:tendril.py


示例19: botCommand

 def botCommand(self, command, prefix, params, recipient):
     method = getattr(self, "bot_%s" % command, None)
     try:
         if method is not None:
             method(prefix, params, recipient)
         else:
             self.bot_unknown(prefix, command, params, recipient)
     except:
         log.deferr()
开发者ID:alchemist666,项目名称:chat-server,代码行数:9,代码来源:ircbot.py


示例20: sendUpdate

 def sendUpdate(self, remote, last=0):
     self.watchers[remote].needUpdate = 0
     #text = self.asText() # TODO: not text, duh
     try:
         remote.callRemote("progress", self.remaining())
         if last:
             remote.callRemote("finished", self)
     except:
         log.deferr()
         self.removeWatcher(remote)
开发者ID:1stvamp,项目名称:buildbot,代码行数:10,代码来源:progress.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.err函数代码示例发布时间:2022-05-27
下一篇:
Python log.debug函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap