当前位置: 首页>>代码示例>>Python>>正文


Python utils.compile_source函数代码示例

本文整理汇总了Python中utils.compile_source函数的典型用法代码示例。如果您正苦于以下问题:Python compile_source函数的具体用法?Python compile_source怎么用?Python compile_source使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了compile_source函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bad_syntax_9

def test_bad_syntax_9():
    source = dedent("""\
    template Main():
        alias value

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例2: test_syntax_10

def test_syntax_10():
    source = dedent("""\
    template Main(A=None):
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例3: test_bad_syntax_3

def test_bad_syntax_3():
    source = dedent("""\
    template Main:
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例4: test_bad_syntax_14

def test_bad_syntax_14():
    source = dedent("""\
    template Main(*C, A=None)
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例5: test_bad_syntax_8

def test_bad_syntax_8():
    source = dedent("""\
    template Main():
        event value

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例6: test_syntax_9

def test_syntax_9():
    source = dedent("""\
    template Main(A, B: 12, *C):
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例7: test_bad_syntax_17

def test_bad_syntax_17():
    source = dedent("""\
    template Main():
        Foo(): a, *c

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例8: test_syntax_14

def test_syntax_14():
    source = dedent("""\
    template Main(A, B: 12, C=None, *D):
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例9: test_bad_syntax_19

def test_bad_syntax_19():
    source = dedent("""\
    template Main(Arg):
        const Arg = 12

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例10: test_bad_syntax_12

def test_bad_syntax_12():
    source = dedent("""\
    template Main(A, B=None, C):
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例11: test_syntax_3

def test_syntax_3():
    source = dedent("""\
    template Main():
        const value = 12

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:7,代码来源:test_template.py

示例12: test_bad_syntax_18

def test_bad_syntax_18():
    source = dedent("""\
    template Main():
        Field: a: pass
        Foo(): a: pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:8,代码来源:test_template.py

示例13: test_bad_syntax_20

def test_bad_syntax_20():
    source = dedent("""\
    template Main(Arg):
        const Args = 12
        Field: Args: pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:8,代码来源:test_template.py

示例14: test_syntax_15

def test_syntax_15():
    source = dedent("""\
    template Main(A, B, C):
        Field:
            pass
        PushButton:
            pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:10,代码来源:test_template.py

示例15: test_bad_instantiation_4

def test_bad_instantiation_4():
    source = dedent("""\
    template Other(A):
        pass

    template Other(A):
        pass

    """)
    compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:10,代码来源:test_template.py


注:本文中的utils.compile_source函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。