Beispiel #1
0
def prepare_task_function(task_function: Function,
                          task_config: TaskConfig) -> DictFunction:
    if not is_async_function(task_function):
        task_function = asyncify(task_function)

    if task_config.single_value:
        task_function = convert_to_dict_function(task_function,
                                                 task_config.variable_name)
    return task_function
Beispiel #2
0
    def test_with_async_function(self):
        async def async_function():
            return 1

        assert async_tools.is_async_function(async_function)
Beispiel #3
0
def functions_are_all_async(functions: List[Callable]) -> bool:
    return all(
        [async_tools.is_async_function(function) for function in functions])
Beispiel #4
0
    def test_with_normal_function(self):
        def normal_function():
            return 1

        assert not async_tools.is_async_function(normal_function)