1
0
forked from VimPlug/jedi

Resolve some **kwargs issues.

This commit is contained in:
Dave Halter
2014-09-22 23:06:22 +02:00
parent dae1a48d70
commit 6819deb404
2 changed files with 6 additions and 4 deletions

View File

@@ -176,7 +176,7 @@ class Array(use_metaclass(CachedMetaClass, IterableWrapper)):
key = key_expression_list[0]
if isinstance(key, pr.Literal):
key = key.value
elif isinstance(key, pr.Name):
elif isinstance(key, pr.NamePart):
key = str(key)
else:
continue

View File

@@ -1,9 +1,10 @@
import copy
from jedi._compatibility import unicode, zip_longest
from jedi import debug
from jedi import common
from jedi.parser import representation as pr
from jedi.evaluate import iterable
from jedi import common
from jedi.evaluate import helpers
from jedi.evaluate import analysis
@@ -294,7 +295,7 @@ def _iterate_star_args(evaluator, array, expression_list, func):
for field_stmt in array.iter_content():
yield helpers.FakeStatement([field_stmt])
elif isinstance(array, Instance) and array.name.get_code() == 'tuple':
pass
debug.warning('Ignored a tuple *args input %s' % array)
else:
if expression_list:
m = "TypeError: %s() argument after * must be a sequence, not %s" \
@@ -315,11 +316,12 @@ def _star_star_dict(evaluator, array, expression_list, func):
for key_stmt, value_stmt in array.items():
# first index, is the key if syntactically correct
call = key_stmt.expression_list()[0]
if isinstance(call, pr.Name):
if isinstance(call, pr.NamePart):
key = call
elif isinstance(call, pr.Call):
key = call.name
else:
debug.warning('Ignored complicated **kwargs stmt %s' % call)
continue # We ignore complicated statements here, for now.
# If the string is a duplicate, we don't care it's illegal Python