本文整理匯總了Python中xonsh.lexer.Lexer.input方法的典型用法代碼示例。如果您正苦於以下問題:Python Lexer.input方法的具體用法?Python Lexer.input怎麽用?Python Lexer.input使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xonsh.lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.input方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_token
# 需要導入模塊: from xonsh.lexer import Lexer [as 別名]
# 或者: from xonsh.lexer.Lexer import input [as 別名]
def check_token(inp, exp):
l = Lexer()
l.input(inp)
obs = list(l)
if len(obs) != 1:
msg = 'The observed sequence does not have length-1: {0!r} != 1\n'
msg += '# obs\n{1}'
raise AssertionError(msg.format(len(obs), pformat(obs)))
return assert_token_equal(exp, obs[0])
示例2: check_token
# 需要導入模塊: from xonsh.lexer import Lexer [as 別名]
# 或者: from xonsh.lexer.Lexer import input [as 別名]
def check_token(inp, exp):
l = Lexer()
l.input(inp)
obs = list(l)
if len(obs) != 1:
msg = "The observed sequence does not have length-1: {0!r} != 1\n"
msg += "# obs\n{1}"
pytest.fail(msg.format(len(obs), pformat(obs)))
return assert_token_equal(exp, obs[0])
示例3: check_tokens_subproc
# 需要導入模塊: from xonsh.lexer import Lexer [as 別名]
# 或者: from xonsh.lexer.Lexer import input [as 別名]
def check_tokens_subproc(inp, exp):
l = Lexer()
l.input('$[{}]'.format(inp))
obs = list(l)[1:-1]
return assert_tokens_equal(exp, obs)
示例4: check_tokens
# 需要導入模塊: from xonsh.lexer import Lexer [as 別名]
# 或者: from xonsh.lexer.Lexer import input [as 別名]
def check_tokens(inp, exp):
l = Lexer()
l.input(inp)
obs = list(l)
return assert_tokens_equal(exp, obs)
示例5: test_redir_whitespace
# 需要導入模塊: from xonsh.lexer import Lexer [as 別名]
# 或者: from xonsh.lexer.Lexer import input [as 別名]
def test_redir_whitespace(case):
inp = '![{}/path/to/file]'.format(case)
l = Lexer()
l.input(inp)
obs = list(l)
assert obs[2].type == 'WS'
示例6: check_tokens_subproc
# 需要導入模塊: from xonsh.lexer import Lexer [as 別名]
# 或者: from xonsh.lexer.Lexer import input [as 別名]
def check_tokens_subproc(inp, exp, stop=-1):
l = Lexer()
l.input("$[{}]".format(inp))
obs = list(l)[1:stop]
return assert_tokens_equal(exp, obs)