diff options
author | Georg Brandl <georg@python.org> | 2013-05-20 07:42:12 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2013-05-20 07:42:12 +0200 |
commit | 529f6da8a1fa76baf4e0d7e8d332b5ead56b48de (patch) | |
tree | 38536537148dc45c43067b068ce21f8fa665e0f9 /pygments/lexers/math.py | |
parent | fcc0147c89efa90a992bf9a5b8560ef72eaba1eb (diff) | |
download | pygments-529f6da8a1fa76baf4e0d7e8d332b5ead56b48de.tar.gz |
Closes #863: improve analyse_text of Python and Numpy lexers
Diffstat (limited to 'pygments/lexers/math.py')
-rw-r--r-- | pygments/lexers/math.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py index a72a9124..f0e49fef 100644 --- a/pygments/lexers/math.py +++ b/pygments/lexers/math.py @@ -983,6 +983,11 @@ class NumPyLexer(PythonLexer): else: yield index, token, value + def analyse_text(text): + return (shebang_matches(text, r'pythonw?(2(\.\d)?)?') or + 'import ' in text[:1000]) \ + and ('import numpy' in text or 'from numpy import' in text) + class RConsoleLexer(Lexer): """ |