Contstrain argparse integers to permitted range
In many casese we used type=int permitting any integer value, positive
or negative without a constratint in size. However, in reality often
we're constrained to unsigned 8 or 16 bit ranges. Let's use the
auto_uint{8,16} functions to enforce this within argparse before
we even try to encode something that won't work.
Change-Id: I35c81230bc18e2174ec1930aa81463f03bcd69c8
This commit is contained in:
@@ -927,6 +927,9 @@ def auto_uint7(x):
|
||||
def auto_uint8(x):
|
||||
return _auto_uint(x, 255)
|
||||
|
||||
def auto_uint16(x):
|
||||
return _auto_uint(x, 65535)
|
||||
|
||||
def expand_hex(hexstring, length):
|
||||
"""Expand a given hexstring to a specified length by replacing "." or ".."
|
||||
with a filler that is derived from the neighboring nibbles respective
|
||||
|
||||
Reference in New Issue
Block a user