Skip to content

Commit

Permalink
Merge branch 'main' into agoose77/feat-add-attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Nov 14, 2023
2 parents 7966140 + fa07194 commit 37f11ca
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.1
rev: 23.11.0
hooks:
- id: black
language_version: python3
Expand All @@ -24,7 +24,7 @@ repos:
- --target-version=py312

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
rev: v0.1.5
hooks:
- id: ruff

Expand Down Expand Up @@ -59,7 +59,7 @@ repos:
- black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.7.0
hooks:
- id: mypy
args: [--ignore-missing-imports]
Expand Down
13 changes: 12 additions & 1 deletion src/dask_awkward/lib/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import builtins
import warnings
from collections.abc import Iterable, Mapping, Sequence
from copy import deepcopy
from numbers import Number
from typing import TYPE_CHECKING, Any

Expand Down Expand Up @@ -320,7 +321,17 @@ def combinations(

@borrow_docstring(ak.copy)
def copy(array: Array) -> Array:
return array
# Make a copy of meta, but don't try and copy the layout;
# dask-awkward's copy is metadata-only
old_meta = array._meta
new_meta = ak.Array(old_meta.layout, behavior=deepcopy(old_meta._behavior))

return Array(
array._dask,
array._name,
new_meta,
array._divisions,
)


class _FillNoneFn:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def f(a, b, c, n, pad_zero=False):

# concrete version
y = list(zip(a, b, c))
y = dask.core.flatten(list(map(list, y))) # type: ignore
y = dask.core.flatten(list(map(list, y)))
y = map(lambda x: x * n, y) # type: ignore
y = ak.from_iter(y)

Expand All @@ -120,7 +120,7 @@ def f(a, b, c, n, pad_zero=False):

# concrete version
y = list(zip(a, b, c, [0, 0, 0])) # type: ignore
y = dask.core.flatten(list(map(list, y))) # type: ignore
y = dask.core.flatten(list(map(list, y)))
y = map(lambda x: x * n, y) # type: ignore
y = ak.from_iter(y)

Expand Down
3 changes: 2 additions & 1 deletion tests/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ def test_sort(daa, caa, ascending):


def test_copy(daa):
assert dak.copy(daa) is daa
result = dak.copy(daa)
assert result._meta is not daa._meta


@pytest.mark.parametrize(
Expand Down

0 comments on commit 37f11ca

Please sign in to comment.