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


Python error.ReactorAlreadyInstalledError方法代码示例

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


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

示例1: installReactor

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ReactorAlreadyInstalledError [as 别名]
def installReactor(reactor):
    """
    Install reactor C{reactor}.

    @param reactor: An object that provides one or more IReactor* interfaces.
    """
    # this stuff should be common to all reactors.
    import twisted.internet
    import sys
    if 'twisted.internet.reactor' in sys.modules:
        raise error.ReactorAlreadyInstalledError("reactor already installed")
    twisted.internet.reactor = reactor
    sys.modules['twisted.internet.reactor'] = reactor 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:15,代码来源:main.py

示例2: test_alreadyInstalled

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ReactorAlreadyInstalledError [as 别名]
def test_alreadyInstalled(self):
        """
        If a reactor is already installed, L{installReactor} raises
        L{ReactorAlreadyInstalledError}.
        """
        with NoReactor():
            installReactor(object())
            self.assertRaises(ReactorAlreadyInstalledError, installReactor,
                              object()) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:11,代码来源:test_main.py

示例3: test_errorIsAnAssertionError

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ReactorAlreadyInstalledError [as 别名]
def test_errorIsAnAssertionError(self):
        """
        For backwards compatibility, L{ReactorAlreadyInstalledError} is an
        L{AssertionError}.
        """
        self.assertTrue(issubclass(ReactorAlreadyInstalledError,
                        AssertionError)) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:9,代码来源:test_main.py

示例4: install_reactor

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ReactorAlreadyInstalledError [as 别名]
def install_reactor():
    from twisted.internet import gtk3reactor
    from twisted.internet.error import ReactorAlreadyInstalledError
    try:
        # needed for GLib.idle_add, and signals
        gtk3reactor.install()
    except ReactorAlreadyInstalledError:
        pass 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:10,代码来源:start.py

示例5: test_alreadyInstalled

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ReactorAlreadyInstalledError [as 别名]
def test_alreadyInstalled(self):
        """
        If a reactor is already installed, L{installReactor} raises
        L{ReactorAlreadyInstalledError}.
        """
        # Because this test runs in trial, assume a reactor is already
        # installed.
        self.assertRaises(ReactorAlreadyInstalledError, installReactor,
                          object()) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:11,代码来源:test_main.py

示例6: init_asyncio_reactor

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ReactorAlreadyInstalledError [as 别名]
def init_asyncio_reactor():
    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
    try:
        asyncioreactor.install()
    except error.ReactorAlreadyInstalledError:
        pass 
开发者ID:maas,项目名称:maas,代码行数:8,代码来源:scripts.py


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