mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-08 06:13:03 +00:00
Replace % and str.format() with f-strings (#875)
* Replace % and str.format() with f-strings. * Apply suggestions from review.
This commit is contained in:
@@ -252,9 +252,7 @@ class SignatureInfoCryptography(SignatureInfoBase):
|
||||
|
||||
if not verified:
|
||||
self.module.fail_json(
|
||||
msg="Unsupported key type. Your cryptography version is {0}".format(
|
||||
CRYPTOGRAPHY_VERSION
|
||||
)
|
||||
msg=f"Unsupported key type. Your cryptography version is {CRYPTOGRAPHY_VERSION}"
|
||||
)
|
||||
result["valid"] = valid
|
||||
return result
|
||||
@@ -282,7 +280,7 @@ def main():
|
||||
if not os.path.isfile(module.params["path"]):
|
||||
module.fail_json(
|
||||
name=module.params["path"],
|
||||
msg="The file {0} does not exist".format(module.params["path"]),
|
||||
msg=f"The file {module.params['path']} does not exist",
|
||||
)
|
||||
|
||||
backend = module.params["select_crypto_backend"]
|
||||
@@ -300,17 +298,14 @@ def main():
|
||||
# Success?
|
||||
if backend == "auto":
|
||||
module.fail_json(
|
||||
msg=(
|
||||
"Cannot detect any of the required Python libraries "
|
||||
"cryptography (>= {0})"
|
||||
).format(MINIMAL_CRYPTOGRAPHY_VERSION)
|
||||
msg=f"Cannot detect any of the required Python libraries cryptography (>= {MINIMAL_CRYPTOGRAPHY_VERSION})"
|
||||
)
|
||||
try:
|
||||
if backend == "cryptography":
|
||||
if not CRYPTOGRAPHY_FOUND:
|
||||
module.fail_json(
|
||||
msg=missing_required_lib(
|
||||
"cryptography >= {0}".format(MINIMAL_CRYPTOGRAPHY_VERSION)
|
||||
f"cryptography >= {MINIMAL_CRYPTOGRAPHY_VERSION}"
|
||||
),
|
||||
exception=CRYPTOGRAPHY_IMP_ERR,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user