Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive (no-value-for-parameter) when chaining partial from functools #2462

Closed
JeremyVriens opened this issue Aug 31, 2018 · 4 comments
Labels
Bug 🪲 Needs astroid update Needs an astroid update (probably a release too) before being mergable

Comments

@JeremyVriens
Copy link

Background: when using partial from functools (which is a default function from Python3) multiple times in a chain, pylint doesn't recognise the previous defined value(s) for the current argument(s).

Steps to reproduce

  1. Make a new file animal.py
""" False positive demo for no-value-for-parameter """
from functools import partial

def animal(name, type_, legs):
    """ Prints 'name' is a 'type_' with 'legs' legs
    """
    print(f'{name} is a {type_} with {legs} legs')

MAMMAL = partial(animal, type_='mammal')
DOG = partial(MAMMAL, legs=4)

if __name__ == "__main__":
    DOG('Jake')

Jake is a mammal with 4 legs

  1. Run pylint animal.py

Current behavior

************* Module animal
animal.py:13:4: E1120: No value for argument 'type_' in function call (no-value-for-parameter)


Your code has been rated at 2.86/10 (previous run: 1.43/10, +1.43)

Expected behavior

The code should be rated at 10/10

pylint --version output

pylint 2.1.1
astroid 2.0.4
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]

@PCManticore
Copy link
Contributor

Thank you, I can reproduce the bug.

@bjtho08
Copy link

bjtho08 commented Nov 8, 2018

I have the same bug, but I'm not using any functools import.

@Pierre-Sassoulas Pierre-Sassoulas added the Needs astroid update Needs an astroid update (probably a release too) before being mergable label Oct 9, 2021
@JeremyVriens
Copy link
Author

This issue is no longer valid.

@Pierre-Sassoulas
Copy link
Member

I was curious so I bisected: it was fixed when we upgraded astroid to 2.8.0 in ca455ce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Needs astroid update Needs an astroid update (probably a release too) before being mergable
Projects
None yet
Development

No branches or pull requests

4 participants