diff --git a/evennia/commands/cmdparser.py b/evennia/commands/cmdparser.py index d9e8624dc6..a91bec852b 100644 --- a/evennia/commands/cmdparser.py +++ b/evennia/commands/cmdparser.py @@ -5,6 +5,7 @@ replacing cmdparser function. The replacement parser must accept the same inputs as the default one. """ +from __future__ import division import re from django.conf import settings diff --git a/evennia/commands/default/system.py b/evennia/commands/default/system.py index 097fdb544a..0549cffbe4 100644 --- a/evennia/commands/default/system.py +++ b/evennia/commands/default/system.py @@ -3,6 +3,7 @@ System commands """ +from __future__ import division import traceback import os @@ -690,7 +691,7 @@ class CmdServerLoad(MuxCommand): if has_psutil: loadavg = psutil.cpu_percent() _mem = psutil.virtual_memory() - rmem = _mem.used / (1000 * 1000) + rmem = _mem.used / (1000.0 * 1000) pmem = _mem.percent if "mem" in self.switches: diff --git a/evennia/contrib/extended_room.py b/evennia/contrib/extended_room.py index 5c1544fefa..7bcf10c7dc 100644 --- a/evennia/contrib/extended_room.py +++ b/evennia/contrib/extended_room.py @@ -66,6 +66,7 @@ Installation/testing: 3) Use `@desc` and `@detail` to customize the room, then play around! """ +from __future__ import division import re from django.conf import settings diff --git a/evennia/server/portal/portalsessionhandler.py b/evennia/server/portal/portalsessionhandler.py index b192347156..a2ef0d47cf 100644 --- a/evennia/server/portal/portalsessionhandler.py +++ b/evennia/server/portal/portalsessionhandler.py @@ -2,6 +2,7 @@ Sessionhandler for portal sessions """ from __future__ import print_function +from __future__ import division from time import time from collections import deque diff --git a/evennia/server/profiling/dummyrunner.py b/evennia/server/profiling/dummyrunner.py index 564df21a9e..f3d3c1af90 100644 --- a/evennia/server/profiling/dummyrunner.py +++ b/evennia/server/profiling/dummyrunner.py @@ -31,6 +31,7 @@ for instructions on how to define this module. """ from __future__ import print_function +from __future__ import division import sys import time diff --git a/evennia/server/profiling/memplot.py b/evennia/server/profiling/memplot.py index 5640189c2f..e688ec551e 100644 --- a/evennia/server/profiling/memplot.py +++ b/evennia/server/profiling/memplot.py @@ -6,6 +6,7 @@ the script will append to this file if it already exists. Call this module directly to plot the log (requires matplotlib and numpy). """ +from __future__ import division import os, sys import time #TODO! diff --git a/evennia/utils/ansi.py b/evennia/utils/ansi.py index e7b45e988b..48055d2aae 100644 --- a/evennia/utils/ansi.py +++ b/evennia/utils/ansi.py @@ -135,7 +135,7 @@ class ANSIParser(object): if convert: colval = 16 + (red * 36) + (green * 6) + blue - return "\033[%s8;5;%s%s%sm" % (3 + int(background), colval/100, (colval % 100)/10, colval%10) + return "\033[%s8;5;%s%s%sm" % (3 + int(background), colval // 100, (colval % 100) // 10, colval%10) else: # xterm256 not supported, convert the rgb value to ansi instead if red == green and red == blue and red < 2: diff --git a/evennia/utils/gametime.py b/evennia/utils/gametime.py index 56652ce376..e261a84e15 100644 --- a/evennia/utils/gametime.py +++ b/evennia/utils/gametime.py @@ -5,6 +5,7 @@ It also supplies some useful methods to convert between in-mud time and real-world time as well allows to get the total runtime of the server and the current uptime. """ +from __future__ import division from time import time from django.conf import settings @@ -56,7 +57,7 @@ def _format(seconds, *divisors) : results = [] seconds = int(seconds) for divisor in divisors: - results.append(seconds / divisor) + results.append(seconds // divisor) seconds %= divisor results.append(seconds) return tuple(results) diff --git a/evennia/utils/idmapper/models.py b/evennia/utils/idmapper/models.py index e91e49a202..db85ef9ab4 100644 --- a/evennia/utils/idmapper/models.py +++ b/evennia/utils/idmapper/models.py @@ -7,6 +7,7 @@ leave caching unexpectedly (no use of WeakRefs). Also adds `cache_size()` for monitoring the size of the cache. """ from __future__ import absolute_import +from __future__ import division import os, threading, gc, time #from twisted.internet import reactor diff --git a/evennia/utils/prettytable.py b/evennia/utils/prettytable.py index 51ba326d04..aac77137b8 100644 --- a/evennia/utils/prettytable.py +++ b/evennia/utils/prettytable.py @@ -1145,7 +1145,7 @@ class PrettyTable(object): dHeight = row_height - len(lines) if dHeight: if valign == "m": - lines = [""] * int(dHeight / 2) + lines + [""] * (dHeight - int(dHeight / 2)) + lines = [""] * (dHeight // 2) + lines + [""] * (dHeight - (dHeight // 2)) elif valign == "b": lines = [""] * dHeight + lines else: diff --git a/evennia/utils/txws.py b/evennia/utils/txws.py index 8091942e32..14d0742b94 100644 --- a/evennia/utils/txws.py +++ b/evennia/utils/txws.py @@ -130,8 +130,8 @@ def complete_hybi00(headers, challenge): key1 = headers["Sec-WebSocket-Key1"] key2 = headers["Sec-WebSocket-Key2"] - first = int("".join(i for i in key1 if i in digits)) / key1.count(" ") - second = int("".join(i for i in key2 if i in digits)) / key2.count(" ") + first = int("".join(i for i in key1 if i in digits)) // key1.count(" ") + second = int("".join(i for i in key2 if i in digits)) // key2.count(" ") nonce = pack(">II8s", first, second, challenge) diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index 40cbb85f05..aa1fcbafe4 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -5,6 +5,7 @@ They provide some useful string and conversion methods that might be of use when designing your own game. """ +from __future__ import division from __future__ import print_function import os @@ -265,11 +266,11 @@ def time_format(seconds, style=0): # We'll just use integer math, no need for decimal precision. seconds = int(seconds) - days = seconds / 86400 + days = seconds // 86400 seconds -= days * 86400 - hours = seconds / 3600 + hours = seconds // 3600 seconds -= hours * 3600 - minutes = seconds / 60 + minutes = seconds // 60 seconds -= minutes * 60 if style is 0: