Run "futurize -1 -w -n ."
This commit is contained in:
parent
7f11256fc8
commit
06c3dc0ed3
55 changed files with 281 additions and 244 deletions
|
|
@ -4,10 +4,11 @@ modules in Evennia. It also holds the idmapper in-memory caching
|
|||
functionality.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
# simple check to determine if we are currently running under pypy.
|
||||
try:
|
||||
import __pypy__ as is_pypy
|
||||
except ImportError:
|
||||
is_pypy = False
|
||||
|
||||
from utils import *
|
||||
from .utils import *
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ def read_batchfile(pythonpath, file_ending='.py'):
|
|||
try:
|
||||
with codecs.open(abspath, 'r', encoding=file_encoding) as fobj:
|
||||
text = fobj.read()
|
||||
except (ValueError, UnicodeDecodeError), e:
|
||||
except (ValueError, UnicodeDecodeError) as e:
|
||||
# this means an encoding error; try another encoding
|
||||
decoderr.append(str(e))
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ class EvEditor(object):
|
|||
"""
|
||||
try:
|
||||
self._buffer = self._loadfunc(self._caller)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._caller.msg(_ERROR_LOADFUNC.format(error=e))
|
||||
|
||||
def get_buffer(self):
|
||||
|
|
@ -661,7 +661,7 @@ class EvEditor(object):
|
|||
"""
|
||||
try:
|
||||
self._quitfunc(self._caller)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._caller.msg(_ERROR_QUITFUNC.format(error=e))
|
||||
del self._caller.ndb._lineeditor
|
||||
self._caller.cmdset.remove(EvEditorCmdSet)
|
||||
|
|
@ -679,7 +679,7 @@ class EvEditor(object):
|
|||
# save worked. The saving function is responsible for
|
||||
# any status messages.
|
||||
self._unsaved = False
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._caller.msg(_ERROR_SAVEFUNC.format(error=e))
|
||||
else:
|
||||
self._caller.msg(_MSG_SAVE_NO_CHANGE)
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ into (when including its borders and at least one line of text), the
|
|||
form will raise an error.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
import copy
|
||||
|
|
@ -453,5 +454,5 @@ def _test():
|
|||
"B": tableB})
|
||||
|
||||
# unicode is required since the example contains non-ascii characters
|
||||
print unicode(form)
|
||||
print(unicode(form))
|
||||
return form
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ your default cmdset. Run it with this module, like `testdemo
|
|||
evennia.utils.evdemo`.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from textwrap import dedent
|
||||
from inspect import isfunction, getargspec
|
||||
|
|
@ -203,7 +204,7 @@ class CmdEvMenuNode(Command):
|
|||
cmd_on_quit = menu.cmd_on_quit
|
||||
default = menu.default
|
||||
|
||||
print "cmd, options:", cmd, options
|
||||
print("cmd, options:", cmd, options)
|
||||
if cmd in options:
|
||||
# this will overload the other commands
|
||||
# if it has the same name!
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ you need to re-set the color to have it appear on both sides of the
|
|||
table string.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
#from textwrap import wrap
|
||||
from django.conf import settings
|
||||
from textwrap import TextWrapper
|
||||
|
|
@ -1266,7 +1267,7 @@ class EvTable(object):
|
|||
for ix, col in enumerate(self.worktable):
|
||||
try:
|
||||
col.reformat(width=cwidths[ix], **options)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = "ix=%s, width=%s: %s" % (ix, cwidths[ix], e.message)
|
||||
raise #Exception ("Error in horizontal allign:\n %s" % msg)
|
||||
|
||||
|
|
@ -1315,7 +1316,7 @@ class EvTable(object):
|
|||
for iy, cell in enumerate(col):
|
||||
try:
|
||||
col.reformat_cell(iy, height=cheights[iy], **options)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = "ix=%s, iy=%s, height=%s: %s" % (ix, iy, cheights[iy], e.message)
|
||||
raise Exception ("Error in vertical allign:\n %s" % msg)
|
||||
|
||||
|
|
@ -1534,11 +1535,11 @@ def _test():
|
|||
table = EvTable("{yHeading1{n", "{gHeading2{n", table=[[1,2,3],[4,5,6],[7,8,9]], border="cells", align="l")
|
||||
table.add_column("{rThis is long data{n", "{bThis is even longer data{n")
|
||||
table.add_row("This is a single row")
|
||||
print unicode(table)
|
||||
print(unicode(table))
|
||||
table.reformat(width=50)
|
||||
print unicode(table)
|
||||
print(unicode(table))
|
||||
table.reformat_column(3, width=30, align='r')
|
||||
print unicode(table)
|
||||
print(unicode(table))
|
||||
return table
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ leave caching unexpectedly (no use of WeakRefs).
|
|||
|
||||
Also adds `cache_size()` for monitoring the size of the cache.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os, threading, gc, time
|
||||
#from twisted.internet import reactor
|
||||
|
|
@ -19,7 +20,7 @@ from django.db.models.signals import pre_delete, post_syncdb
|
|||
from evennia.utils import logger
|
||||
from evennia.utils.utils import dbref, get_evennia_pids, to_str
|
||||
|
||||
from manager import SharedMemoryManager
|
||||
from .manager import SharedMemoryManager
|
||||
|
||||
AUTO_FLUSH_MIN_INTERVAL = 60.0 * 5 # at least 5 mins between cache flushes
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import absolute_import
|
||||
from django.test import TestCase
|
||||
|
||||
from models import SharedMemoryModel
|
||||
from .models import SharedMemoryModel
|
||||
from django.db import models
|
||||
|
||||
class Category(SharedMemoryModel):
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def log_trace(errmsg=None):
|
|||
if errmsg:
|
||||
try:
|
||||
errmsg = str(errmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
errmsg = str(e)
|
||||
for line in errmsg.splitlines():
|
||||
log.msg('[EE] %s' % line)
|
||||
|
|
@ -59,7 +59,7 @@ def log_err(errmsg):
|
|||
"""
|
||||
try:
|
||||
errmsg = str(errmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
errmsg = str(e)
|
||||
for line in errmsg.splitlines():
|
||||
log.msg('[EE] %s' % line)
|
||||
|
|
@ -77,7 +77,7 @@ def log_warn(warnmsg):
|
|||
"""
|
||||
try:
|
||||
warnmsg = str(warnmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
warnmsg = str(e)
|
||||
for line in warnmsg.splitlines():
|
||||
log.msg('[WW] %s' % line)
|
||||
|
|
@ -93,7 +93,7 @@ def log_info(infomsg):
|
|||
"""
|
||||
try:
|
||||
infomsg = str(infomsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
infomsg = str(e)
|
||||
for line in infomsg.splitlines():
|
||||
log.msg('[..] %s' % line)
|
||||
|
|
@ -109,7 +109,7 @@ def log_dep(depmsg):
|
|||
"""
|
||||
try:
|
||||
depmsg = str(depmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
depmsg = str(e)
|
||||
for line in depmsg.splitlines():
|
||||
log.msg('[DP] %s' % line)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from __future__ import print_function
|
||||
__version__ = "trunk"
|
||||
|
||||
import copy
|
||||
|
|
@ -1375,7 +1376,7 @@ def from_csv(fp, field_names = None, **kwargs):
|
|||
if py3k:
|
||||
table.field_names = [x.strip() for x in next(reader)]
|
||||
else:
|
||||
table.field_names = [x.strip() for x in reader.next()]
|
||||
table.field_names = [x.strip() for x in next(reader)]
|
||||
|
||||
for row in reader:
|
||||
table.add_row([x.strip() for x in row])
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ otherwise have the same spells as a *goblin wizard* who in turn shares
|
|||
many traits with a normal *goblin*.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import copy
|
||||
#TODO
|
||||
|
|
@ -274,4 +275,4 @@ if __name__ == "__main__":
|
|||
}
|
||||
}
|
||||
# test
|
||||
print [o.key for o in spawn(protparents["GOBLIN"], protparents["GOBLIN_ARCHWIZARD"], prototype_parents=protparents)]
|
||||
print([o.key for o in spawn(protparents["GOBLIN"], protparents["GOBLIN_ARCHWIZARD"], prototype_parents=protparents)])
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@ snippet #577349 on http://code.activestate.com.
|
|||
|
||||
(extensively modified by Griatch 2010)
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import re
|
||||
import cgi
|
||||
from ansi import *
|
||||
from .ansi import *
|
||||
|
||||
|
||||
class TextToHTMLparser(object):
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ class WebSocketProtocol(ProtocolWrapper):
|
|||
|
||||
try:
|
||||
frames, self.buf = parser(self.buf)
|
||||
except WSException, wse:
|
||||
except WSException as wse:
|
||||
# Couldn't parse all the frames, something went wrong, let's bail.
|
||||
self.close(wse.args[0])
|
||||
return
|
||||
|
|
|
|||
|
|
@ -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 print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -869,7 +870,7 @@ def check_evennia_dependencies():
|
|||
errstring = errstring.strip()
|
||||
if errstring:
|
||||
mlen = max(len(line) for line in errstring.split("\n"))
|
||||
print "%s\n%s\n%s" % ("-"*mlen, errstring, '-'*mlen)
|
||||
print("%s\n%s\n%s" % ("-"*mlen, errstring, '-'*mlen))
|
||||
return not_error
|
||||
|
||||
|
||||
|
|
@ -917,7 +918,7 @@ def mod_import(module):
|
|||
adds an extra line with added info.
|
||||
"""
|
||||
from twisted.python import log
|
||||
print errmsg
|
||||
print(errmsg)
|
||||
|
||||
tracestring = traceback.format_exc()
|
||||
if tracestring:
|
||||
|
|
@ -926,7 +927,7 @@ def mod_import(module):
|
|||
if errmsg:
|
||||
try:
|
||||
errmsg = to_str(errmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
errmsg = str(e)
|
||||
for line in errmsg.splitlines():
|
||||
log.msg('[EE] %s' % line)
|
||||
|
|
@ -941,7 +942,7 @@ def mod_import(module):
|
|||
# first try to import as a python path
|
||||
try:
|
||||
mod = __import__(module, fromlist=["None"])
|
||||
except ImportError, ex:
|
||||
except ImportError as ex:
|
||||
# check just where the ImportError happened (it could have been
|
||||
# an erroneous import inside the module as well). This is the
|
||||
# trivial way to do it ...
|
||||
|
|
@ -1104,7 +1105,7 @@ def fuzzy_import_from_module(path, variable, default=None, defaultpaths=None):
|
|||
for modpath in paths:
|
||||
try:
|
||||
mod = import_module(path)
|
||||
except ImportError, ex:
|
||||
except ImportError as ex:
|
||||
if not str(ex).startswith ("No module named %s" % path):
|
||||
# this means the module was found but it
|
||||
# triggers an ImportError on import.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue