How to use the pandarallel.utils.inliner.inline function in pandarallel

To help you get started, we’ve selected a few pandarallel 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 nalepae / pandarallel / tests / test_inliner.py View on Github external
return 4
            else:
                return 2 ** 3
        except ValueError:
            foo = 0
            for i in range(4):
                foo += i
            return foo
        except TypeError:
            return 42
        else:
            return 33
        finally:
            print("finished")

    inlined_func = inliner.inline(pre_func, func, dict(b="pretty", c="world!"))

    assert inliner.are_functions_equivalent(inlined_func, target_inlined_func)
github nalepae / pandarallel / pandarallel / pandarallel.py View on Github external
def wrapper(func):
        if progress_bar:
            wrapped_func = inline(
                progress_pre_func,
                func,
                dict(
                    queue=queue,
                    index=index,
                    counter=counter,
                    progression=PROGRESSION,
                    state=state,
                    time=time,
                ),
            )
            return wrapped_func

        return func