From: Jeremy Stanley Date: Mon, 20 Jan 2014 15:23:11 +0000 (+0000) Subject: Drop support for Python 2.x X-Git-Tag: 0.0.1~258 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=e0a20398d5cae3ea927132fb29a1bf76d0bb239a Drop support for Python 2.x Remove all derecated conditionals and fallbacks which provided workarounds for supporting Python 2.x versions. --- diff --git a/lib/mudpy/data.py b/lib/mudpy/data.py index 7d030c2..ad171d8 100644 --- a/lib/mudpy/data.py +++ b/lib/mudpy/data.py @@ -1,22 +1,17 @@ # -*- coding: utf-8 -*- """Data interface functions for the mudpy engine.""" -# Copyright (c) 2004-2013 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. import codecs +import configparser import os import re import stat import sys -# TODO: remove this check after the switch to py3k -try: - import configparser -except ImportError: - import ConfigParser as configparser - import mudpy diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index 2edf966..059e1be 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Miscellaneous functions for the mudpy engine.""" -# Copyright (c) 2004-2013 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -204,9 +204,6 @@ class Element: def set(self, facet, value): """Set values.""" if not self.has_facet(facet) or not self.get(facet) == value: - # TODO: remove this check after the switch to py3k - if repr(type(value)) == "": - value = str(value) if not type(value) is str: value = repr(value) self.origin.data.set(self.key, facet, value) @@ -1198,11 +1195,7 @@ def wrap_ansi_text(text, width): escape = False # normalize any potentially composited unicode before we count it - # TODO: remove this check after the switch to py3k - try: - text = unicodedata.normalize("NFKC", text) - except TypeError: - text = unicodedata.normalize("NFKC", unicode(text)) + text = unicodedata.normalize("NFKC", text) # iterate over each character from the begining of the text for each_character in text: diff --git a/lib/mudpy/password.py b/lib/mudpy/password.py index b6b4be5..f6c1abc 100644 --- a/lib/mudpy/password.py +++ b/lib/mudpy/password.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Password hashing functions and constants for the mudpy engine.""" -# Copyright (c) 2004-2013 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -163,11 +163,7 @@ def create( # number of times for i in range(2 ** rounds): hashed = algorithms[algorithm](hashed.encode("utf-8")).digest() - # TODO: remove this check after the switch to py3k - try: - hashed = "".join(format(x, "02x") for x in bytes(hashed)) - except ValueError: - hashed = "".join(format(ord(x), "02x") for x in bytes(hashed)) + hashed = "".join(format(x, "02x") for x in bytes(hashed)) # concatenate the output fields, coercing into text form as needed return "%s%s%s%s%s%s%s%s" % (