예제 #1
0
def simpleFunction4():
    async def someCoroutine():
        raise StopIteration

    try:
        run_async(someCoroutine())
    except RuntimeError:
        pass
예제 #2
0
def simpleFunction4():
    async def foo():
        raise StopIteration

    try:
        run_async(foo())
    except RuntimeError:
        pass
예제 #3
0
def simpleFunction4():
    async def foo():
        raise StopIteration

    try:
        run_async(foo())
    except RuntimeError:
        pass
예제 #4
0
def simpleFunction7():
    async def foo():
        async for i in BadAsyncIter():
            print('never going to happen')

    try:
        run_async(foo())
    except TypeError:
        pass
예제 #5
0
def simpleFunction7():
    async def someCoroutine():
        async for _i in BadAsyncIter():
            print("never going to happen")

    try:
        run_async(someCoroutine())
    except TypeError:
        pass
예제 #6
0
def simpleFunction8():
    async def someCoroutine():
        return ("some", "thing")

    @types.coroutine
    def someDecoratorCoroutine():
        yield from someCoroutine()

    run_async(someDecoratorCoroutine())
예제 #7
0
def simpleFunction8():
    async def bar():
        return ("some", "thing")

    @types.coroutine
    def foo():
        yield from bar()

    run_async(foo())
예제 #8
0
def simpleFunction7():
    async def foo():
        async for i in BadAsyncIter():
            print('never going to happen')

    try:
        run_async(foo())
    except TypeError:
        pass
예제 #9
0
def simpleFunction8():
    async def bar():
        return ("some", "thing")

    @types.coroutine
    def foo():
        yield from bar()

    run_async(foo())
예제 #10
0
def simpleFunction3():
    async def f():
        result = []

        async for letter in AsyncIteratorWrapper("abcdefg"):
            result.append(letter)

        return result

    run_async(f())
예제 #11
0
def simpleFunction3():
    async def f():
        result = []

        # Python 3.5 before 3.2 won't allow this.
        try:
            async for letter in AsyncIteratorWrapper("abcdefg"):
                result.append(letter)
        except TypeError:
            assert sys.version_info < (3,5,2)

        return result

    run_async(f())
예제 #12
0
def simpleFunction3():
    async def f():
        result = []

        # Python 3.5 before 3.2 won't allow this.
        try:
            async for letter in AsyncIteratorWrapper("abcdefg"):
                result.append(letter)
        except TypeError:
            assert sys.version_info < (3, 5, 2)

        return result

    run_async(f())
예제 #13
0
def simpleFunction3():
    def to_list(gen):
        async def iterate():
            res = []
            async for i in gen:
                res.append(i)
            return res

        return run_until_complete(iterate())

    async def run2():
        return to_list(gen2())

    run_async(run2())
예제 #14
0
def simpleFunction3():
    def to_list(gen):
        async def iterate():
            res = []
            async for i in gen:
                res.append(i)
            return res

        return run_until_complete(iterate())


    async def run2():
        return to_list(gen2())

    run_async(run2())
예제 #15
0
def simpleFunction1():
    async def gen1():
        try:
            yield
        except:  # pylint: disable=bare-except
            pass

    async def run():
        g = gen1()
        await g.asend(None)
        await g.asend(None)

    try:
        run_async(run())
    except StopAsyncIteration:
        pass
예제 #16
0
def simpleFunction1():
    async def gen1():
        try:
            yield
        except:
            pass

    async def run():
            g = gen1()
            await g.asend(None)
            await g.asend(None)

    try:
        run_async(run())
    except StopAsyncIteration:
        pass
예제 #17
0
def simpleFunction5():
    run_async(ClassWithAsyncMethod().async_method())
예제 #18
0
def simpleFunction2():
    async def someCoroutine():
        return 7

    run_async(someCoroutine())
예제 #19
0
def simpleFunction1():
    async def foo():
        return

    run_async(foo())
예제 #20
0
def simpleFunction2():
    async def foo():
        return 7

    run_async(foo())
예제 #21
0
def simpleFunction5():
    run_async(ClassWithAsyncMethod().async_method())
예제 #22
0
def simpleFunction2():
    async def foo():
        return 7

    run_async(foo())
예제 #23
0
def simpleFunction1():
    async def foo():
        return

    run_async(foo())