682:91114a975eda | 684:2f29a0b6e1c7 |
---|---|
3 pygments.util | 3 pygments.util |
4 ~~~~~~~~~~~~~ | 4 ~~~~~~~~~~~~~ |
5 | 5 |
6 Utility functions. | 6 Utility functions. |
7 | 7 |
8 :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. | 8 :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. | 9 :license: BSD, see LICENSE for details. |
10 """ | 10 """ |
11 | |
11 import re | 12 import re |
12 import sys | 13 import sys |
14 import codecs | |
13 | 15 |
14 | 16 |
15 split_path_re = re.compile(r'[/\\ ]') | 17 split_path_re = re.compile(r'[/\\ ]') |
16 doctype_lookup_re = re.compile(r'''(?smx) | 18 doctype_lookup_re = re.compile(r'''(?smx) |
17 (<\?.*?\?>)?\s* | 19 (<\?.*?\?>)?\s* |
204 b = bytes = str | 206 b = bytes = str |
205 u_prefix = 'u' | 207 u_prefix = 'u' |
206 import io, io | 208 import io, io |
207 BytesIO = io.StringIO | 209 BytesIO = io.StringIO |
208 StringIO = io.StringIO | 210 StringIO = io.StringIO |
211 uni_open = codecs.open | |
209 else: | 212 else: |
210 import builtins | 213 import builtins |
211 bytes = builtins.bytes | 214 bytes = builtins.bytes |
212 u_prefix = '' | 215 u_prefix = '' |
213 def b(s): | 216 def b(s): |
218 else: | 221 else: |
219 raise TypeError("Invalid argument %r for b()" % (s,)) | 222 raise TypeError("Invalid argument %r for b()" % (s,)) |
220 import io | 223 import io |
221 BytesIO = io.BytesIO | 224 BytesIO = io.BytesIO |
222 StringIO = io.StringIO | 225 StringIO = io.StringIO |
226 uni_open = builtins.open |