mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Replace .format() calls with f-strings across multiple plugins (#11879)
* Replace .format() calls with f-strings across multiple plugins Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * Add changelog fragment for PR 11879 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -605,7 +605,8 @@ def main():
|
||||
if vars is None:
|
||||
return "null"
|
||||
elif isinstance(vars, str):
|
||||
return '"{string}"'.format(string=vars.replace("\\", "\\\\").replace('"', '\\"')).replace("\n", "\\n")
|
||||
escaped = vars.replace("\\", "\\\\").replace('"', '\\"')
|
||||
return f'"{escaped}"'.replace("\n", "\\n")
|
||||
elif isinstance(vars, bool):
|
||||
if vars:
|
||||
return "true"
|
||||
|
||||
Reference in New Issue
Block a user