當前位置: 首頁>>代碼示例>>Python>>正文


Python asyncio.AsyncIOLoop方法代碼示例

本文整理匯總了Python中tornado.platform.asyncio.AsyncIOLoop方法的典型用法代碼示例。如果您正苦於以下問題:Python asyncio.AsyncIOLoop方法的具體用法?Python asyncio.AsyncIOLoop怎麽用?Python asyncio.AsyncIOLoop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado.platform.asyncio的用法示例。


在下文中一共展示了asyncio.AsyncIOLoop方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_new_ioloop

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def get_new_ioloop(self):
        io_loop = AsyncIOLoop()
        asyncio.set_event_loop(io_loop.asyncio_loop)
        return io_loop 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:6,代碼來源:asyncio_test.py

示例2: configure

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def configure(
        cls, impl: "Union[None, str, Type[Configurable]]", **kwargs: Any
    ) -> None:
        if asyncio is not None:
            from tornado.platform.asyncio import BaseAsyncIOLoop

            if isinstance(impl, str):
                impl = import_object(impl)
            if isinstance(impl, type) and not issubclass(impl, BaseAsyncIOLoop):
                raise RuntimeError(
                    "only AsyncIOLoop is allowed when asyncio is available"
                )
        super(IOLoop, cls).configure(impl, **kwargs) 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:15,代碼來源:ioloop.py

示例3: configurable_default

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def configurable_default(cls) -> Type[Configurable]:
        from tornado.platform.asyncio import AsyncIOLoop

        return AsyncIOLoop 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:6,代碼來源:ioloop.py

示例4: configure

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def configure(cls, impl, **kwargs):
        if asyncio is not None:
            from tornado.platform.asyncio import BaseAsyncIOLoop

            if isinstance(impl, (str, unicode_type)):
                impl = import_object(impl)
            if not issubclass(impl, BaseAsyncIOLoop):
                raise RuntimeError(
                    "only AsyncIOLoop is allowed when asyncio is available")
        super(IOLoop, cls).configure(impl, **kwargs) 
開發者ID:tp4a,項目名稱:teleport,代碼行數:12,代碼來源:ioloop.py

示例5: configurable_default

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def configurable_default(cls):
        if asyncio is not None:
            from tornado.platform.asyncio import AsyncIOLoop
            return AsyncIOLoop
        return PollIOLoop 
開發者ID:tp4a,項目名稱:teleport,代碼行數:7,代碼來源:ioloop.py

示例6: get_new_ioloop

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def get_new_ioloop(self):
        io_loop = AsyncIOLoop()
        return io_loop 
開發者ID:tp4a,項目名稱:teleport,代碼行數:5,代碼來源:asyncio_test.py

示例7: setUp

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def setUp(self):
        # Trigger a cleanup of the mapping so we start with a clean slate.
        AsyncIOLoop().close()
        # If we don't clean up after ourselves other tests may fail on
        # py34.
        self.orig_policy = asyncio.get_event_loop_policy()
        asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy()) 
開發者ID:tp4a,項目名稱:teleport,代碼行數:9,代碼來源:asyncio_test.py

示例8: test_ioloop_close_leak

# 需要導入模塊: from tornado.platform import asyncio [as 別名]
# 或者: from tornado.platform.asyncio import AsyncIOLoop [as 別名]
def test_ioloop_close_leak(self):
        orig_count = len(IOLoop._ioloop_for_asyncio)
        for i in range(10):
            # Create and close an AsyncIOLoop using Tornado interfaces.
            loop = AsyncIOLoop()
            loop.close()
        new_count = len(IOLoop._ioloop_for_asyncio) - orig_count
        self.assertEqual(new_count, 0) 
開發者ID:tp4a,項目名稱:teleport,代碼行數:10,代碼來源:asyncio_test.py


注:本文中的tornado.platform.asyncio.AsyncIOLoop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。