Skip to content

Commit

Permalink
dak.Array copy-able (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis authored Jul 20, 2023
1 parent 1a760d5 commit cf2fc37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dask_awkward/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ def __dir__(self) -> list[str]:
)
)

def __reduce__(self):
return (Array, (self.dask, self.name, self._meta, self.divisions))

@property
def dask(self) -> HighLevelGraph:
"""High level task graph associated with the collection."""
Expand Down
6 changes: 6 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import copy
from collections import namedtuple
from typing import TYPE_CHECKING, Any

Expand Down Expand Up @@ -806,3 +807,8 @@ def test_dask_array_in_map_partitions(daa, caa):
y2 = np.ones(len(x2))
z2 = x2 + y2
assert_eq(z1, z2)


def test_dask_awkward_Array_copy(daa):
c = copy.copy(daa)
assert_eq(daa, c)

0 comments on commit cf2fc37

Please sign in to comment.