本文整理汇总了Python中prompt_toolkit.buffer.Buffer.accept_action方法的典型用法代码示例。如果您正苦于以下问题:Python Buffer.accept_action方法的具体用法?Python Buffer.accept_action怎么用?Python Buffer.accept_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prompt_toolkit.buffer.Buffer
的用法示例。
在下文中一共展示了Buffer.accept_action方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ctx
# 需要导入模块: from prompt_toolkit.buffer import Buffer [as 别名]
# 或者: from prompt_toolkit.buffer.Buffer import accept_action [as 别名]
def ctx():
"""Context in which the ptk multiline functionality will be tested."""
builtins.__xonsh_env__ = DummyEnv()
builtins.__xonsh_env__['INDENT'] = ' '
from xonsh.ptk.key_bindings import carriage_return
ptk_buffer = Buffer()
ptk_buffer.accept_action = MagicMock(name='accept', spec=AcceptAction)
cli = MagicMock(name='cli', spec=CommandLineInterface)
yield Context(indent=' ',
buffer=ptk_buffer,
accept=ptk_buffer.accept_action,
cli=cli,
cr=carriage_return)
del builtins.__xonsh_env__
示例2: ctx
# 需要导入模块: from prompt_toolkit.buffer import Buffer [as 别名]
# 或者: from prompt_toolkit.buffer.Buffer import accept_action [as 别名]
def ctx():
"""Context in which the ptk multiline functionality will be tested."""
builtins.__xonsh__ = XonshSession()
builtins.__xonsh__.env = DummyEnv()
builtins.__xonsh__.env["INDENT"] = " "
from xonsh.ptk2.key_bindings import carriage_return
ptk_buffer = Buffer()
ptk_buffer.accept_action = MagicMock(name="accept")
cli = MagicMock(name="cli", spec=Application)
yield Context(
indent=" ",
buffer=ptk_buffer,
accept=ptk_buffer.accept_action,
cli=cli,
cr=carriage_return,
)
del builtins.__xonsh__.env
del builtins.__xonsh__
示例3: setup
# 需要导入模块: from prompt_toolkit.buffer import Buffer [as 别名]
# 或者: from prompt_toolkit.buffer.Buffer import accept_action [as 别名]
def setup():
global indent_
global buffer
global bufaccept
global cli
global carriage_return
global builtins
import builtins
builtins.__xonsh_env__ = Env()
builtins.__xonsh_env__['INDENT'] = ' '
from xonsh.ptk.key_bindings import carriage_return
indent_ = ' '
buffer = Buffer()
bufaccept = MagicMock(name='accept', spec=AcceptAction)
cli = MagicMock(name='cli', spec=CommandLineInterface)
buffer.accept_action = bufaccept