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:
Toshio Kuratomi 2016-08-24 12:28:02 -07:00 committed by GitHub
commit 51ec35378d
4 changed files with 7 additions and 6 deletions

View file

@ -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')