in eventdata/parameter_sources/randomevent.py [0:0]
def convert_to_bytes(size):
matched_size = re.match(r"^(\d+)\s?(kB|MB|GB)?$", size)
if matched_size:
value = int(matched_size.group(1))
unit = matched_size.group(2)
if unit == "kB":
return value << 10
elif unit == "MB":
return value << 20
elif unit == "GB":
return value << 30
elif unit is None:
return value
else:
# we should only reach this if the regex does not match the code here
raise ValueError("Unrecognized unit [{}] for byte size value [{}]".format(unit, size))
else:
raise ValueError("Invalid byte size value [{}]".format(size))