1
0
forked from VimPlug/jedi

Fix signature to_string

This commit is contained in:
Dave Halter
2019-07-03 23:44:58 -07:00
parent 947bfe7b78
commit ac492ef598
3 changed files with 33 additions and 6 deletions
+11 -4
View File
@@ -184,12 +184,19 @@ class ParamName(ParamNameInterface, AbstractTreeName):
return Parameter.VAR_KEYWORD
parent = tree_param.parent
param_appeared = False
for p in parent.children:
if p.type == 'param':
if p.star_count:
if param_appeared:
if p == '/':
return Parameter.POSITIONAL_ONLY
else:
if p == '*':
return Parameter.KEYWORD_ONLY
if p == tree_param:
break
if p.type == 'param':
if p.star_count:
return Parameter.KEYWORD_ONLY
if p == tree_param:
param_appeared = True
return Parameter.POSITIONAL_OR_KEYWORD
def to_string(self):
+4 -2
View File
@@ -25,8 +25,10 @@ class AbstractSignature(object):
yield '/'
is_positional = False
if kind == Parameter.KEYWORD_ONLY and not is_kw_only:
yield '*,'
if kind == Parameter.VAR_POSITIONAL:
is_kw_only = True
elif kind == Parameter.KEYWORD_ONLY and not is_kw_only:
yield '*'
is_kw_only = True
yield n.to_string()