From c3c16169b5b810247521b5c96fab0d9058844a34 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 9 Jun 2019 22:55:27 +0200 Subject: [PATCH] Ignore positional only arguments slash when listing params --- parso/python/tree.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parso/python/tree.py b/parso/python/tree.py index 5dcf5b3..4cc7c92 100644 --- a/parso/python/tree.py +++ b/parso/python/tree.py @@ -548,7 +548,8 @@ def _create_params(parent, argslist_list): if param_children[0] == '*' \ and (len(param_children) == 1 or param_children[1] == ',') \ - or check_python2_nested_param(param_children[0]): + or check_python2_nested_param(param_children[0]) \ + or param_children[0] == '/': for p in param_children: p.parent = parent new_children += param_children @@ -1161,6 +1162,13 @@ class Param(PythonBaseNode): index -= 2 except ValueError: pass + try: + keyword_only_index = self.parent.children.index('/') + if index > keyword_only_index: + # Skip the ` /, ` + index -= 2 + except ValueError: + pass return index - 1 def get_parent_function(self):