Skip to content
Permalink
Browse files

Python 3: Fixed integer division 7

Change-Id: I0ab9fe75666147abd970abae655e30c9b796f980
  • Loading branch information...
loocars committed Aug 8, 2019
1 parent 2c74269 commit f9ff4f43eea14ad758a0e0b0c0a0913ad0112747
@@ -79,7 +79,7 @@ for line in response[1:]:
processing_time = row["status_average_processing_time"]
processing_time = processing_time * 1000
processing_rate_av = row["status_average_message_rate"]
busy = processing_time * processing_rate_av / 10
busy = processing_time * processing_rate_av / 10.0
count += 1

exit_code = 0
@@ -13,6 +13,7 @@
###############################################################################

from __future__ import print_function
from __future__ import division
import os, sys, getopt
import livestatus

@@ -118,7 +119,8 @@ def main(argv):
down_nodes = float(len(down_list))
unknown_nodes = float(len(unknown_list))

failedpercent = ((down_nodes + unreachable_nodes + unknown_nodes) / all_nodes) * 100.0
failedpercent = ((down_nodes + unreachable_nodes + unknown_nodes) /
all_nodes) * 100.0 # fixed: true-division

str_up = ""
str_down = ""
@@ -52,7 +52,7 @@
"converter": {
"software.os.install_date": lambda val: time.strftime("%Y-%m-%d", time.localtime(val)),
"@inventory_date": lambda val: time.strftime("%Y-%m-%d", time.localtime(val)),
"hardware.cpu.max_speed": lambda val: val / 1000000, # hz in mhz
"hardware.cpu.max_speed": lambda val: val / 1000000.0, # hz in mhz
},
},
"inv_raw_arp": {
@@ -262,7 +262,7 @@ def check_memcached(item, params, parsed):
elif isinstance(val, Uptime):
days, val = divmod(val, 79800)
hours, val = divmod(val, 3600)
minutes = val / 60
minutes = val / 60.0
return "%dd %dh %dm" % (days, hours, minutes)
else:
return "%s" % val

0 comments on commit f9ff4f4

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