diff options
| author | Xavier Morel <xmo@odoo.com> | 2017-04-12 09:53:33 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2017-04-12 13:48:42 +0200 |
| commit | 76852a2fad05292b8d592b76b37e4732f9c60a2d (patch) | |
| tree | 89f532e4d594b815b98f0425397b6156888626c3 /odoo/tools/parse_version.py | |
| parent | 15e17e7b48f89f6e897a28f5031cdd740a887d80 (diff) | |
[#8530] fix uses of ``reduce`` builtin
Demoted to library in Python 3, see if uses can be replaced by more
specific construct, just import functools.reduce otherwise.
Futurize fixers:
* lib2to3.fixes.fix_reduce
Diffstat (limited to 'odoo/tools/parse_version.py')
| -rw-r--r-- | odoo/tools/parse_version.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/odoo/tools/parse_version.py b/odoo/tools/parse_version.py index 90b1b98e57f..997590f9b35 100644 --- a/odoo/tools/parse_version.py +++ b/odoo/tools/parse_version.py @@ -63,12 +63,6 @@ def parse_version(s): return tuple(parts) if __name__ == '__main__': - - def cmp(a, b): - msg = '%s < %s == %s' % (a, b, a < b) - assert a < b, msg - return b - def chk(lst, verbose=False): pvs = [] for v in lst: @@ -76,7 +70,9 @@ if __name__ == '__main__': pvs.append(pv) if verbose: print v, pv - reduce(cmp, pvs) + + for a, b in zip(pvs, pvs[1:]): + assert a < b, '%s < %s == %s' % (a, b, a < b) chk(('0', '4.2', '4.2.3.4', '5.0.0-alpha', '5.0.0-rc1', '5.0.0-rc1.1', '5.0.0_rc2', '5.0.0_rc3', '5.0.0'), False) chk(('5.0.0-0_rc3', '5.0.0-1dev', '5.0.0-1'), False) |
