over.misc.hexdump now accepts anything as long as it's convertible to bytes
This commit is contained in:
parent
e699be5c6d
commit
73132dad6f
1 changed files with 4 additions and 2 deletions
|
@ -130,8 +130,10 @@ def hexdump(data, indent=0, offset=16, show_header=True, show_offsets=True, show
|
|||
|
||||
output_io = io.StringIO() if not output else output
|
||||
|
||||
if type(data) is not bytes:
|
||||
raise ValueError("data must be bytes")
|
||||
try:
|
||||
data = bytes(data)
|
||||
except:
|
||||
raise ValueError("data must be bytes or similar")
|
||||
|
||||
offset_figures = math.ceil(math.log2(len(data)) / 8) * 2 if data else 2
|
||||
format_str = "%%0%dx " %(offset_figures)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue