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


Python interfaces.IReactorTime方法代码示例

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


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

示例1: test_timeout_add

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def test_timeout_add(self):
        """
        A
        L{reactor.callLater<twisted.internet.interfaces.IReactorTime.callLater>}
        call scheduled from a C{gobject.timeout_add}
        call is run on time.
        """
        import gobject
        reactor = self.buildReactor()

        result = []
        def gschedule():
            reactor.callLater(0, callback)
            return 0
        def callback():
            result.append(True)
            reactor.stop()

        reactor.callWhenRunning(gobject.timeout_add, 10, gschedule)
        self.runReactor(reactor, 5)
        self.assertEqual(result, [True]) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:23,代码来源:test_time.py

示例2: __init__

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def __init__(self, clock):
        """
        @type clock: L{IReactorTime <interfaces.IReactorTime>} provider
        @param clock: A reactor which will be used to learn the current time.
        """
        self._clock = clock 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:8,代码来源:maildir.py

示例3: call_later

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def call_later(self, delay, fun, *args, **kwargs):
        return IReactorTime(self._get_loop()).callLater(delay, fun, *args, **kwargs) 
开发者ID:crossbario,项目名称:txaio,代码行数:4,代码来源:tx.py

示例4: __init__

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def __init__(self, clock):
        # pass clock=reactor unless you're testing
        self._clock = IReactorTime(clock)
        self._calls = []
        self._flush_d = None
        self._timer = None 
开发者ID:warner,项目名称:magic-wormhole,代码行数:8,代码来源:eventual.py

示例5: callLater

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def callLater(self, _seconds, _f, *args, **kw):
        """See twisted.internet.interfaces.IReactorTime.callLater.
        """
        assert callable(_f), "%s is not callable" % _f
        assert sys.maxint >= _seconds >= 0, \
               "%s is not greater than or equal to 0 seconds" % (_seconds,)
        tple = DelayedCall(self.seconds() + _seconds, _f, args, kw,
                           self._cancelCallLater,
                           self._moveCallLaterSooner,
                           seconds=self.seconds)
        self._newTimedCalls.append(tple)
        return tple 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:14,代码来源:base.py

示例6: callLater

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def callLater(self, _seconds, _f, *args, **kw):
        """See twisted.internet.interfaces.IReactorTime.callLater.
        """
        assert callable(_f), "%s is not callable" % _f
        assert sys.maxint >= _seconds >= 0, \
               "%s is not greater than or equal to 0 seconds" % (_seconds,)
        tple = DelayedCall(seconds() + _seconds, _f, args, kw,
                           self._cancelCallLater,
                           self._moveCallLaterSooner)
        self._newTimedCalls.append(tple)
        return tple 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:13,代码来源:base.py

示例7: cancelCallLater

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorTime [as 别名]
def cancelCallLater(self, callID):
        """See twisted.internet.interfaces.IReactorTime.cancelCallLater.
        """
        # DO NOT DELETE THIS - this is documented in Python in a Nutshell, so we
        # we can't get rid of it for a long time.
        warnings.warn("reactor.cancelCallLater(callID) is deprecated - use callID.cancel() instead")
        callID.cancel() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:9,代码来源:base.py


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