1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-23 20:29:08 +00:00

modules [t-z]*: use f-strings (#10978)

* modules [t-z]*: use f-strings

* add changelog frag

* remove extraneous file
This commit is contained in:
Alexei Znamensky 2025-10-26 22:36:03 +13:00 committed by GitHub
parent af246f8de3
commit adcc683da7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 514 additions and 536 deletions

View file

@ -156,7 +156,7 @@ class Yarn(object):
self.name_version = None
if kwargs['version'] and self.name is not None:
self.name_version = self.name + '@' + str(self.version)
self.name_version = f"{self.name}@{self.version!s}"
elif self.name is not None:
self.name_version = self.name
@ -186,7 +186,7 @@ class Yarn(object):
# Module will make directory if not exists.
os.makedirs(self.path)
if not os.path.isdir(self.path):
self.module.fail_json(msg="Path provided %s is not a directory" % self.path)
self.module.fail_json(msg=f"Path provided {self.path} is not a directory")
cwd = self.path
if not os.path.isfile(os.path.join(self.path, 'package.json')):
@ -204,7 +204,7 @@ class Yarn(object):
if json.loads(line)['type'] == 'error':
self.module.fail_json(msg=err)
except Exception:
self.module.fail_json(msg="Unexpected stderr output from Yarn: %s" % err, stderr=err)
self.module.fail_json(msg=f"Unexpected stderr output from Yarn: {err}", stderr=err)
def list(self):
cmd = ['list', '--depth=0', '--json']