[scripts/pyprint] support sets

This commit is contained in:
Mike Fährmann
2025-07-27 00:00:25 +02:00
parent 14c29fe3e0
commit 07af386700

View File

@@ -86,8 +86,12 @@ def pyprint(obj, indent=0, lmax=16):
if not obj:
return "()"
if len(obj) == 1:
return f'''({pyprint(obj[0], indent+4)},)'''
return f'''({pyprint(obj[0])},)'''
return f'''({", ".join(pyprint(v, indent+4) for v in obj)})'''
if isinstance(obj, set):
if not obj:
return "set()"
return f'''{{{", ".join(pyprint(v, indent+4) for v in obj)}}}'''
return f'''{obj}'''