How to use the jishaku.functools.executor_function function in jishaku

To help you get started, we’ve selected a few jishaku examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Gorialis / jishaku / tests / test_executorfunc.py View on Github external
def test_magic_executor(args, kwargs, expected_return):
    loop = asyncio.get_event_loop()

    def non_executor(a, b=None, *, c) -> tuple:
        return a, b, c

    exact_executor = executor_function(non_executor)

    @executor_function
    def redefined_executor(a, b=None, *, c) -> tuple:
        return a, b, c

    assert inspect.signature(non_executor) == inspect.signature(exact_executor)
    assert inspect.signature(non_executor) == inspect.signature(redefined_executor)

    assert non_executor(*args, **kwargs) == expected_return
    assert loop.run_until_complete(exact_executor(*args, **kwargs)) == expected_return
    assert loop.run_until_complete(redefined_executor(*args, **kwargs)) == expected_return
github Gorialis / jishaku / tests / test_executorfunc.py View on Github external
    @executor_function
    def redefined_executor(a, b=None, *, c) -> tuple:
        return a, b, c