mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix zip filter for Python3
Using the now bundled six library. Fixes #28117
This commit is contained in:
parent
aee3f12db4
commit
c9cdc3a259
1 changed files with 5 additions and 11 deletions
|
@ -26,6 +26,7 @@ import math
|
|||
|
||||
from ansible import errors
|
||||
from ansible.module_utils import basic
|
||||
from ansible.module_utils.six.moves import zip, zip_longest
|
||||
|
||||
|
||||
def unique(a):
|
||||
|
@ -153,17 +154,10 @@ class FilterModule(object):
|
|||
'human_readable': human_readable,
|
||||
'human_to_bytes': human_to_bytes,
|
||||
|
||||
# zip
|
||||
'zip': zip,
|
||||
'zip_longest': zip_longest,
|
||||
|
||||
}
|
||||
|
||||
# py2 vs py3, reverse when py3 is predominant version
|
||||
try:
|
||||
filters['zip'] = itertools.izip
|
||||
filters['zip_longest'] = itertools.izip_longest
|
||||
except AttributeError:
|
||||
try:
|
||||
filters['zip'] = itertools.zip
|
||||
filters['zip_longest'] = itertools.zip_longest
|
||||
except:
|
||||
pass
|
||||
|
||||
return filters
|
||||
|
|
Loading…
Reference in a new issue