Skip to content

Commit

Permalink
Fixed application of function to self in LabelledData.map method
Browse files Browse the repository at this point in the history
The old code would lose the application of the map function to self for
deep indexable objects. This fix now means that id values are properly
propagated via the map method.
  • Loading branch information
jlstevens committed Jun 25, 2015
1 parent 2ce2ad6 commit 187cc11
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,15 @@ def map(self, map_fn, specs=None, clone=True):
specification applies.
"""
applies = specs is None or any(self.matches(spec) for spec in specs)
mapped = map_fn(self) if applies else self

if self._deep_indexable:
deep_mapped = mapped.clone(shared_data=False) if clone else mapped
for k, v in mapped.items():
deep_mapped = self.clone(shared_data=False) if clone else self
for k, v in self.items():
deep_mapped[k] = v.map(map_fn, specs, clone)
if applies: deep_mapped = map_fn(deep_mapped)
return deep_mapped
else:
return mapped
return map_fn(self) if applies else self


def __getstate__(self):
Expand Down

0 comments on commit 187cc11

Please sign in to comment.