Skip to content

Commit 23d5980

Browse files
committed
actually (I think this time) finished applying all of Chris' suggestions now
1 parent 62e9523 commit 23d5980

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

pydra/utils/hash.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# import stat
55
import struct
66
from collections.abc import Mapping
7-
import itertools
87
from functools import singledispatch
98
from hashlib import blake2b
109

@@ -74,7 +73,6 @@ def hash_object(obj: object) -> Hash:
7473
try:
7574
return hash_single(obj, Cache({}))
7675
except Exception as e:
77-
hash_single(obj, Cache({})) # for debugging
7876
raise UnhashableError(f"Cannot hash object {obj!r}") from e
7977

8078

@@ -284,11 +282,7 @@ def bytes_repr_numpy(obj: numpy.ndarray, cache: Cache) -> Iterator[bytes]:
284282
if obj.dtype == "object":
285283
yield from bytes_repr_sequence_contents(iter(obj.ravel()), cache)
286284
else:
287-
bytes_it = iter(obj.tobytes(order="C"))
288-
for chunk in iter(
289-
lambda: bytes(itertools.islice(bytes_it, NUMPY_CHUNK_LEN)), b""
290-
):
291-
yield chunk
285+
yield obj.tobytes(order="C")
292286

293287

294288
NUMPY_CHUNK_LEN = 8192

pydra/utils/tests/test_hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _(obj: MyClass, cache: Cache):
185185

186186

187187
def test_registration_conflict():
188-
# Verify the order of
188+
# Verify the order of precedence: class/superclass registration, __bytes_repr__, protocols
189189
#
190190
# WARNING: This test appends to a registry that cannot be restored
191191
# to previous state.

0 commit comments

Comments
 (0)