ThirdParty/Pygments/pygments/util.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 684
2f29a0b6e1c7
child 884
901cf274435c
--- a/ThirdParty/Pygments/pygments/util.py	Fri Jan 01 16:11:36 2010 +0000
+++ b/ThirdParty/Pygments/pygments/util.py	Sat Jan 02 15:11:35 2010 +0000
@@ -50,7 +50,7 @@
         return string
     elif isinstance(string, int):
         return bool(string)
-    elif not isinstance(string, basestring):
+    elif not isinstance(string, str):
         raise OptionError('Invalid type %r for option %s; use '
                           '1/0, yes/no, true/false, on/off' % (
                           string, optname))
@@ -80,7 +80,7 @@
 
 def get_list_opt(options, optname, default=None):
     val = options.get(optname, default)
-    if isinstance(val, basestring):
+    if isinstance(val, str):
         return val.split()
     elif isinstance(val, (list, tuple)):
         return list(val)
@@ -203,16 +203,16 @@
 if sys.version_info < (3,0):
     b = bytes = str
     u_prefix = 'u'
-    import StringIO, cStringIO
-    BytesIO = cStringIO.StringIO
-    StringIO = StringIO.StringIO
+    import io, io
+    BytesIO = io.StringIO
+    StringIO = io.StringIO
 else:
     import builtins
     bytes = builtins.bytes
     u_prefix = ''
     def b(s):
         if isinstance(s, str):
-            return bytes(map(ord, s))
+            return bytes(list(map(ord, s)))
         elif isinstance(s, bytes):
             return s
         else:

eric ide

mercurial