mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-25 05:23:58 -07:00
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:
parent
8a1ed41fe5
commit
3734f471c1
14 changed files with 50 additions and 54 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue