mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-25 13:34:01 -07:00
Remove all usage of ansible.module_utils.six from main branch (#10888)
* Get rid of all six.moves imports. * Get rid of iteritems. * Get rid of *_type(s) aliases. * Replace StringIO import. * Get rid of PY2/PY3 constants. * Get rid of raise_from. * Get rid of python_2_unicode_compatible. * Clean up global six imports. * Remove all usage of ansible.module_utils.six. * Linting. * Fix xml module. * Docs adjustments.
This commit is contained in:
parent
8f8a0e1d7c
commit
a8977afb04
113 changed files with 188 additions and 352 deletions
|
|
@ -50,8 +50,7 @@ options:
|
|||
type: bool
|
||||
default: false
|
||||
requirements:
|
||||
- Requires C(lzma) (standard library of Python 3) or L(backports.lzma, https://pypi.org/project/backports.lzma/) (Python
|
||||
2) if using C(xz) format.
|
||||
- Requires C(lzma) (standard library of Python 3) if using C(xz) format.
|
||||
author:
|
||||
- Stanislav Shamilov (@shamilovstas)
|
||||
"""
|
||||
|
|
@ -94,16 +93,12 @@ import os
|
|||
import shutil
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils import six
|
||||
from ansible_collections.community.general.plugins.module_utils.mh.module_helper import ModuleHelper
|
||||
from ansible.module_utils.common.text.converters import to_native, to_bytes
|
||||
from ansible_collections.community.general.plugins.module_utils import deps
|
||||
|
||||
with deps.declare("lzma"):
|
||||
if six.PY3:
|
||||
import lzma
|
||||
else:
|
||||
from backports import lzma
|
||||
import lzma
|
||||
|
||||
|
||||
def lzma_decompress(src):
|
||||
|
|
@ -111,10 +106,7 @@ def lzma_decompress(src):
|
|||
|
||||
|
||||
def bz2_decompress(src):
|
||||
if six.PY3:
|
||||
return bz2.open(src, "rb")
|
||||
else:
|
||||
return bz2.BZ2File(src, "rb")
|
||||
return bz2.open(src, "rb")
|
||||
|
||||
|
||||
def gzip_decompress(src):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue