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
+1 -1
View File
@@ -176,7 +176,7 @@ class Array(use_metaclass(CachedMetaClass, IterableWrapper)):
key = key_expression_list[0] key = key_expression_list[0]
if isinstance(key, pr.Literal): if isinstance(key, pr.Literal):
key = key.value key = key.value
elif isinstance(key, pr.Name): elif isinstance(key, pr.NamePart):
key = str(key) key = str(key)
else: else:
continue continue
+5 -3
View File
@@ -1,9 +1,10 @@
import copy import copy
from jedi._compatibility import unicode, zip_longest from jedi._compatibility import unicode, zip_longest
from jedi import debug
from jedi import common
from jedi.parser import representation as pr from jedi.parser import representation as pr
from jedi.evaluate import iterable from jedi.evaluate import iterable
from jedi import common
from jedi.evaluate import helpers from jedi.evaluate import helpers
from jedi.evaluate import analysis 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(): for field_stmt in array.iter_content():
yield helpers.FakeStatement([field_stmt]) yield helpers.FakeStatement([field_stmt])
elif isinstance(array, Instance) and array.name.get_code() == 'tuple': elif isinstance(array, Instance) and array.name.get_code() == 'tuple':
pass debug.warning('Ignored a tuple *args input %s' % array)
else: else:
if expression_list: if expression_list:
m = "TypeError: %s() argument after * must be a sequence, not %s" \ 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(): for key_stmt, value_stmt in array.items():
# first index, is the key if syntactically correct # first index, is the key if syntactically correct
call = key_stmt.expression_list()[0] call = key_stmt.expression_list()[0]
if isinstance(call, pr.Name): if isinstance(call, pr.NamePart):
key = call key = call
elif isinstance(call, pr.Call): elif isinstance(call, pr.Call):
key = call.name key = call.name
else: else:
debug.warning('Ignored complicated **kwargs stmt %s' % call)
continue # We ignore complicated statements here, for now. continue # We ignore complicated statements here, for now.
# If the string is a duplicate, we don't care it's illegal Python # If the string is a duplicate, we don't care it's illegal Python