diff options
author | Sam Cleveland <sam@zombisoft.com> | 2015-11-11 19:53:51 -0600 |
---|---|---|
committer | Sam Cleveland <sam@zombisoft.com> | 2015-11-11 19:53:51 -0600 |
commit | 6689a342ae68c75bd52d81ee1959b1946739eca4 (patch) | |
tree | 6b0d81da615dd880fdb750698c70a4c2a9a5d252 /netlib | |
parent | 2d48f12332ff380db3ab66c8f436f78a62b2cd91 (diff) | |
download | mitmproxy-6689a342ae68c75bd52d81ee1959b1946739eca4.tar.gz mitmproxy-6689a342ae68c75bd52d81ee1959b1946739eca4.tar.bz2 mitmproxy-6689a342ae68c75bd52d81ee1959b1946739eca4.zip |
Porting to Python 3.4
Fixed byte string formatting for hexdump.
= test session starts =
platform darwin -- Python 3.4.1, pytest-2.8.2, py-1.4.30, pluggy-0.3.1
rootdir: /Users/samc/src/python/netlib, inifile:
collected 11 items
netlib/test/test_utils.py ...........
= 11 passed in 0.23 seconds =
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/netlib/utils.py b/netlib/utils.py index acc7ccd4..66225897 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -85,9 +85,9 @@ def hexdump(s): A generator of (offset, hex, str) tuples """ for i in range(0, len(s), 16): - offset = b"%.10x" % i + offset = "{:0=10x}".format(i).encode() part = s[i:i + 16] - x = b" ".join(b"%.2x" % i for i in six.iterbytes(part)) + x = b" ".join("{:0=2x}".format(i).encode() for i in six.iterbytes(part)) x = x.ljust(47) # 16*2 + 15 yield (offset, x, clean_bin(part, False)) |