Skip to content

Commit

Permalink
update named axis implementation to not use tuples at all; start inde…
Browse files Browse the repository at this point in the history
…xing named axis propagation
  • Loading branch information
pfackeldey committed Sep 19, 2024
1 parent d05517a commit a705981
Show file tree
Hide file tree
Showing 38 changed files with 1,157 additions and 770 deletions.
16 changes: 16 additions & 0 deletions src/awkward/_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ def __init__(self, behavior: Mapping | None = None, attrs: Mapping | None = None
self._attrs_from_objects = []
self._behavior_from_objects = []

def with_attr(self, key, value) -> Self:
self._ensure_finalized()
return type(self)(
behavior=self.behavior,
attrs={**self.attrs, key: value},
).finalize()

def without_attr(self, key) -> Self:
self._ensure_finalized()
attrs = dict(self.attrs)
attrs.pop(key, None)
return type(self)(
behavior=self.behavior,
attrs=attrs,
).finalize()

def __enter__(self):
return self

Expand Down
Loading

0 comments on commit a705981

Please sign in to comment.