summaryrefslogtreecommitdiff
path: root/pylint/checkers/classes.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-10-11 11:33:33 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2019-10-11 11:33:33 +0200
commit15bae9fb1ed6f3f0f862ad4322ece56e94dcc48e (patch)
tree1cdf902729403ae6085669f26ccf0967e29cc939 /pylint/checkers/classes.py
parent3fc8c98d0fa64723a6671424bb6f0ccd30cef11a (diff)
downloadpylint-git-15bae9fb1ed6f3f0f862ad4322ece56e94dcc48e.tar.gz
Do not emit ``no-method-argument`` for functions using positional only args.
Close #3161
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r--pylint/checkers/classes.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py
index 986809fd3..9f5d09943 100644
--- a/pylint/checkers/classes.py
+++ b/pylint/checkers/classes.py
@@ -1460,7 +1460,12 @@ a metaclass class method.",
# don't care about functions with unknown argument (builtins)
if node.args.args is None:
return
- first_arg = node.args.args and node.argnames()[0]
+ if node.args.args:
+ first_arg = node.argnames()[0]
+ elif node.args.posonlyargs:
+ first_arg = node.args.posonlyargs[0].name
+ else:
+ first_arg = None
self._first_attrs.append(first_arg)
first = self._first_attrs[-1]
# static method
@@ -1474,7 +1479,7 @@ a metaclass class method.",
return
self._first_attrs[-1] = None
# class / regular method with no args
- elif not node.args.args:
+ elif not node.args.args and not node.args.posonlyargs:
self.add_message("no-method-argument", node=node)
# metaclass
elif metaclass: