Skip to content

Commit

Permalink
pass json.dumps separators to remove whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dholth committed Oct 25, 2023
1 parent 7da5bb6 commit fb49802
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/truncateable.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def line_numbers(lines):
l0 = list(line_numbers(lines))

print()
print("Lines:")
print("\n".join(lines))

while len(l0):
print()
print("Same ending checksum")
f1 = [l0[0][0].hex()] + [l[1] for l in l0[1:]]
print("\n".join(f1))
print(l0[-1][0].hex())
Expand Down Expand Up @@ -122,7 +124,9 @@ def write(self, obj):
"""
Write one json line to file.
"""
line = json.dumps(obj, ensure_ascii=False).encode("utf-8")
line = json.dumps(obj, ensure_ascii=False, separators=(",", ":")).encode(
"utf-8"
)
self.lineid = bhfunc(line, self.lineid).digest()
self.fp.write(line)
self.fp.write(b"\n")
Expand Down

0 comments on commit fb49802

Please sign in to comment.