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

Missing mandatory keyword argument (E1125) with explicit mandatory keywords and keyword dictionary #10029

Open
khpeterson opened this issue Oct 17, 2024 · 1 comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling

Comments

@khpeterson
Copy link

khpeterson commented Oct 17, 2024

Bug description

kwargs.py:

"""kwargs module"""

def fun(a,b,*,c,d,**kwargs):
    """function with kwargs"""
    return a + b + c + d + kwargs['e'] + kwargs['f']

someargs = {}
someargs['c'] = 3
someargs['d'] = 4
someargs['e'] = 5
someargs['f'] = 6
someargs['g'] = 7

rval = fun(1,2,**someargs)
print(rval)

Configuration

No response

Command used

(.venv-3.12) % ~/.venv-3.12/bin/pylint kwargs.py

Pylint output

************* Module kwargs
kwargs.py:14:7: E1125: Missing mandatory keyword argument 'c' in function call (missing-kwoa)
kwargs.py:14:7: E1125: Missing mandatory keyword argument 'd' in function call (missing-kwoa)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Expected behavior

No errors.

Pylint version

pylint 3.3.1
astroid 3.3.5
Python 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]

OS / Environment

macOS Sonoma 14.6.1
Terminal 2.14 (453)

Additional dependencies

No response

@khpeterson khpeterson added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 17, 2024
@khpeterson
Copy link
Author

FWIW, this is ok:

"""kwargs demo module"""

def fun(a,b,*,c,d,**kwargs):
    """function with kwargs"""
    return a + b + c + d + kwargs['e'] + kwargs['f']

def funfun(a,b,**kwargs):
    """another function with kwargs"""
    return fun(a,b,**kwargs)

someargs = {}
someargs['c'] = 3
someargs['d'] = 4
someargs['e'] = 5
someargs['f'] = 6
someargs['g'] = 7

rval = funfun(1,2,**someargs)
print(rval)

as is this:

"""kwargs demo module"""

def fun(a,b,*,c=None,d=None,**kwargs):
    """function with kwargs"""
    return a + b + c + d + kwargs['e'] + kwargs['f']

someargs = {}
someargs['c'] = 3
someargs['d'] = 4
someargs['e'] = 5
someargs['f'] = 6
someargs['g'] = 7

rval = fun(1,2,**someargs)
print(rval)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling
Projects
None yet
Development

No branches or pull requests

1 participant