ThirdParty/Pygments/pygments/formatters/html.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 684
2f29a0b6e1c7
--- a/ThirdParty/Pygments/pygments/formatters/html.py	Fri Jan 01 16:11:36 2010 +0000
+++ b/ThirdParty/Pygments/pygments/formatters/html.py	Sat Jan 02 15:11:35 2010 +0000
@@ -9,7 +9,7 @@
     :license: BSD, see LICENSE for details.
 """
 import sys, os
-import StringIO
+import io
 
 try:
     set
@@ -417,7 +417,7 @@
         """
         if arg is None:
             arg = ('cssclass' in self.options and '.'+self.cssclass or '')
-        if isinstance(arg, basestring):
+        if isinstance(arg, str):
             args = [arg]
         else:
             args = list(arg)
@@ -431,7 +431,7 @@
             return ', '.join(tmp)
 
         styles = [(level, ttype, cls, style)
-                  for cls, (style, ttype, level) in self.class2style.iteritems()
+                  for cls, (style, ttype, level) in self.class2style.items()
                   if cls and style]
         styles.sort()
         lines = ['%s { %s } /* %s */' % (prefix(cls), style, repr(ttype)[6:])
@@ -469,8 +469,8 @@
                     cssfilename = os.path.join(os.path.dirname(filename),
                                                self.cssfile)
                 except AttributeError:
-                    print >>sys.stderr, 'Note: Cannot determine output file name, ' \
-                          'using current directory as base for the CSS file name'
+                    print('Note: Cannot determine output file name, ' \
+                          'using current directory as base for the CSS file name', file=sys.stderr)
                     cssfilename = self.cssfile
             # write CSS file only if noclobber_cssfile isn't given as an option.
             try:
@@ -479,7 +479,7 @@
                     cf.write(CSSFILE_TEMPLATE %
                             {'styledefs': self.get_style_defs('body')})
                     cf.close()
-            except IOError, err:
+            except IOError as err:
                 err.strerror = 'Error writing CSS file: ' + err.strerror
                 raise
 
@@ -498,7 +498,7 @@
         yield 0, DOC_FOOTER
 
     def _wrap_tablelinenos(self, inner):
-        dummyoutfile = StringIO.StringIO()
+        dummyoutfile = io.StringIO()
         lncount = 0
         for t, line in inner:
             if t:

eric ide

mercurial