use f-strings (#10899)

* use f-strings

* add changelog frag

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2025-10-11 22:59:28 +13:00 committed by GitHub
commit 3734f471c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 50 additions and 54 deletions

View file

@ -45,14 +45,13 @@ _value:
def crc32s(value):
if not is_string(value):
raise AnsibleFilterError('Invalid value type (%s) for crc32 (%r)' %
(type(value), value))
raise AnsibleFilterError(f'Invalid value type ({type(value)}) for crc32 ({value!r})')
if not HAS_ZLIB:
raise AnsibleFilterError('Failed to import zlib module')
data = to_bytes(value, errors='surrogate_or_strict')
return "{0:x}".format(crc32(data) & 0xffffffff)
return f"{crc32(data) & 0xffffffff:x}"
class FilterModule: