forked from VimPlug/jedi
dict assignment renaming -> fixes #20
This commit is contained in:
+18
-2
@@ -361,6 +361,19 @@ def related_names(definitions, search_name, mods):
|
|||||||
if not definitions:
|
if not definitions:
|
||||||
return set()
|
return set()
|
||||||
|
|
||||||
|
def is_definition(arr):
|
||||||
|
try:
|
||||||
|
for a in arr:
|
||||||
|
assert len(a) == 1
|
||||||
|
a = a[0]
|
||||||
|
if a.isinstance(parsing.Array):
|
||||||
|
assert is_definition(a)
|
||||||
|
elif a.isinstance(parsing.Call):
|
||||||
|
assert a.execution is None
|
||||||
|
return True
|
||||||
|
except AssertionError:
|
||||||
|
return False
|
||||||
|
|
||||||
mods |= set([d.get_parent_until() for d in definitions])
|
mods |= set([d.get_parent_until() for d in definitions])
|
||||||
names = []
|
names = []
|
||||||
for m in get_directory_modules_for_name(mods, search_name):
|
for m in get_directory_modules_for_name(mods, search_name):
|
||||||
@@ -388,8 +401,11 @@ def related_names(definitions, search_name, mods):
|
|||||||
if set(f) & set(definitions):
|
if set(f) & set(definitions):
|
||||||
names.append(RelatedName(name_part, stmt))
|
names.append(RelatedName(name_part, stmt))
|
||||||
else:
|
else:
|
||||||
ass = stmt.get_assignment_calls()
|
calls = _scan_array(stmt.get_assignment_calls(), search_name)
|
||||||
for call in _scan_array(ass, search_name):
|
for d in stmt.assignment_details:
|
||||||
|
if not is_definition(d[1]):
|
||||||
|
calls += _scan_array(d[1], search_name)
|
||||||
|
for call in calls:
|
||||||
names += check_call(call)
|
names += check_call(call)
|
||||||
return names
|
return names
|
||||||
|
|
||||||
|
|||||||
@@ -86,3 +86,14 @@ from import_tree.rename1 import abc
|
|||||||
|
|
||||||
#< (88, 32),
|
#< (88, 32),
|
||||||
from import_tree.rename1 import not_existing
|
from import_tree.rename1 import not_existing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
response = HttpResponse(mimetype='application/pdf')
|
||||||
|
response['Content-Disposition'] = 'attachment; filename=%s.pdf' % id
|
||||||
|
response.write(pdf)
|
||||||
|
#< (95, 0), (96, 0), (97, 0), (99, 0)
|
||||||
|
response
|
||||||
|
|||||||
Reference in New Issue
Block a user