Skip to content
Permalink
Browse files

Python 3: Fixed integer division 1

Change-Id: I69bfa42ac31abcecee91ec038a509bbf38b31d12
  • Loading branch information...
loocars committed Aug 7, 2019
1 parent 40e5a77 commit c8ce7a2679992506031e472e1e5d00eda4acea82
Showing with 10 additions and 8 deletions.
  1. +1 −1 active_checks/check_mail_loop
  2. +1 −1 agents/special/agent_random
  3. +8 −6 bin/mkbench
@@ -416,7 +416,7 @@ def check_mails():
if duration is None:
duration = recv_ts - send_ts
else:
duration = (duration + (recv_ts - send_ts)) / 2 # average
duration = (duration + (recv_ts - send_ts)) / 2.0 # average

if critical is not None and duration >= critical:
state = 2
@@ -73,7 +73,7 @@ state_texts = [
now = time.time()
for service in services:
last_change, last_state = history.get(service, (now - 600, 0))
p_state_change = ((now - last_change) / 60) + 1
p_state_change = ((now - last_change) / 60.0) + 1
if last_state == 0:
p_state_change += 10
if int(random.random() * p_state_change) == 0:
@@ -24,6 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.

from __future__ import division
__version__ = "1.7.0i1"

# TODO:
@@ -913,7 +914,8 @@ class Measurement(object):
if values:
if isinstance(values[0], tuple):
# averages of equal length tuples
averaged = tuple([sum(y) / len(y) for y in zip(*values)])
averaged = tuple([sum(y) / len(y) for y in zip(*values)
]) # fixed: true-division
else:
# averages of dict items
averaged = {}
@@ -1027,11 +1029,11 @@ class Measurement(object):
self.disk_io = DiskIO(0.0, 0.0)
return

read_bytes_per_sec = (self.disk_counters.read_bytes - last.disk_counters.read_bytes) \
/ (self.time - last.time)
read_bytes_per_sec = (self.disk_counters.read_bytes - last.disk_counters.read_bytes) /
(self.time - last.time) # fixed: true-division

write_bytes_per_sec = (self.disk_counters.write_bytes - last.disk_counters.write_bytes) \
/ (self.time - last.time)
write_bytes_per_sec = (self.disk_counters.write_bytes - last.disk_counters.write_bytes) /
(self.time - last.time) # fixed: true-division

self.disk_io = DiskIO(read_bytes_per_sec, write_bytes_per_sec)

@@ -3134,7 +3136,7 @@ class ConsoleRenderer(npyscreen.NPSApp):

max_y, max_x = self._window.curses_pad.getmaxyx()
form_border = 1 * 2
info_box_width = (max_x - form_border) / 2
info_box_width = int((max_x - form_border) / 2.0)
info_box_height = 10
help_height = 2
log_height = max_y - info_box_height - form_border - help_height

0 comments on commit c8ce7a2

Please sign in to comment.
You can’t perform that action at this time.