Skip to content

Commit

Permalink
Merge pull request #1665 from braingram/np_core
Browse files Browse the repository at this point in the history
use np.memmap instead of np.core.memmap
  • Loading branch information
braingram authored Oct 26, 2023
2 parents aca944a + 81f9366 commit 46aa0e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions asdf/_tests/test_generic_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_read_fd():

with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
assert len(ff._blocks.blocks) == 2
assert isinstance(ff._blocks.blocks[0].cached_data, np.core.memmap)
assert isinstance(ff._blocks.blocks[0].cached_data, np.memmap)


def test_open2(tree, tmp_path):
Expand All @@ -135,7 +135,7 @@ def get_read_fd():

with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
assert len(ff._blocks.blocks) == 2
assert isinstance(ff._blocks.blocks[0].cached_data, np.core.memmap)
assert isinstance(ff._blocks.blocks[0].cached_data, np.memmap)


@pytest.mark.parametrize("mode", ["r", "w", "rw"])
Expand Down Expand Up @@ -172,7 +172,7 @@ def get_read_fd():

with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
assert len(ff._blocks.blocks) == 2
assert isinstance(ff._blocks.blocks[0].cached_data, np.core.memmap)
assert isinstance(ff._blocks.blocks[0].cached_data, np.memmap)
ff.tree["science_data"][0] = 42


Expand Down Expand Up @@ -208,7 +208,7 @@ def get_read_fd():

with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
assert len(ff._blocks.blocks) == 2
assert not isinstance(ff._blocks.blocks[0].cached_data, np.core.memmap)
assert not isinstance(ff._blocks.blocks[0].cached_data, np.memmap)
ff.tree["science_data"][0] = 42


Expand All @@ -224,7 +224,7 @@ def get_read_fd():

with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
assert len(ff._blocks.blocks) == 2
assert not isinstance(ff._blocks.blocks[0].cached_data, np.core.memmap)
assert not isinstance(ff._blocks.blocks[0].cached_data, np.memmap)
ff.tree["science_data"][0] = 42


Expand Down Expand Up @@ -252,7 +252,7 @@ def get_read_fd():

with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
assert len(ff._blocks.blocks) == 2
assert not isinstance(ff._blocks.blocks[0].cached_data, np.core.memmap)
assert not isinstance(ff._blocks.blocks[0].cached_data, np.memmap)


@pytest.mark.remote_data()
Expand Down
6 changes: 3 additions & 3 deletions asdf/generic_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def clear(self, nbytes):

def memmap_array(self, offset, size):
"""
Memmap a chunk of the file into a `np.core.memmap` object.
Memmap a chunk of the file into a `np.memmap` object.
Parameters
----------
Expand All @@ -649,7 +649,7 @@ def memmap_array(self, offset, size):
Returns
-------
array : np.core.memmap
array : np.memmap
"""
msg = f"memmapping is not implemented for {self.__class__.__name__}"
raise NotImplementedError(msg)
Expand Down Expand Up @@ -680,7 +680,7 @@ def read_into_array(self, size):
Returns
-------
array : np.core.memmap
array : np.memmap
"""
buff = self.read(size)
return np.frombuffer(buff, np.uint8, size, 0)
Expand Down

0 comments on commit 46aa0e2

Please sign in to comment.