pygments.lexers.guess_lexer seems to almost always return MIMELexer when given Python code, unless there is a shebang line at the start of the code. It would be really useful if a shebang wasn't necessary for it to guess correctly.
Python 3.9.0
pygments 2.7.1
fib.py:
def fib(n):
if n < 1:
return 0
if n < 3:
return 1
return fib(n - 1) + fib(n - 2)
REPL:
>>> from pygments.lexers import guess_lexer
>>> guess_lexer(open('fib.py').read())
<pygments.lexers.MIMELexer>
pygments.lexers.guess_lexerseems to almost always returnMIMELexerwhen given Python code, unless there is a shebang line at the start of the code. It would be really useful if a shebang wasn't necessary for it to guess correctly.Python 3.9.0
pygments 2.7.1
fib.py:
REPL: