Skip to content

Commit f54039c

Browse files
committed
Fixed miniscule bug
1 parent 9800ce6 commit f54039c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

puzzle_generator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,14 @@ def inject_into_src(src, spec, new_function_name=None, defaults={}, types={}):
755755
def need_explicit_type(var):
756756
if var not in types:
757757
return False
758-
if var not in defaults:
759-
return True
760-
val = defaults[var] # also make type explicit for [], [[]], [[[]]], etc. since empty-list types are not clear
761-
while isinstance(val, list) and len(val) == 1:
762-
val = val[0]
763-
return val == []
758+
759+
# also make type explicit for [], [[]], [[[]]], etc. since empty-list types are not clear
760+
def hollow(li): # like [[], [[], []]]
761+
if type(li) != list:
762+
return False
763+
return all(hollow(i) for i in li)
764+
return var not in defaults or hollow(defaults[var])
765+
764766

765767
arg_st = ", ".join([var +
766768
(f": {type_str(types[var])}" if need_explicit_type(var) else "") +

0 commit comments

Comments
 (0)