W0613 unused-argument

Message

'Unused argument %r'

Description

Used when a function or method argument is not used.

Examples

def example(foo):
    return 1
1:12: W0613: Unused argument 'foo'

In the following example, we misspelled a variable name, leaving the real variable unused.

def example(foo):
    return boo
1:12: W0613: Unused argument 'foo'

How to fix

You can fix unused arguments that you need to have to be compatible with some other code in various ways:

# fix for positional arguments: prepend _
def example1(_foo):
    return 1

# fix for keyword args: catch into _
def example2(used_kw_arg=1, **_):
    return used_kw_arg + 1

# fix for a single keyword arg: delete it
def example2(used_kw_arg=1, another_kw_arg=2):
    del another_kw_arg
    return used_kw_arg + 1
No issues found.

Running Pylint locally? In your CI?

There is a better way! Run PyCodeQual & get Pylint findings with history, diffs and statistics.

Click here to find out more.