From 5a050bb5a35d8430edfef3827d2d0756d5019203 Mon Sep 17 00:00:00 2001 From: marco cammarata Date: Sun, 5 Mar 2017 22:12:08 +0100 Subject: [PATCH] improved string representation when finding list of arrays --- storage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage.py b/storage.py index b3f2d06..1e632fc 100644 --- a/storage.py +++ b/storage.py @@ -239,14 +239,14 @@ class DataStorage(dict): for k in keys: if k[0] == "_": continue obj = self[k] - if isinstance(obj,np.ndarray): + if isinstance(obj,(list,tuple,np.ndarray)) and all( [isinstance(v,np.ndarray) for v in obj]): + value_str = "list of arrays, shapes " + ",".join([str(v.shape) for v in obj[:5]]) + " ..." + elif isinstance(obj,np.ndarray): value_str = "array, size %s, type %s"% ("x".join(map(str,obj.shape)),obj.dtype) elif isinstance(obj,DataStorage): value_str = str(obj)[:50] elif isinstance(obj,(str,DataStorage)): value_str = obj[:50] - elif isinstance(obj,(list,tuple)) and all( [isinstance(v,np.ndarray) for v in obj]): - value_str = "list of arrays, shapes " + ",".join([str(v.shape) for v in obj[:5]]) + " ..." elif self[k] is None: value_str = "None" else: