laforge has submitted this change. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38203?usp=email )
Change subject: osmocom.utils: Return hexstr type form argparse helpers ......................................................................
osmocom.utils: Return hexstr type form argparse helpers
Change-Id: Ide9f3c6b364d867f2dfc1b7dfda40dbab03c5130 --- M src/osmocom/utils.py 1 file changed, 3 insertions(+), 3 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve
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