-
Notifications
You must be signed in to change notification settings - Fork 8
Home
J.L Stevens edited this page Apr 6, 2015
·
3 revisions
The ViewFile
class has been removed. Here are some notes in case anyone
needs to use it again (i.e us!)
from holoviews.core.io import UnPickler
CustomFile(metadata_fn=lambda f: Unpickler.key(f),
data_fn = lambda f: {e: Unpickler.load(f, [e])
for e in Unpickler.entries(f)})
Note this will only work if all the hvz files have matching entries. Otherwise, you may use this simple data_fn:
data_fn = lambda f: {'data': Unpickler.load(f)}
The originalViewFile
definition made be found here
def path_formatter(path, max_len=15, max_components=None, ellipses='...'):
path = path.replace(os.path.expanduser("~"), '~')
root, basename = os.path.split(path)
split = [el for el in root.split(os.sep) if el != '']
max_components = max_components if max_components else float('inf')
components, total = [], 0
for i, el in enumerate(split):
if (total+len(el) > max_len) or i > max_components: break
total += len(el)
components.append(el)
return os.sep.join(components+[ellipses, basename]) if ellipses else None
E.g
value_dimensions=[Dimension(self.key, formatter=path_formatter)])