fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/python/pyosmocom/+/39453?usp=email )
Change subject: utils: b2h()/i2h(): use bytes.hex() API
......................................................................
utils: b2h()/i2h(): use bytes.hex() API
Change-Id: Iaef25f614e7a4b1c3eb328e560bf9a300f70ae31
---
M src/osmocom/utils.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/53/39453/1
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
https://gerrit.osmocom.org/c/python/pyosmocom/+/39453?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: Iaef25f614e7a4b1c3eb328e560bf9a300f70ae31
Gerrit-Change-Number: 39453
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>