diff --git a/silkaj/cli_tools.py b/silkaj/cli_tools.py index 5aa0c6c8bf7530f9c98ce004426e94534453e928..1e658ecb1a7ac0625871a9e7ad49a363cc612433 100644 --- a/silkaj/cli_tools.py +++ b/silkaj/cli_tools.py @@ -22,17 +22,16 @@ class MutuallyExclusiveOption(Option): help = kwargs.get("help", "") if self.mutually_exclusive: ex_str = ", ".join(self.mutually_exclusive) - kwargs["help"] = help + ( - " NOTE: This argument is mutually exclusive with " - " arguments: [" + ex_str + "]." - ) + kwargs[ + "help" + ] = f"{help} NOTE: This argument is mutually exclusive with arguments: [{ex_str}]." super().__init__(*args, **kwargs) def handle_parse_result(self, ctx, opts, args): if self.mutually_exclusive.intersection(opts) and self.name in opts: + arguments = ", ".join(self.mutually_exclusive) raise UsageError( - "Usage: `{}` is mutually exclusive with " - "arguments `{}`.".format(self.name, ", ".join(self.mutually_exclusive)) + f"Usage: `{self.name}` is mutually exclusive with arguments `{arguments}`." ) return super().handle_parse_result(ctx, opts, args) diff --git a/silkaj/crypto_tools.py b/silkaj/crypto_tools.py index 60ae6e54ac3c77584828c011373f498bba535055..429ffc657fcfef4192b8619342b1df216a132e6a 100644 --- a/silkaj/crypto_tools.py +++ b/silkaj/crypto_tools.py @@ -51,7 +51,7 @@ def check_pubkey_format(pubkey, display_error=True): elif re.search(re.compile(PUBKEY_CHECKSUM_PATTERN), pubkey): return True elif display_error: - message_exit("Error: bad format for following public key: " + pubkey) + message_exit(f"Error: bad format for following public key: {pubkey}") return @@ -65,11 +65,8 @@ def validate_checksum(pubkey_checksum): if checksum == gen_checksum(pubkey): return pubkey message_exit( - "Error: public key '" - + pubkey - + "' does not match checksum '" - + checksum - + "'.\nPlease verify the public key." + f"Error: public key '{pubkey}' does not match checksum '{checksum}'.\n\ +Please verify the public key." )