Skip to content

Commit d6daad9

Browse files
committed
handle ellipsis in type hashing
1 parent 92cb5b9 commit d6daad9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pydra/utils/hash.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,9 @@ def type_location(tp: type) -> bytes:
497497
yield from bytes_repr_type(arg, cache)
498498
yield b")"
499499
else:
500-
if inspect.isclass(klass) and issubclass(klass, FileSet):
500+
if klass is Ellipsis:
501+
yield b"..."
502+
elif inspect.isclass(klass) and issubclass(klass, FileSet):
501503
try:
502504
yield b"mime-like:(" + klass.mime_like.encode() + b")"
503505
except fileformats.core.exceptions.FormatDefinitionError:

pydra/utils/tests/test_hash.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,13 @@ def test_bytes_special_form5():
375375
)
376376

377377

378+
def test_bytes_special_form6():
379+
obj_repr = join_bytes_repr(ty.Tuple[float, ...])
380+
assert obj_repr == (
381+
b"type:(origin:(type:(builtins.tuple)),args:(type:(builtins.float)type:(...)))"
382+
)
383+
384+
378385
def test_recursive_object():
379386
a = []
380387
b = [a]

0 commit comments

Comments
 (0)