summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/agile.py3
-rw-r--r--pygments/lexers/math.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py
index 896a3deb..1f81365e 100644
--- a/pygments/lexers/agile.py
+++ b/pygments/lexers/agile.py
@@ -185,7 +185,8 @@ class PythonLexer(RegexLexer):
}
def analyse_text(text):
- return shebang_matches(text, r'pythonw?(2(\.\d)?)?')
+ return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
+ 'import ' in text[:1000]
class Python3Lexer(RegexLexer):
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):
"""