本文整理汇总了Python中holoviews.ipython.parser.OptsSpec.parse方法的典型用法代码示例。如果您正苦于以下问题:Python OptsSpec.parse方法的具体用法?Python OptsSpec.parse怎么用?Python OptsSpec.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类holoviews.ipython.parser.OptsSpec
的用法示例。
在下文中一共展示了OptsSpec.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_style_opts_intermediate_explicit
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_style_opts_intermediate_explicit(self):
line = "Layout style(string='foo' test=3, b=True )"
expected= {'Layout':{
'style': Options(string='foo',
test=3,
b=True)}}
self.assertEqual(OptsSpec.parse(line), expected)
示例2: test_combined_two_types_2
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_combined_two_types_2(self):
line = "Layout plot[fig_inches=(3, 3)] Image (string='foo') [foo='bar baz']"
expected = {
"Layout": {"plot": Options(fig_inches=(3, 3))},
"Image": {"style": Options(string="foo"), "plot": Options(foo="bar baz")},
}
self.assertEqual(OptsSpec.parse(line), expected)
示例3: test_plot_opts_with_space
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_plot_opts_with_space(self):
"Space in the tuple, see issue #77"
line = "Layout [fig_inches=(3, 3) title_format='foo bar']"
expected= {'Layout':
{'plot':
Options(title_format='foo bar', fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例4: test_combined_1
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_combined_1(self):
line = "Layout plot[fig_inches=(3,3) foo='bar baz'] Layout (string='foo')"
expected= {'Layout':
{'plot':
Options(foo='bar baz', fig_inches=(3, 3)),
'style': Options(string='foo')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例5: test_style_opts_advanced
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_style_opts_advanced(self):
line = "Layout (string='foo' test=3, b=True color=Cycle(values=[1,2]))"
expected= {'Layout':{
'style': Options(string='foo',
test=3,
b=True,
color=Cycle(values=[1,2]))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例6: test_combined_two_types_2
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_combined_two_types_2(self):
line = "Layout plot[fig_inches=(3, 3)] Image (string='foo') [foo='bar baz']"
expected= {'Layout':
{'plot':
Options(fig_inches=(3, 3))},
'Image': {
'style': Options(string='foo'),
'plot': Options(foo='bar baz')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例7: opts
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def opts(self, line='', cell=None):
"""
The opts line/cell magic with tab-completion.
%%opts [ [path] [normalization] [plotting options] [style options]]+
path: A dotted type.group.label specification
(e.g. Image.Grayscale.Photo)
normalization: List of normalization options delimited by braces.
One of | -axiswise | -framewise | +axiswise | +framewise |
E.g. { +axiswise +framewise }
plotting options: List of plotting option keywords delimited by
square brackets. E.g. [show_title=False]
style options: List of style option keywords delimited by
parentheses. E.g. (lw=10 marker='+')
Note that commas between keywords are optional (not
recommended) and that keywords must end in '=' without a
separating space.
More information may be found in the class docstring of
ipython.parser.OptsSpec.
"""
line, cell = self._partition_lines(line, cell)
try:
spec = OptsSpec.parse(line, ns=self.shell.user_ns)
except SyntaxError:
display(HTML("<b>Invalid syntax</b>: Consult <tt>%%opts?</tt> for more information."))
return
if cell:
self.register_custom_spec(spec)
# Process_element is invoked when the cell is run.
self.shell.run_cell(cell, store_history=STORE_HISTORY)
else:
try:
StoreOptions.validate_spec(spec)
except OptionError as e:
OptsMagic.error_message = None
display(HTML(self._format_options_error(e)))
return
StoreOptions.apply_customizations(spec, Store.options())
OptsMagic.error_message = None
示例8: test_combined_1
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_combined_1(self):
line = "Layout plot[fig_inches=(3,3) foo='bar baz'] Layout (string='foo')"
expected = {"Layout": {"plot": Options(foo="bar baz", fig_inches=(3, 3)), "style": Options(string="foo")}}
self.assertEqual(OptsSpec.parse(line), expected)
示例9: test_norm_opts_simple_explicit_2
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_norm_opts_simple_explicit_2(self):
line = "Layout norm{+axiswise +framewise}"
expected = {"Layout": {"norm": Options(axiswise=True, framewise=True)}}
self.assertEqual(OptsSpec.parse(line), expected)
示例10: test_style_opts_intermediate
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_style_opts_intermediate(self):
line = "Layout (string='foo' test=3, b=True)"
expected = {"Layout": {"style": Options(string="foo", test=3, b=True)}}
self.assertEqual(OptsSpec.parse(line), expected)
示例11: test_style_opts_simple_explicit
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_style_opts_simple_explicit(self):
line = "Layout style(string='foo')"
expected = {"Layout": {"style": Options(string="foo")}}
self.assertEqual(OptsSpec.parse(line), expected)
示例12: test_plot_opts_with_space_explicit
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_plot_opts_with_space_explicit(self):
line = "Layout plot[fig_inches=(3, 3) title_format='foo bar']"
expected = {"Layout": {"plot": Options(title_format="foo bar", fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例13: test_norm_opts_simple_1
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_norm_opts_simple_1(self):
line = "Layout {+axiswise}"
expected= {'Layout':
{'norm': Options(axiswise=True, framewise=False)}}
self.assertEqual(OptsSpec.parse(line), expected)
示例14: test_style_opts_simple_explicit
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_style_opts_simple_explicit(self):
line = "Layout style(string='foo')"
expected= {'Layout':{
'style': Options(string='foo')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例15: test_plot_opts_simple_explicit
# 需要导入模块: from holoviews.ipython.parser import OptsSpec [as 别名]
# 或者: from holoviews.ipython.parser.OptsSpec import parse [as 别名]
def test_plot_opts_simple_explicit(self):
line = "Layout plot[fig_inches=(3,3) title_format='foo bar']"
expected= {'Layout':
{'plot':
Options(title_format='foo bar', fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)