Commit 1eb7f754 authored by ultimanet's avatar ultimanet
Browse files

Removed the `inject` method as `set_data` is able to handle this task completely.

Extended the d2o docstrings.
parent 800f4e4a
......@@ -1204,7 +1204,9 @@ class point_space(space):
if to_copy:
temp = x.copy_empty(dtype=dtype,
distribution_strategy=self.datamodel)
temp.inject((slice(None),), x, (slice(None),))
temp.set_data(to_key=(slice(None),),
data=x,
from_key=(slice(None),))
temp.hermitian = x.hermitian
x = temp
......
This diff is collapsed.
......@@ -64,8 +64,8 @@ def _hermitianize_inverter(x):
slice_inverter[i] = slice(None, 0, -1)
try:
y.inject(to_key=slice_picker, data=y,
from_key=slice_inverter)
y.set_data(to_key=slice_picker, data=y,
from_key=slice_inverter)
except(AttributeError):
y[slice_picker] = y[slice_inverter]
return y
......
......@@ -1025,7 +1025,7 @@ class Test_non_local_keys(unittest.TestCase):
###############################################################################
###############################################################################
class Test_inject(unittest.TestCase):
class Test_set_data_via_injection(unittest.TestCase):
@parameterized.expand(
itertools.product([
......@@ -1048,7 +1048,7 @@ class Test_inject(unittest.TestCase):
],
all_distribution_strategies
), testcase_func_name=custom_name_func)
def test_inject(self, (global_shape_1, slice_tuple_1,
def test_set_data_via_injection(self, (global_shape_1, slice_tuple_1,
global_shape_2, slice_tuple_2),
distribution_strategy):
dtype = np.dtype('float')
......@@ -1058,7 +1058,7 @@ class Test_inject(unittest.TestCase):
(b, p) = generate_data(global_shape_2, dtype,
distribution_strategy)
obj.inject(to_key=slice_tuple_1,
obj.set_data(to_key=slice_tuple_1,
data=p,
from_key=slice_tuple_2)
a[slice_tuple_1] = b[slice_tuple_2]
......@@ -1272,7 +1272,7 @@ class Test_unary_and_binary_operations(unittest.TestCase):
global_shape,
np.dtype('complex'),
distribution_strategy=stored_distribution_strategy)
p.inject((slice(None),), a, (slice(None),))
p.set_data(from_key=(slice(None),), data=a, to_key=(slice(None),))
obj = p
assert_equal(obj.isreal().get_full_data(), np.isreal(a))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment