pylint icon indicating copy to clipboard operation
pylint copied to clipboard

`unexpected-keyword-arg` (E1123) and `missing-kwoa` (E1125) false positives with changing dict

Open ruro opened this issue 1 year ago • 0 comments

Bug description

# pylint: disable=missing-docstring


def target(*, right):
    del right


data = {"wrong": ...}

data.update({"right": ...})
# OR
# data["right"] = ...
# OR
# data.setdefault("right", ...)

data.pop("wrong")
# OR
# data.pop("wrong", None)
# OR
# del data["wrong"]

target(**data)

Command used

pylint example.py

Pylint output

************* Module example
example.py:22:0: E1123: Unexpected keyword argument 'wrong' in function call (unexpected-keyword-arg)
example.py:22:0: E1125: Missing mandatory keyword argument 'right' in function call (missing-kwoa)

Expected behavior

No errors.

Pylint version

pylint 3.0.3
astroid 3.0.3
Python 3.11.7 (main, Dec  4 2023, 18:10:11) [GCC 13.2.0]

ruro avatar Feb 08 '24 14:02 ruro