From 5c74019510f95599b87ba869a7b8efc71edcde23 Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Thu, 11 Apr 2019 12:01:14 +0100 Subject: fix fill method --- Wrappers/Python/ccpi/framework/BlockDataContainer.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Wrappers/Python/ccpi/framework/BlockDataContainer.py b/Wrappers/Python/ccpi/framework/BlockDataContainer.py index 9664037..13663c2 100755 --- a/Wrappers/Python/ccpi/framework/BlockDataContainer.py +++ b/Wrappers/Python/ccpi/framework/BlockDataContainer.py @@ -186,9 +186,14 @@ class BlockDataContainer(object): return self.clone() def clone(self): return type(self)(*[el.copy() for el in self.containers], shape=self.shape) - def fill(self, x): - for el,ot in zip(self.containers, x): - el.fill(ot) + def fill(self, other): + if isinstance (other, BlockDataContainer): + if not self.is_compatible(other): + raise ValueError('Incompatible containers') + for el,ot in zip(self.containers, other.containers): + el.fill(ot) + else: + return ValueError('Cannot fill with object provided {}'.format(type(other))) def __add__(self, other): return self.add( other ) -- cgit v1.2.3