Skip to content

Commit

Permalink
Some small refactorings to the names_dict/deep_ast_copy logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhalter committed Feb 12, 2015
1 parent 774b3d5 commit 4613a81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 7 additions & 3 deletions jedi/evaluate/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ def copy_node(obj):
except AttributeError:
pass
else:
new_obj.names_dict = new_names_dict = {}
for string, names in names_dict.items():
new_names_dict[string] = [new_elements[n] for n in names]
try:
new_obj.names_dict = new_names_dict = {}
except AttributeError: # Impossible to set CompFor.names_dict
pass
else:
for string, names in names_dict.items():
new_names_dict[string] = [new_elements[n] for n in names]
return new_obj

if obj.type == 'name':
Expand Down
4 changes: 1 addition & 3 deletions jedi/evaluate/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,7 @@ def get_return_types(self, check_yields=False):
return types

def names_dicts(self, search_global):
yield dict((k, [self._copy_dict[v] for v in values])
for k, values in self.base.names_dict.items())
#yield self.names_dict # Replace with this!
yield self.names_dict

@memoize_default(default=NO_DEFAULT)
def _get_params(self):
Expand Down
4 changes: 0 additions & 4 deletions jedi/parser/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,10 +1193,6 @@ def names_dict(self):
arr.append(name)
return dct

@names_dict.setter
def names_dict(self, value):
pass

def names_dicts(self, search_global):
yield self.names_dict

Expand Down

0 comments on commit 4613a81

Please sign in to comment.