Skip to content

Add width argument to diff_dumps (#1) #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions intelhex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand Down