From 8257dc003b653fb2535f49dab3d6728c2f45517f Mon Sep 17 00:00:00 2001 From: oliverblasius <48650314+oliverbl@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:55:44 +0200 Subject: [PATCH] Add width argument to diff_dumps (#1) --- intelhex/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/intelhex/__init__.py b/intelhex/__init__.py index 34c28c6..84127df 100644 --- a/intelhex/__init__.py +++ b/intelhex/__init__.py @@ -1110,7 +1110,7 @@ def bin2hex(fin, fout, offset=0): #/def bin2hex -def diff_dumps(ih1, ih2, tofile=None, name1="a", name2="b", n_context=3): +def diff_dumps(ih1, ih2, tofile=None, name1="a", name2="b", n_context=3, width=16): """Diff 2 IntelHex objects and produce unified diff output for their hex dumps. @@ -1120,10 +1120,11 @@ def diff_dumps(ih1, ih2, tofile=None, name1="a", name2="b", n_context=3): @param name1 name of the first hex file to show in the diff header @param name2 name of the first hex file to show in the diff header @param n_context number of context lines in the unidiff output + @param width width of dump for which diff will be created """ def prepare_lines(ih): sio = StringIO() - ih.dump(sio) + ih.dump(sio, width=width) dump = sio.getvalue() lines = dump.splitlines() return lines