本文整理汇总了Python中utils.compile_source函数的典型用法代码示例。如果您正苦于以下问题:Python compile_source函数的具体用法?Python compile_source怎么用?Python compile_source使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compile_source函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: test_bad_instantiation_2
def test_bad_instantiation_2():
source = dedent("""\
from enaml.widgets.api import *
template Other(A, B, C):
Field: pass
enamldef Main(Window):
Other(): pass
""")
compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:12,代码来源:test_template.py
示例17: test_ordering
def test_ordering():
source = dedent("""\
from enaml.widgets.api import *
enamldef Content(Container):
Field: field:
alias this_text: field.text
alias text: field.this_text
enamldef Main(Window):
Content:
pass
""")
compile_source(source, 'Main')
开发者ID:nucleic,项目名称:enaml,代码行数:15,代码来源:test_alias.py
示例18: test_syntax_3
def test_syntax_3():
source = dedent("""\
from enaml.widgets.api import *
enamldef Content(Container):
alias pc: pb.text
PushButton: pb:
name = 'button'
enamldef Main(Window):
Content:
name = 'content'
""")
compile_source(source, 'Main')
开发者ID:nucleic,项目名称:enaml,代码行数:15,代码来源:test_alias.py
示例19: test_bad_instantiation_8
def test_bad_instantiation_8():
source = dedent("""\
from enaml.widgets.api import *
template Foo():
Field: pass
Field: pass
Field: pass
enamldef Main(Window):
Foo(): a, b, c, d:
pass
""")
compile_source(source, 'Main')
开发者ID:rutsky,项目名称:enaml,代码行数:15,代码来源:test_template.py
示例20: test_bar_ordering
def test_bar_ordering():
source = dedent("""\
from enaml.widgets.api import *
enamldef Content(Container):
alias text: field.this_text
Field: field:
alias this_text: field.text
enamldef Main(Window):
Content:
pass
""")
with pytest.raises(TypeError):
compile_source(source, 'Main')
开发者ID:nucleic,项目名称:enaml,代码行数:16,代码来源:test_alias.py
注:本文中的utils.compile_source函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论