diff options
author | Georg Brandl <georg@python.org> | 2021-01-17 11:14:50 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2021-01-17 11:18:00 +0100 |
commit | 7e6dbb20ce189022f1b0a058f44bd1c0b9d529a5 (patch) | |
tree | 703e02a2569c321273d78eb3ecad0be8e110d87c | |
parent | ff1e7567b3c67eb07b0c188f87c062bb8df39def (diff) | |
download | pygments-git-7e6dbb20ce189022f1b0a058f44bd1c0b9d529a5.tar.gz |
Do not guess MIME or SQL without reason
constant returns from analyse_text are not useful.
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pygments/lexers/mime.py | 2 | ||||
-rw-r--r-- | pygments/lexers/sql.py | 3 | ||||
-rw-r--r-- | tests/test_sql.py | 1 |
4 files changed, 2 insertions, 5 deletions
@@ -13,6 +13,7 @@ Version 2.8.0 - Fix escapes in JavaScript backtick strings (#1679) - Make guessing prefer Python 3 lexer +- Do not guess MIME or SQL without reason Version 2.7.4 diff --git a/pygments/lexers/mime.py b/pygments/lexers/mime.py index a7c93320..2e21af79 100644 --- a/pygments/lexers/mime.py +++ b/pygments/lexers/mime.py @@ -77,7 +77,7 @@ class MIMELexer(RegexLexer): return 1 except ValueError: - return 0.1 + return 0 def get_header_tokens(self, match): field = match.group(1) diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py index 7a79fcf6..c8a2e440 100644 --- a/pygments/lexers/sql.py +++ b/pygments/lexers/sql.py @@ -497,9 +497,6 @@ class SqlLexer(RegexLexer): ] } - def analyse_text(text): - return 0.01 - class TransactSqlLexer(RegexLexer): """ diff --git a/tests/test_sql.py b/tests/test_sql.py index b76246e2..5a2cadb8 100644 --- a/tests/test_sql.py +++ b/tests/test_sql.py @@ -95,7 +95,6 @@ def test_can_analyze_text(): tsql_lexer = TransactSqlLexer() code_to_expected_lexer_map = { 'select `a`, `bc` from some': mysql_lexer, - 'select a, bc from some': sql_lexer, 'select [a], [bc] from some': tsql_lexer, '-- `a`, `bc`\nselect [a], [bc] from some': tsql_lexer, '-- `a`, `bc`\nselect [a], [bc] from some; go': tsql_lexer, |