JulienPalard / Pipe

A Python library to use infix notation in Python
MIT License
1.95k stars 113 forks source link

pylint issue #70

Closed ckn12345 closed 2 years ago

ckn12345 commented 2 years ago

The code snipped from the readme produces an pylint error:

sum(range(100) | where(lambda x: x % 2 == 0))

No value for argument 'predicate' in function call pylint(no-value-for-parameter)

JulienPalard commented 2 years ago

Hi!

Thanks for reporting!!

I don't think pylint understands that where is not a function that takes two arguments but a Pipe instance, due to the presence of a decorator replacing it.

Issue should be opened pylint side with a simple reproducer, maybe like:

def partializer(const):
    def decorator(fct):
        def decorated(*args, **kwargs):
            return fct(const, *args, **kwargs)
        return decorated
    return decorator

@partializer(5)
def add_five(a, b):
    return a + b

print(add_five(5))
ckn12345 commented 2 years ago

Hi Julian,

Thanks for the quick reply. Will report this to the pylint team.

Thank you for your awesome library makes my code look so much cleaner and easier to read.

Best regard

Christian