laforge has uploaded this change for review.

View Change

osmocom.utils: Return hexstr type form argparse helpers

Change-Id: Ide9f3c6b364d867f2dfc1b7dfda40dbab03c5130
---
M src/osmocom/utils.py
1 file changed, 3 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/03/38203/1
diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py
index 6c91783..a218e1b 100644
--- a/src/osmocom/utils.py
+++ b/src/osmocom/utils.py
@@ -203,16 +203,16 @@
raise ValueError('Input must be [hexa]decimal')
if len(instr) & 1:
raise ValueError('Input has un-even number of hex digits')
- return instr
+ return hexstr(instr)

-def is_hexstr(instr: str) -> str:
+def is_hexstr(instr: str) -> hexstr:
"""Method that can be used as 'type' in argparse.add_argument() to validate the value consists of
an even sequence of hexadecimal digits only."""
if not all(c in string.hexdigits for c in instr):
raise ValueError('Input must be hexadecimal')
if len(instr) & 1:
raise ValueError('Input has un-even number of hex digits')
- return instr
+ return hexstr(instr)

def is_decimal(instr: str) -> str:
"""Method that can be used as 'type' in argparse.add_argument() to validate the value consists of

To view, visit change 38203. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: Ide9f3c6b364d867f2dfc1b7dfda40dbab03c5130
Gerrit-Change-Number: 38203
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>