laforge submitted this change.
utils: b2h()/i2h(): use bytes.hex() API
Change-Id: Iaef25f614e7a4b1c3eb328e560bf9a300f70ae31
---
M src/osmocom/utils.py
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py
index 5947453..6c823ec 100644
--- a/src/osmocom/utils.py
+++ b/src/osmocom/utils.py
@@ -73,7 +73,7 @@
def b2h(b: bytearray) -> hexstr:
"""convert from a sequence of bytes to a string of hex nibbles"""
- return hexstr(''.join(['%02x' % (x) for x in b]))
+ return hexstr(b.hex())
def h2i(s: Hexstr) -> List[int]:
@@ -83,7 +83,7 @@
def i2h(s: List[int]) -> hexstr:
"""convert from a list of integers to a string of hex nibbles"""
- return hexstr(''.join(['%02x' % (x) for x in s]))
+ return hexstr(bytes(s).hex())
def h2s(s: Hexstr) -> str:
To view, visit change 39453. To unsubscribe, or for help writing mail filters, visit settings.