413
414
# add) the final ','
418
def get_user_option_as_int_from_SI(self, option_name, default=None):
419
"""Get a generic option from a human readable size in SI units, e.g 10MB
421
Accepted suffixes are K,M,G. It is case-insensitive and may be followed
422
by a trailing b (i.e. Kb, MB). This is intended to be practical and not
425
:return Integer, expanded to its base-10 value if a proper SI unit is
426
found. If the option doesn't exist, or isn't a value in
427
SI units, return default (which defaults to None)
429
val = self.get_user_option(option_name)
430
if isinstance(val, list):
435
p = re.compile("^(\d+)([kmg])*b*$", re.IGNORECASE)
439
val = int(m.group(1))
440
if m.group(2) is not None:
441
if m.group(2).lower() == 'k':
443
elif m.group(2).lower() == 'm':
445
elif m.group(2).lower() == 'g':
448
ui.ui_factory.show_warning('Invalid config value for "%s" '
449
' value %r is not an SI unit.'
450
% (option_name, val))
417
457
def gpg_signing_command(self):
418
458
"""What program should be used to sign signatures?"""