/
usr
/
lib
/
python2.6
/
site-packages
/
pygments
/
/usr/lib/python2.6/site-packages/pygments
mkdir
upload
Name
Size
Mode
Actions
filters/
-
0755
rm
formatters/
-
0755
rm
lexers/
-
0755
rm
styles/
-
0755
rm
cmdline.py
13055
0644
edit
dl
rm
cmdline.pyc
10443
0644
edit
dl
rm
cmdline.pyo
10443
0644
edit
dl
rm
console.py
1850
0644
edit
dl
rm
console.pyc
2340
0644
edit
dl
rm
console.pyo
2340
0644
edit
dl
rm
filter.py
2071
0644
edit
dl
rm
filter.pyc
3184
0644
edit
dl
rm
filter.pyo
3184
0644
edit
dl
rm
formatter.py
2790
0644
edit
dl
rm
formatter.pyc
3344
0644
edit
dl
rm
formatter.pyo
3344
0644
edit
dl
rm
lexer.py
22625
0644
edit
dl
rm
lexer.pyc
20971
0644
edit
dl
rm
lexer.pyo
20204
0644
edit
dl
rm
plugin.py
1862
0644
edit
dl
rm
plugin.pyc
2373
0644
edit
dl
rm
plugin.pyo
2373
0644
edit
dl
rm
scanner.py
3114
0644
edit
dl
rm
scanner.pyc
4174
0644
edit
dl
rm
scanner.pyo
4174
0644
edit
dl
rm
style.py
3745
0644
edit
dl
rm
style.pyc
3943
0644
edit
dl
rm
style.pyo
3867
0644
edit
dl
rm
token.py
5784
0644
edit
dl
rm
token.pyc
5408
0644
edit
dl
rm
token.pyo
5408
0644
edit
dl
rm
unistring.py
404249
0644
edit
dl
rm
unistring.pyc
208515
0644
edit
dl
rm
unistring.pyo
208515
0644
edit
dl
rm
util.py
6577
0644
edit
dl
rm
util.pyc
7797
0644
edit
dl
rm
util.pyo
7797
0644
edit
dl
rm
__init__.py
2935
0644
edit
dl
rm
__init__.pyc
3334
0644
edit
dl
rm
__init__.pyo
3334
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/site-packages/pygments/style.py
(3745B)
# -*- coding: utf-8 -*- """ pygments.style ~~~~~~~~~~~~~~ Basic style object. :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.token import Token, STANDARD_TYPES class StyleMeta(type): def __new__(mcs, name, bases, dct): obj = type.__new__(mcs, name, bases, dct) for token in STANDARD_TYPES: if token not in obj.styles: obj.styles[token] = '' def colorformat(text): if text[0:1] == '#': col = text[1:] if len(col) == 6: return col elif len(col) == 3: return col[0]+'0'+col[1]+'0'+col[2]+'0' elif text == '': return '' assert False, "wrong color format %r" % text _styles = obj._styles = {} for ttype in obj.styles: for token in ttype.split(): if token in _styles: continue ndef = _styles.get(token.parent, None) styledefs = obj.styles.get(token, '').split() if not ndef or token is None: ndef = ['', 0, 0, 0, '', '', 0, 0, 0] elif 'noinherit' in styledefs and token is not Token: ndef = _styles[Token][:] else: ndef = ndef[:] _styles[token] = ndef for styledef in obj.styles.get(token, '').split(): if styledef == 'noinherit': pass elif styledef == 'bold': ndef[1] = 1 elif styledef == 'nobold': ndef[1] = 0 elif styledef == 'italic': ndef[2] = 1 elif styledef == 'noitalic': ndef[2] = 0 elif styledef == 'underline': ndef[3] = 1 elif styledef == 'nounderline': ndef[3] = 0 elif styledef[:3] == 'bg:': ndef[4] = colorformat(styledef[3:]) elif styledef[:7] == 'border:': ndef[5] = colorformat(styledef[7:]) elif styledef == 'roman': ndef[6] = 1 elif styledef == 'sans': ndef[7] = 1 elif styledef == 'mono': ndef[8] = 1 else: ndef[0] = colorformat(styledef) return obj def style_for_token(cls, token): t = cls._styles[token] return { 'color': t[0] or None, 'bold': bool(t[1]), 'italic': bool(t[2]), 'underline': bool(t[3]), 'bgcolor': t[4] or None, 'border': t[5] or None, 'roman': bool(t[6]) or None, 'sans': bool(t[7]) or None, 'mono': bool(t[8]) or None, } def list_styles(cls): return list(cls) def styles_token(cls, ttype): return ttype in cls._styles def __iter__(cls): for token in cls._styles: yield token, cls.style_for_token(token) def __len__(cls): return len(cls._styles) class Style(object): __metaclass__ = StyleMeta #: overall background color (``None`` means transparent) background_color = '#ffffff' #: highlight background color highlight_color = '#ffffcc' #: Style definitions for individual token types. styles = {}
Save
cmd:
run