mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add compatibility for old version of six (present on rhel7)
This commit is contained in:
parent
2e39661a26
commit
d8c8ca11cf
1 changed files with 13 additions and 1 deletions
|
@ -36,7 +36,19 @@ from hashlib import sha256
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
from six import binary_type, byte2int, PY2, text_type
|
from six import binary_type, PY2, text_type
|
||||||
|
|
||||||
|
try:
|
||||||
|
from six import byte2int
|
||||||
|
except ImportError:
|
||||||
|
# bytes2int added in six-1.4.0
|
||||||
|
if PY2:
|
||||||
|
def byte2int(bs):
|
||||||
|
return ord(bs[0])
|
||||||
|
else:
|
||||||
|
import operator
|
||||||
|
byte2int = operator.itemgetter(0)
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.utils.unicode import to_unicode, to_bytes
|
from ansible.utils.unicode import to_unicode, to_bytes
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue