This is an automated email from the ASF dual-hosted git repository. gstein pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/steve.git
commit 36cf2c0e78273a8516beb27fda0b5616040ed252 Author: Greg Stein <[email protected]> AuthorDate: Thu Jun 2 02:12:26 2022 -0500 simplify exclude_lowest() Use candidate attributes, rather than copying values into locals --- monitoring/stv_tool.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/monitoring/stv_tool.py b/monitoring/stv_tool.py index 302f66b..f8e4269 100755 --- a/monitoring/stv_tool.py +++ b/monitoring/stv_tool.py @@ -379,23 +379,17 @@ def try_remove_lowest(surplus, candidates): def exclude_lowest(candidates): - ### use: ahead = len(candidates) ?? - ahead = 1000000000. # greater than any possible candidate.ahead - rand = 1.1 # greater than any possible candidate.rand which = None used_rand = False for c in candidates: if c.status == HOPEFUL or c.status == ALMOST: - if c.ahead < ahead: - ahead = c.ahead - rand = c.rand + if which is None or c.ahead < which.ahead: which = c use_rand = False - elif c.ahead == ahead: + elif c.ahead == which.ahead: use_rand = True - if c.rand < rand: - rand = c.rand + if c.rand < which.rand: which = c if use_rand:
