1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Use literal string interpolation in core (f-strings) (#26166)

This commit is contained in:
Franck Nijhof
2019-08-23 18:53:33 +02:00
committed by Paulus Schoutsen
parent 1efa29d6ff
commit decf13b948
67 changed files with 180 additions and 246 deletions

View File

@@ -58,20 +58,18 @@ def run(args):
if args.value:
the_secret = args.value
else:
the_secret = getpass.getpass(
"Please enter the secret for {}: ".format(args.name)
)
the_secret = getpass.getpass(f"Please enter the secret for {args.name}: ")
current_version = credstash.getHighestVersion(args.name, table=table)
credstash.putSecret(
args.name, the_secret, version=int(current_version) + 1, table=table
)
print("Secret {} put successfully".format(args.name))
print(f"Secret {args.name} put successfully")
elif args.action == "get":
the_secret = credstash.getSecret(args.name, table=table)
if the_secret is None:
print("Secret {} not found".format(args.name))
print(f"Secret {args.name} not found")
else:
print("Secret {}={}".format(args.name, the_secret))
print(f"Secret {args.name}={the_secret}")
elif args.action == "del":
credstash.deleteSecrets(args.name, table=table)
print("Deleted secret {}".format(args.name))
print(f"Deleted secret {args.name}")