diff --git a/compressor/filters/base.py b/compressor/filters/base.py index 7154dbd..6822d69 100644 --- a/compressor/filters/base.py +++ b/compressor/filters/base.py @@ -136,7 +136,7 @@ class CompilerFilter(FilterBase): # something different than utf8. If that's the case file will # be included with charset="something" html attribute and # charset will be available as filter's charset attribute - encoding = self.charset #or self.default_encoding + encoding = self.charset # or self.default_encoding self.infile = open(self.filename) options["infile"] = self.filename diff --git a/compressor/filters/cssmin/cssmin.py b/compressor/filters/cssmin/cssmin.py index 155a32d..e8a02b0 100644 --- a/compressor/filters/cssmin/cssmin.py +++ b/compressor/filters/cssmin/cssmin.py @@ -30,14 +30,6 @@ import re -try: - from cStringIO import StringIO -except ImportError: - try: - from StringIO import StringIO - except ImportError: - from io import StringIO # python 3 - __version__ = '0.1.4' diff --git a/compressor/management/commands/mtime_cache.py b/compressor/management/commands/mtime_cache.py index bfea571..e96f004 100644 --- a/compressor/management/commands/mtime_cache.py +++ b/compressor/management/commands/mtime_cache.py @@ -74,9 +74,9 @@ class Command(NoArgsCommand): if keys_to_delete: cache.delete_many(list(keys_to_delete)) - print "Deleted mtimes of %d files from the cache." % len(keys_to_delete) + print("Deleted mtimes of %d files from the cache." % len(keys_to_delete)) if files_to_add: for filename in files_to_add: get_mtime(filename) - print "Added mtimes of %d files to cache." % len(files_to_add) + print("Added mtimes of %d files to cache." % len(files_to_add)) diff --git a/compressor/utils/compat.py b/compressor/utils/compat.py deleted file mode 100644 index 273a818..0000000 --- a/compressor/utils/compat.py +++ /dev/null @@ -1,35 +0,0 @@ -# noqa -import six - -try: - from django.utils.encoding import force_text, force_bytes - from django.utils.encoding import smart_text, smart_bytes -except ImportError: - # django < 1.4.2 - from django.utils.encoding import force_unicode as force_text - from django.utils.encoding import force_str as force_bytes - from django.utils.encoding import smart_unicode as smart_text - from django.utils.encoding import smart_str as smart_bytes - - -try: - from django.utils import unittest -except ImportError: - import unittest2 as unittest - - -if six.PY3: - # there is an 'io' module in python 2.6+, but io.StringIO does not - # accept regular strings, just unicode objects - from io import StringIO -else: - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - -try: - from urllib.request import url2pathname -except ImportError: - from urllib import url2pathname - diff --git a/compressor/utils/stringformat.py b/compressor/utils/stringformat.py index 0cfba86..3be63e4 100644 --- a/compressor/utils/stringformat.py +++ b/compressor/utils/stringformat.py @@ -250,7 +250,7 @@ def selftest(): d = datetime.date(2010, 9, 7) assert F(u"The year is {0.year}").format(d) == u"The year is 2010" assert F(u"Tested on {0:%Y-%m-%d}").format(d) == u"Tested on 2010-09-07" - print 'Test successful' + print('Test successful') if __name__ == '__main__': selftest()