From 3027c9b9dc725d659b1219a5577ce6ad06db63f7 Mon Sep 17 00:00:00 2001 From: Kirsty McNaught Date: Sat, 3 Mar 2018 19:24:00 +0000 Subject: [PATCH] Add numpy-shape decorator. --- pyclub_libs/logging/debug_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pyclub_libs/logging/debug_utils.py b/pyclub_libs/logging/debug_utils.py index 525abcb..2aa5787 100644 --- a/pyclub_libs/logging/debug_utils.py +++ b/pyclub_libs/logging/debug_utils.py @@ -107,3 +107,16 @@ class log_all_variables_type(log_all_variables): def __init__(self): self.var_prop = type + +def numpy_shape(x): + if type(x).__module__ =='numpy': + return 'shape{}'.format(x.shape) + else: + return '[{}]'.format(type(x)) + + +class log_all_variables_numpy_shape(log_all_variables): + def __init__(self): + self.var_prop = numpy_shape + +