itertools.izip() is renamed to zip() in python3
In python3, itertools.izip() was changed to zip(). Using six.zip() to ensure the compatiblity between 2 and 3.
This commit is contained in:
parent
a205a38744
commit
e35a5859be
@ -1,5 +1,5 @@
|
|||||||
# VMware vSphere Python SDK
|
# VMware vSphere Python SDK
|
||||||
# Copyright (c) 2008-2015 VMware, Inc. All Rights Reserved.
|
# Copyright (c) 2008-2016 VMware, Inc. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -15,11 +15,9 @@
|
|||||||
|
|
||||||
## Diff any two objects
|
## Diff any two objects
|
||||||
import six
|
import six
|
||||||
from six import text_type
|
from six.moves import zip
|
||||||
from six import u
|
|
||||||
|
|
||||||
from pyVmomi import VmomiSupport, types
|
from pyVmomi import VmomiSupport, types
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
from VmomiSupport import GetWsdlName, Type
|
from VmomiSupport import GetWsdlName, Type
|
||||||
|
|
||||||
@ -99,7 +97,7 @@ class Differ:
|
|||||||
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
|
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
|
||||||
% (len(oldObj), len(newObj)))
|
% (len(oldObj), len(newObj)))
|
||||||
return False
|
return False
|
||||||
for i, j in itertools.izip(oldObj, newObj):
|
for i, j in zip(oldObj, newObj):
|
||||||
if isElementLinks:
|
if isElementLinks:
|
||||||
if i.GetKey() != j.GetKey():
|
if i.GetKey() != j.GetKey():
|
||||||
__Log__.debug('DiffDoArrays: Keys do not match %s != %s'
|
__Log__.debug('DiffDoArrays: Keys do not match %s != %s'
|
||||||
@ -118,7 +116,7 @@ class Differ:
|
|||||||
__Log__.debug('DiffAnyArrays: Array lengths do not match. %d != %d'
|
__Log__.debug('DiffAnyArrays: Array lengths do not match. %d != %d'
|
||||||
% (len(oldObj), len(newObj)))
|
% (len(oldObj), len(newObj)))
|
||||||
return False
|
return False
|
||||||
for i, j in itertools.izip(oldObj, newObj):
|
for i, j in zip(oldObj, newObj):
|
||||||
if not self.DiffAnyObjects(i, j, isElementLinks):
|
if not self.DiffAnyObjects(i, j, isElementLinks):
|
||||||
__Log__.debug('DiffAnyArrays: One of the elements do not match.')
|
__Log__.debug('DiffAnyArrays: One of the elements do not match.')
|
||||||
return False
|
return False
|
||||||
@ -136,7 +134,7 @@ class Differ:
|
|||||||
newSet = newObj and frozenset(newObj) or frozenset()
|
newSet = newObj and frozenset(newObj) or frozenset()
|
||||||
match = (oldSet == newSet)
|
match = (oldSet == newSet)
|
||||||
else:
|
else:
|
||||||
for i, j in itertools.izip(oldObj, newObj):
|
for i, j in zip(oldObj, newObj):
|
||||||
if i != j:
|
if i != j:
|
||||||
match = False
|
match = False
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user