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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return result

    run_async(f())
Exemple #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())
Exemple #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())
Exemple #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())
Exemple #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())
Exemple #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
Exemple #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
Exemple #17
0
def simpleFunction5():
    run_async(ClassWithAsyncMethod().async_method())
Exemple #18
0
def simpleFunction2():
    async def someCoroutine():
        return 7

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

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

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

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

    run_async(foo())