mirror of
https://github.com/samba-team/samba.git
synced 2025-07-28 11:42:03 +03:00
python3: reuse cmp_fn defined in compat.py
This will also fix PEP8 E306: expected 1 blank line before a nested definition, found 0 Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
@ -28,6 +28,7 @@ import re
|
||||
import shutil
|
||||
import samba
|
||||
|
||||
from samba.compat import cmp_fn
|
||||
from samba import Ldb, version, ntacls
|
||||
from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE
|
||||
import ldb
|
||||
@ -283,9 +284,8 @@ def dn_sort(x, y):
|
||||
len1 = len(tab1)-1
|
||||
len2 = len(tab2)-1
|
||||
# Note: python range go up to upper limit but do not include it
|
||||
cmp = lambda x, y: (x > y) - (x < y) # cmp is removed in py3
|
||||
for i in range(0, minimum):
|
||||
ret = cmp(tab1[len1-i], tab2[len2-i])
|
||||
ret = cmp_fn(tab1[len1-i], tab2[len2-i])
|
||||
if ret != 0:
|
||||
return ret
|
||||
else:
|
||||
|
Reference in New Issue
Block a user