コード例 #1
0
ファイル: test_util_ast.py プロジェクト: iris-hep/func_adl
def test_identity_isnot_body_var():
    assert lambda_is_identity(ast.parse("lambda x: x1")) is False
コード例 #2
0
ファイル: test_util_ast.py プロジェクト: iris-hep/func_adl
def test_identity_is():
    assert lambda_is_identity(ast.parse("lambda x: x")) is True
コード例 #3
0
ファイル: test_util_ast.py プロジェクト: iris-hep/func_adl
def test_identity_isnot_args():
    assert lambda_is_identity(ast.parse("lambda x,y: x")) is False
コード例 #4
0
def make_Select(source, selection):
    'Make a select, and return source is selection is an identity'
    return source if lambda_is_identity(selection) else Select(
        source, selection)
コード例 #5
0
def make_Select(source: ast.AST, selection: ast.AST):
    'Make a select, and return source is selection is an identity'
    return source if lambda_is_identity(selection) else function_call(
        'Select', [source, selection])
コード例 #6
0
ファイル: test_util_ast.py プロジェクト: sudo-panda/func_adl
def test_identity_isnot_body_var():
    assert lambda_is_identity(ast.parse('lambda x: x1')) == False
コード例 #7
0
ファイル: test_util_ast.py プロジェクト: sudo-panda/func_adl
def test_identity_isnot_args():
    assert lambda_is_identity(ast.parse('lambda x,y: x')) == False
コード例 #8
0
ファイル: test_util_ast.py プロジェクト: sudo-panda/func_adl
def test_identity_is():
    assert lambda_is_identity(ast.parse('lambda x: x')) == True