Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions overreact/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def make_hashable(obj):
"""
if isinstance(obj, np.ndarray):
return (tuple(obj.shape), tuple(obj.ravel()))
elif isinstance(obj, (list, set)):
elif isinstance(obj, list | set):
return tuple(make_hashable(item) for item in obj)
else:
return obj
Expand Down Expand Up @@ -235,7 +235,7 @@ def convert_back(arg):
shape, flat_data = arg
if (
isinstance(shape, tuple)
and all(isinstance(dim, (int, np.integer)) for dim in shape)
and all(isinstance(dim, int | np.integer) for dim in shape)
and isinstance(flat_data, tuple)
):
if len(flat_data) == 0 or any(dim <= 0 for dim in shape):
Expand Down Expand Up @@ -873,7 +873,7 @@ def totuple(a):
((2, 2), (2, -2))
"""
# we don't touch some types, and this includes namedtuples
if isinstance(a, (int, float, str, rx.Scheme)):
if isinstance(a, int | float | str | rx.Scheme):
return a

with contextlib.suppress(AttributeError):
Expand Down
2 changes: 1 addition & 1 deletion overreact/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

for key, val in self.items():
if isinstance(val, (list, np.ndarray)):
if isinstance(val, list | np.ndarray):
super().__setitem__(key, rx._misc.totuple(val))
elif isinstance(val, dict):
super().__setitem__(key, DotDict(val))
Expand Down
Loading