diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-04-11 12:01:14 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-04-11 12:01:14 +0100 |
commit | 5c74019510f95599b87ba869a7b8efc71edcde23 (patch) | |
tree | 2f618499b81eb1d7384d2d0c4fbf04c9ee7eded4 | |
parent | da02e629dcd85b2dc1e06a4a8d8bff973fc70a88 (diff) | |
download | framework-5c74019510f95599b87ba869a7b8efc71edcde23.tar.gz framework-5c74019510f95599b87ba869a7b8efc71edcde23.tar.bz2 framework-5c74019510f95599b87ba869a7b8efc71edcde23.tar.xz framework-5c74019510f95599b87ba869a7b8efc71edcde23.zip |
fix fill method
-rwxr-xr-x | Wrappers/Python/ccpi/framework/BlockDataContainer.py | 11 |
1 files 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 )
|