-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 for unexpected-keyword-arg
for decorators with inner inner function
#5784
Labels
Decorators
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Comments
martimlobao
added
the
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
label
Feb 9, 2022
See #5547 for additional context |
DanielNoord
changed the title
false positive
False positive for Feb 9, 2022
unexpected-keyword-arg
for decorators with inner inner function
DanielNoord
added
False Positive 🦟
A message is emitted but nothing is wrong with the code
Decorators
and removed
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
labels
Feb 9, 2022
Pierre-Sassoulas
added
the
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
label
Jul 6, 2022
3 tasks
Unsure if this is a true solution, but perhaps related: #8332 |
Have the same problem. Here's a very simplified version of the code that displays this error: def clean_html(html):
elements_to_delete = [
{"search_term": "footer", "delete_after": True}
]
for etd in elements_to_delete:
search_term = etd.pop("search_term", None)
elements = html.find_all(search_term)
html = delete_elements(html, elements, **etd)
# ... rest of the code This is the error I get: html = delete_elements(html, elements, **etd)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Pylint: Unexpected keyword argument 'search_term' in function call BTW: This is the function definition of the def delete_elements(html, elements=[], delete_before=False, delete_after=False):
# some code to delete html elements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Decorators
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Bug description
Just tried this out with the latest version of the main branch (any version after bfeca4c) and there seems to be a case where #5547 is still raising a false positive unexpected-keyword-arg error.
(Note that no error is raised by pylint if we remove the top-level function (
example_decorator
). The reason for someone to define the decorator this way is so that it's possible to use the bare@example_decorator
, as well as with arguments@example_decorator(foo=1)
.)Using pylint on commit hash e75e37a, this is the error that's printed out:
Calling
example_func
works fine:Command used
Pylint output
Expected behavior
No
unexpected-keyword-arg
error raisedPylint version
The text was updated successfully, but these errors were encountered: