mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 17:35:22 +08:00
Resolve some **kwargs issues.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user