best-doctor / Mario

Shaping your business logic in Python
MIT License
17 stars 2 forks source link

Wrong function arguments collect #18

Closed mcproger closed 4 years ago

mcproger commented 4 years ago

From inspect module docs:

co_varnames returns tuple of names of arguments and local variables

We use it to collect pipe arguments here

We should find another way to do it.

mcproger commented 4 years ago

Well, we can fix it using inspect.signature instead of foo.__code__.co_varnames. We should update get_pipe_args method in base_pipeline.py like this:

from inspect import signature

def get_pipe_args(self, pipe_callable) -> ImmutableContext:
    pipe_signature = signature(pipe_callable.__func__)
    pipe_args_names = pipe_signature.parameters.keys()
    return {a: self.__context__[a] for a in pipe_args_names}

I will implement it as soon as possible.