From: Rob van der Linde Date: Wed, 4 Oct 2023 22:27:40 +0000 (+1300) Subject: python: PEP8 fixup whitespace in getopt.py first X-Git-Tag: talloc-2.4.2~1150 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22316fea3359a808031a550c6612811f3f816f80;p=thirdparty%2Fsamba.git python: PEP8 fixup whitespace in getopt.py first Signed-off-by: Rob van der Linde Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/getopt.py b/python/samba/getopt.py index e9ff3de5b34..e6fe6ab57a3 100644 --- a/python/samba/getopt.py +++ b/python/samba/getopt.py @@ -364,17 +364,17 @@ class CredentialsOptionsDouble(CredentialsOptions): self.creds2.set_cmdline_callbacks() return self.creds2 + # Custom option type to allow the input of sizes using byte, kb, mb ... # units, e.g. 2Gb, 4KiB ... # e.g. Option("--size", type="bytes", metavar="SIZE") # def check_bytes(option, opt, value): - multipliers = { - "B" : 1, - "KB" : 1024, - "MB" : 1024 * 1024, - "GB" : 1024 * 1024 * 1024} + multipliers = {"B": 1, + "KB": 1024, + "MB": 1024 * 1024, + "GB": 1024 * 1024 * 1024} # strip out any spaces v = value.replace(" ", "") @@ -392,7 +392,6 @@ def check_bytes(option, opt, value): "with an optional unit suffix").format(opt) raise optparse.OptionValueError(msg) - # strip out the 'i' and convert to upper case so # kib Kib kb KB are all equivalent suffix = v.upper().replace("I", "") @@ -403,6 +402,7 @@ def check_bytes(option, opt, value): "should be B, Kb, Mb or Gb").format(opt, v) raise optparse.OptionValueError(msg) + class SambaOption(optparse.Option): TYPES = optparse.Option.TYPES + ("bytes",) TYPE_CHECKER = copy(optparse.Option.TYPE_CHECKER)