mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
xrange and izip_longest aren't available in vanilla python3 (#17226)
Fixes for these are either rewriting to get rid of the need for the functions or using six.moves to get equivalent functions for both python2 and python3
This commit is contained in:
parent
27b0f3241b
commit
51ec35378d
4 changed files with 7 additions and 6 deletions
|
@ -218,7 +218,7 @@ class DocCLI(CLI):
|
|||
text.append("- name: %s" % (desc))
|
||||
text.append(" action: %s" % (doc['module']))
|
||||
pad = 31
|
||||
subdent = ''.join([" " for a in xrange(pad)])
|
||||
subdent = " " * pad
|
||||
limit = display.columns - pad
|
||||
|
||||
for o in sorted(doc['options'].keys()):
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
import itertools
|
||||
import re
|
||||
import time
|
||||
import itertools
|
||||
import shlex
|
||||
import itertools
|
||||
import time
|
||||
|
||||
from ansible.module_utils.basic import BOOLEANS_TRUE, BOOLEANS_FALSE
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.six.moves import zip_longest
|
||||
|
||||
DEFAULT_COMMENT_TOKENS = ['#', '!', '/*', '*/']
|
||||
|
||||
|
@ -98,7 +98,7 @@ def ignore_line(text, tokens=None):
|
|||
def get_next(iterable):
|
||||
item, next_item = itertools.tee(iterable, 2)
|
||||
next_item = itertools.islice(next_item, 1, None)
|
||||
return itertools.izip_longest(item, next_item)
|
||||
return zip_longest(item, next_item)
|
||||
|
||||
def parse(lines, indent, comment_tokens=None):
|
||||
toplevel = re.compile(r'\S')
|
||||
|
|
|
@ -19,6 +19,7 @@ __metaclass__ = type
|
|||
|
||||
from re import compile as re_compile, IGNORECASE
|
||||
|
||||
from ansible.compat.six.moves import xrange
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.parsing.splitter import parse_kv
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: generate random string
|
||||
command: python -c "import string,random; print ''.join(random.choice(string.ascii_lowercase) for _ in xrange(8));"
|
||||
command: python -c "import string,random; print ''.join(random.choice(string.ascii_lowercase) for _ in range(8));"
|
||||
register: random_string
|
||||
tags:
|
||||
- prepare
|
||||
|
|
Loading…
Reference in a new issue