當前位置: 首頁>>代碼示例>>Python>>正文


Python lexers.PygmentsLexer方法代碼示例

本文整理匯總了Python中prompt_toolkit.layout.lexers.PygmentsLexer方法的典型用法代碼示例。如果您正苦於以下問題:Python lexers.PygmentsLexer方法的具體用法?Python lexers.PygmentsLexer怎麽用?Python lexers.PygmentsLexer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在prompt_toolkit.layout.lexers的用法示例。


在下文中一共展示了lexers.PygmentsLexer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: prompt

# 需要導入模塊: from prompt_toolkit.layout import lexers [as 別名]
# 或者: from prompt_toolkit.layout.lexers import PygmentsLexer [as 別名]
def prompt(self, msg):
        """Get input using prompt_toolkit."""
        try:
            # prompt_toolkit v2
            prompt = prompt_toolkit.PromptSession(history=self.history).prompt
        except AttributeError:
            # prompt_toolkit v1
            prompt = partial(prompt_toolkit.prompt, history=self.history)
        return prompt(
            msg,
            multiline=self.multiline,
            vi_mode=self.vi_mode,
            wrap_lines=self.wrap_lines,
            enable_history_search=self.history_search,
            lexer=PygmentsLexer(CoconutLexer),
            style=style_from_pygments_cls(
                pygments.styles.get_style_by_name(self.style),
            ),
        ) 
開發者ID:evhub,項目名稱:coconut,代碼行數:21,代碼來源:util.py

示例2: get_lexers

# 需要導入模塊: from prompt_toolkit.layout import lexers [as 別名]
# 或者: from prompt_toolkit.layout.lexers import PygmentsLexer [as 別名]
def get_lexers(main_lex, exam_lex, tool_lex):
    """ gets all the lexer wrappers """
    if not main_lex:
        return None, None, None
    lexer = None
    if issubclass(main_lex, PromptLex):
        lexer = main_lex
    elif issubclass(main_lex, PygLex):
        lexer = PygmentsLexer(main_lex)

    if exam_lex:
        if issubclass(exam_lex, PygLex):
            exam_lex = PygmentsLexer(exam_lex)
    if tool_lex:
        if issubclass(tool_lex, PygLex):
            tool_lex = PygmentsLexer(tool_lex)
    return lexer, exam_lex, tool_lex 
開發者ID:Azure,項目名稱:azure-cli-shell,代碼行數:19,代碼來源:layout.py

示例3: __init__

# 需要導入模塊: from prompt_toolkit.layout import lexers [as 別名]
# 或者: from prompt_toolkit.layout.lexers import PygmentsLexer [as 別名]
def __init__(self, parser, engine, options=None):
        self.parser = parser
        self.engine = engine
        self.options = options if options is not None else {}
        util.ensure_data_dir_exists()
        application = create_prompt_application(
            message='> ',
            lexer=PygmentsLexer(SqlLexer),
            history=FileHistory(os.path.expanduser('~/.aq/history')),
            completer=AqCompleter(schemas=engine.available_schemas, tables=engine.available_tables),
            auto_suggest=AutoSuggestFromHistory(),
            validator=QueryValidator(parser),
            on_abort=AbortAction.RETRY,
        )
        loop = create_eventloop()
        self.cli = CommandLineInterface(application=application, eventloop=loop)
        self.patch_context = self.cli.patch_stdout_context() 
開發者ID:lebinh,項目名稱:aq,代碼行數:19,代碼來源:prompt.py


注:本文中的prompt_toolkit.layout.lexers.PygmentsLexer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。