move to python 3

This commit is contained in:
2019-12-16 12:04:04 -05:00
parent 8d9af90168
commit 1dde8df0a7
+4 -4
View File
@@ -17,7 +17,7 @@ DEBUG=1
def log(host, m): def log(host, m):
if DEBUG: if DEBUG:
print "class log: %s %s" % (host, m) print("class log: %s %s" % (host, m))
class Connection: class Connection:
@@ -268,7 +268,7 @@ class Host:
state = "<b>%s</b>" % self.state state = "<b>%s</b>" % self.state
elif self.state in ["up", "UP"]: elif self.state in ["up", "UP"]:
state = "" state = ""
for x in self.connections.keys(): for x in list(self.connections.keys()):
try: try:
state += " %5.1f" % (self.connections[x].rtts[-1]) state += " %5.1f" % (self.connections[x].rtts[-1])
except: except:
@@ -285,7 +285,7 @@ class Host:
if self.upcount > 0: if self.upcount > 0:
# return "(%0.1f%%) %s %s %s " % ((self.doesack * 100.0) / self.upcount, self.doesack, self.upcount, self.hdwcounts) # return "(%0.1f%%) %s %s %s " % ((self.doesack * 100.0) / self.upcount, self.doesack, self.upcount, self.hdwcounts)
r = "" r = ""
for v in xrange(3): for v in range(3):
a,u = self.hdwcounts[v] a,u = self.hdwcounts[v]
if (self.upcount - u) != 0: if (self.upcount - u) != 0:
vs = "%0.0f" % (100.0 - (((self.doesack - a) * 100.0) / (self.upcount - u))) vs = "%0.0f" % (100.0 - (((self.doesack - a) * 100.0) / (self.upcount - u)))
@@ -338,7 +338,7 @@ class Host:
res = [] res = []
res.append('<table id="ntable" class="sortable">') res.append('<table id="ntable" class="sortable">')
res.append(ubHost.htmltable('th', ubHost.headerdict(), short)) res.append(ubHost.htmltable('th', ubHost.headerdict(), short))
hosts_sorted = Host.hosts.keys() hosts_sorted = list(Host.hosts.keys())
if len(hosts_sorted): if len(hosts_sorted):
hosts_sorted.sort() hosts_sorted.sort()
for h in hosts_sorted: for h in hosts_sorted: