def prompt_python(msg: str, get_globals: t.Callable[[str], t.Any], get_locals: t.Callable[[str], t.Any]) -> str:
"""
Prompt for python code.
:param get_globals: function that returns the global variables
:param get_locals: function that returns the local variables
:return: user input
"""
from ptpython.completer import PythonCompleter
from pygments.lexers.python import Python3Lexer
python_completer = PythonCompleter(get_globals, get_locals)
return prompt(msg, multiline=True, mouse_support=True, lexer=PygmentsLexer(Python3Lexer),
completer=python_completer)
评论列表
文章目录