Skip to content

Commit

Permalink
split_blocks: Fix dimension checks.
Browse files Browse the repository at this point in the history
Make dimensions checks of the shape, block shape, and halo shape proper
`ValueError`s instead of being assertions.
  • Loading branch information
jakirkham committed Dec 4, 2016
1 parent e94ca4d commit bd6c82d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions kenjutsu/kenjutsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,17 @@ def split_blocks(space_shape, block_shape, block_halo=None):
ifilter, imap = filter, map

if block_halo is not None:
assert (len(space_shape) == len(block_shape) == len(block_halo)), \
"The dimensions of `space_shape`, `block_shape`, and " + \
"`block_halo` should be the same."
if not (len(space_shape) == len(block_shape) == len(block_halo)):
raise ValueError(
"The dimensions of `space_shape`, `block_shape`, and"
" `block_halo` should be the same."
)
else:
assert (len(space_shape) == len(block_shape)), \
"The dimensions of `space_shape` and `block_shape` " + \
"should be the same."
if not (len(space_shape) == len(block_shape)):
raise ValueError(
"The dimensions of `space_shape` and `block_shape` should be"
" the same."
)

block_halo = tuple()
for i in irange(len(space_shape)):
Expand Down

0 comments on commit bd6c82d

Please sign in to comment.