From e7d495cf2c5d19896d069da299093a854243f134 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 17 Aug 2015 23:14:18 +0800 Subject: [PATCH] gui/tools: better detection of scalar types --- artiq/gui/tools.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/artiq/gui/tools.py b/artiq/gui/tools.py index da94ae7e7..04476b25d 100644 --- a/artiq/gui/tools.py +++ b/artiq/gui/tools.py @@ -22,19 +22,11 @@ def elide(s, maxlen): return s -_scalar_types = { - int, float, - np.int8, np.int16, np.int32, np.int64, - np.uint8, np.uint16, np.uint32, np.uint64, - np.float16, np.float32, np.float64 -} - - def short_format(v): if v is None: return "None" t = type(v) - if t in _scalar_types: + if np.issubdtype(t, int) or np.issubdtype(t, float): return str(v) elif t is str: return "\"" + elide(v, 15) + "\""