diff options
author | gbrandl <devnull@localhost> | 2006-10-29 17:51:32 +0100 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2006-10-29 17:51:32 +0100 |
commit | c427602fe901b202bf8f74eeeaff642c5b377431 (patch) | |
tree | bf2e9671a2752732d29af7c96052a464953555ef | |
parent | 415b0f78ad57c1ebd37cfbdeda525c8e791b20ea (diff) | |
download | pygments-c427602fe901b202bf8f74eeeaff642c5b377431.tar.gz |
[svn] Fix some pylint errors.
-rw-r--r-- | pygments/lexer.py | 3 | ||||
-rw-r--r-- | pygments/lexers/__init__.py | 8 | ||||
-rw-r--r-- | pygments/lexers/templates.py | 2 | ||||
-rw-r--r-- | pygments/style.py | 2 |
4 files changed, 9 insertions, 6 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py index 28c5c825..3566f50e 100644 --- a/pygments/lexer.py +++ b/pygments/lexer.py @@ -371,6 +371,9 @@ class RegexLexer(Lexer): #: current one. tokens = {} + #: Processed tokens dict. This is filled by the metaclass. + _tokens = {} + def get_tokens_unprocessed(self, text, stack=['root']): """ Split ``text`` into (tokentype, text) pairs. diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py index 529e3cb3..9ae4baf9 100644 --- a/pygments/lexers/__init__.py +++ b/pygments/lexers/__init__.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- ++# -*- coding: utf-8 -*- """ pygments.lexers ~~~~~~~~~~~~~~~ @@ -68,7 +68,7 @@ def get_lexer_for_filename(_fn, **options): for cls in find_plugin_lexers(): for filename in cls.filenames: if fnmatch.fnmatch(_fn, filename): - return lexer(**options) + return cls(**options) raise ValueError('no lexer for filename %r found' % _fn) @@ -83,7 +83,7 @@ def get_lexer_for_mimetype(_mime, **options): return _lexer_cache[name](**options) for cls in find_plugin_lexers(): if _mime in cls.mimetypes: - return lexer(**options) + return cls(**options) raise ValueError('no lexer for mimetype %r found' % _mime) @@ -150,7 +150,7 @@ def guess_lexer(_text, **options): # better guess_lexer_for_filename function. best_lexer = [0.0, None] for lexer in _iter_lexerclasses(): - rv = lexer.analyse_text(text) + rv = lexer.analyse_text(_text) if rv == 1.0: return lexer(**options) if rv > best_lexer[0]: diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 09454f2b..666bd5a7 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -21,7 +21,7 @@ from pygments.lexers.agile import PythonLexer from pygments.lexer import \ Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, \ include, using -from pygments.token import \ +from pygments.token import Error, \ Text, Comment, Operator, Keyword, Name, String, Number, Other from pygments.util import html_doctype_matches, looks_like_xml diff --git a/pygments/style.py b/pygments/style.py index 07ea9746..caf6ca00 100644 --- a/pygments/style.py +++ b/pygments/style.py @@ -82,7 +82,7 @@ class StyleMeta(type): } def list_styles(cls): - return list(self) + return list(cls) def __iter__(cls): for token in cls._styles: |