Branch: refs/heads/master
Home:
https://github.com/tribe29/checkmk
Commit: e17b7a9809be4dbeca5e031a443734b344aa4ac7
https://github.com/tribe29/checkmk/commit/e17b7a9809be4dbeca5e031a443734b34…
Author: Lukas Lengler <lukas.lengler(a)tribe29.com>
Date: 2019-09-02 (Mon, 02 Sep 2019)
Changed paths:
M checks/apache_status
M cmk/gui/availability.py
M cmk/gui/plugins/views/availability.py
M cmk/gui/plugins/wato/bi.py
M cmk/gui/table.py
M cmk/gui/utils.py
M cmk/gui/visuals.py
M cmk/gui/wato/pages/folders.py
M cmk/utils/__init__.py
M cmk/utils/misc.py
M cmk_base/config.py
M cmk_base/snmp.py
Log Message:
-----------
Python 3: Clean up cmp_to_key
x = [({"title": "test1"}, "A"),
({"title": "test1" }, "A"),
({"title": "test2"}, "B")]
expected1 = sorted(x, cmp=lambda a, b: cmp(a[1][0], b[1][0]) or
cmp(a[0]["title"], b[0]["title"]))
sol1 = sorted(x, key=lambda x: (x[1][0], x[0]["title"]))
expected2 = sorted(x, cmp=lambda a, b: -cmp(a[1][0], b[1][0]) or
cmp(a[0]["title"], b[0]["title"]))
sol2 = sorted(sorted(x, key=lambda x: (x[0]["title"])), key=lambda x: x[1][0],
reverse=True)
assert expected1 == sol1, "1. Solution does not work"
assert expected2 == sol2, "2. Solution does not work"
print "It works!"
Short test for "or" cases. Expand input data if there are insecurities
1st assertion is for normal "or" cases
2nd one is for cmk/gui/visuals.py case
Change-Id: Id2aeec321640cc390da69d6fc6ca43baf448b8c1