from __future__ imports to all your modulesu'' to '')print '' to print(''))
from __future__ import (
unicode_literals,
print_function,
absolute_import,
division,
)
from rastools.raspase import RasParser
# ^--- absolute import
print('Some stuff')
# ^--- using print function
from PIL import Image
try:
# XXX Py2 only
from cStringIO import StringIO
except ImportError:
# XXX Py2 only
from StringIO import StringIO
except ImportError:
# XXX Py3 only
from io import StringIO
try:
self._file = open(filename_or_obj, 'w')
except TypeError:
self._file = filename_or_obj
Instead of:
if isinstance(filename_or_obj, basestring):
self._file = open(filename_or_obj, 'w')
else:
self._file = filename_or_obj
/
#