Skip to content

Commit

Permalink
flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Jun 22, 2017
1 parent 80a6620 commit e49f007
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions devito/dle/backends/yask.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numbers
import os
import sys

Expand All @@ -10,7 +9,7 @@
from devito.dle import retrieve_iteration_tree
from devito.dle.backends import BasicRewriter, dle_pass
from devito.exceptions import CompilationError, DLEException
from devito.logger import debug, dle, dle_warning, error
from devito.logger import debug, dle, dle_warning
from devito.visitors import FindSymbols
from devito.tools import as_tuple

Expand Down Expand Up @@ -107,7 +106,7 @@ def __init__(self, name, shape, dimensions, dtype, buffer=None):
self.grid = YASK.setdefault(name)

# Always init the grid, at least with 0.0
self[:] = 0.0 if buffer is None else val
self[:] = 0.0 if buffer is None else buffer

def __getitem__(self, index):
# TODO: ATM, no MPI support.
Expand Down
20 changes: 10 additions & 10 deletions tests/test_yask.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,28 @@ def test_data_movement_nD():
u.data[0, 1, 1] = 1.
assert u.data[0, 0, 0] == 0.
assert u.data[0, 1, 1] == 1.
assert np.all(u.data == u.data[:,:,:])
assert np.all(u.data == u.data[:, :, :])
assert 1. in u.data[0]
assert 1. in u.data[0, 1]

# Test negative indices
assert u.data[0, -9, -9] == 1.
u.data[6,0,0] = 1.
assert u.data[-4,:,:].sum() == 1.
u.data[6, 0, 0] = 1.
assert u.data[-4, :, :].sum() == 1.

# Test setting whole array to given value
u.data[:] = 3.
assert np.all(u.data == 3.)

# Test insertion of single value into block
u.data[5,:,5] = 5.
assert np.all(u.data[5,:,5] == 5.)
u.data[5, :, 5] = 5.
assert np.all(u.data[5, :, 5] == 5.)

# Test insertion of block into block
block = np.ndarray(shape=(1, 10, 1), dtype=np.float32)
block.fill(4.)
u.data[4,:,4] = block
assert np.all(u.data[4,:,4] == block)
u.data[4, :, 4] = block
assert np.all(u.data[4, :, 4] == block)


def test_data_arithmetic_nD():
Expand All @@ -78,9 +78,9 @@ def test_data_arithmetic_nD():
# Increments and parital increments
u.data[:] += 2.
assert np.all(u.data == 3.)
u.data[9,:,:] += 1.
assert all(np.all(u.data[i,:,:] == 3.) for i in range(9))
assert np.all(u.data[9,:,:] == 4.)
u.data[9, :, :] += 1.
assert all(np.all(u.data[i, :, :] == 3.) for i in range(9))
assert np.all(u.data[9, :, :] == 4.)

# Right operations __rOP__
u.data[:] = 1.
Expand Down

0 comments on commit e49f007

Please sign in to comment.