コード例 #1
0
ファイル: __init__.py プロジェクト: jeduden/callee
    def await_(self, coroutine):
        """Run given asynchronous coroutine to completion.
        This prevents a warning from being emitted when it goes out of scope.

        :param coroutine: A coroutine or a coroutine function
        """
        self.assertIsNotNone(
            asyncio, msg="Tried to use asyncio on unsupported Python version")

        loop = asyncio.new_event_loop()
        if asyncio.iscoroutinefunction(coroutine):
            coroutine = coroutine(loop)
        loop.run_until_complete(coroutine)
        loop.close()

        return coroutine
コード例 #2
0
ファイル: __init__.py プロジェクト: Xion/callee
    def await_(self, coroutine):
        """Run given asynchronous coroutine to completion.
        This prevents a warning from being emitted when it goes out of scope.

        :param coroutine: A coroutine or a coroutine function
        """
        self.assertIsNotNone(
            asyncio,
            msg="Tried to use asyncio on unsupported Python version")

        loop = asyncio.new_event_loop()
        if asyncio.iscoroutinefunction(coroutine):
            coroutine = coroutine(loop)
        loop.run_until_complete(coroutine)
        loop.close()

        return coroutine
コード例 #3
0
ファイル: functions.py プロジェクト: Xion/callee
 def match(self, value):
     return asyncio and asyncio.iscoroutinefunction(value)
コード例 #4
0
 def match(self, value):
     return asyncio and asyncio.iscoroutinefunction(value)