當前位置: 首頁>>代碼示例>>Python>>正文


Python OptsSpec.parse方法代碼示例

本文整理匯總了Python中holoviews.util.parser.OptsSpec.parse方法的典型用法代碼示例。如果您正苦於以下問題:Python OptsSpec.parse方法的具體用法?Python OptsSpec.parse怎麽用?Python OptsSpec.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在holoviews.util.parser.OptsSpec的用法示例。


在下文中一共展示了OptsSpec.parse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_style_opts_intermediate_explicit

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.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)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:9,代碼來源:testparsers.py

示例2: test_plot_opts_with_space

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.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)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:9,代碼來源:testparsers.py

示例3: test_combined_1

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.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)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:9,代碼來源:testparsers.py

示例4: test_style_opts_advanced

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.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)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:10,代碼來源:testparsers.py

示例5: test_norm_opts_multiple_paths

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_norm_opts_multiple_paths(self):
     line = "Image Curve {+axiswise +framewise}"
     expected = {'Image':
                 {'norm':
                  Options(axiswise=True, framewise=True)},
                 'Curve':
                 {'norm':
                  Options(axiswise=True, framewise=True)}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:11,代碼來源:testparsers.py

示例6: test_combined_two_types_2

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.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)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:11,代碼來源:testparsers.py

示例7: test_plot_opts_multiple_paths

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_plot_opts_multiple_paths(self):
     line = "Image Curve [fig_inches=(3, 3) title_format='foo bar']"
     expected = {'Image':
                 {'plot':
                  Options(title_format='foo bar', fig_inches=(3, 3))},
                 'Curve':
                 {'plot':
                  Options(title_format='foo bar', fig_inches=(3, 3))}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:11,代碼來源:testparsers.py

示例8: test_style_opts_multiple_paths

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_style_opts_multiple_paths(self):
     line = "Image Curve (color='beautiful')"
     expected = {'Image':
                 {'style':
                  Options(color='beautiful')},
                 'Curve':
                 {'style':
                  Options(color='beautiful')}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:11,代碼來源:testparsers.py

示例9: test_combined_multiple_paths_merge

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_combined_multiple_paths_merge(self):
     line = "Image Curve [fig_inches=(3, 3)] (c='b') Image (s=3)"
     expected = {'Image':
                 {'plot':
                  Options(fig_inches=(3, 3)),
                  'style':
                  Options(c='b', s=3)},
                 'Curve':
                 {'plot':
                  Options(fig_inches=(3, 3)),
                 'style':
                 Options(c='b')}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:15,代碼來源:testparsers.py

示例10: test_plot_opts_multiple_paths_2

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_plot_opts_multiple_paths_2(self):
     line = "Image Curve Layout Overlay[fig_inches=(3, 3) title='foo bar']"
     expected = {'Image':
                 {'plot':
                  Options(title='foo bar', fig_inches=(3, 3))},
                 'Curve':
                 {'plot':
                  Options(title='foo bar', fig_inches=(3, 3))},
                 'Layout':
                 {'plot':
                  Options(title='foo bar', fig_inches=(3, 3))},
                 'Overlay':
                 {'plot':
                  Options(title='foo bar', fig_inches=(3, 3))}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:basnijholt,項目名稱:holoviews,代碼行數:17,代碼來源:testparsers.py

示例11: test_style_opts_cycle_function

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_style_opts_cycle_function(self):
     # Explicitly compare because list of arrays do not compare correctly
     import numpy as np
     np.random.seed(42)
     line = "Curve (color=Cycle(values=list(np.random.rand(3,3))))"
     options = OptsSpec.parse(line, {'np': np, 'Cycle': Cycle})
     self.assertTrue('Curve' in options)
     self.assertTrue('style' in options['Curve'])
     self.assertTrue('color' in options['Curve']['style'].kwargs)
     self.assertTrue(isinstance(options['Curve']['style'].kwargs['color'], Cycle))
     values = np.array([[ 0.37454012,  0.95071431,  0.73199394],
                        [ 0.59865848,  0.15601864,  0.15599452],
                        [ 0.05808361,  0.86617615,  0.60111501]])
     self.assertEqual(np.array(options['Curve']['style'].kwargs['color'].values),
                      values)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:17,代碼來源:testparsers.py

示例12: test_combined_multiple_paths

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_combined_multiple_paths(self):
     line = "Image Curve {+framewise} [fig_inches=(3, 3) title_format='foo bar'] (c='b') Layout [string='foo'] Overlay"
     expected = {'Image':
                 {'norm':
                  Options(framewise=True, axiswise=False),
                  'plot':
                  Options(title_format='foo bar', fig_inches=(3, 3)),
                  'style':
                  Options(c='b')},
                 'Curve':
                 {'norm':
                  Options(framewise=True, axiswise=False),
                  'plot':
                  Options(title_format='foo bar', fig_inches=(3, 3)),
                  'style':
                  Options(c='b')},
                 'Layout':
                 {'plot':
                  Options(string='foo')},
                 'Overlay':
                 {}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:24,代碼來源:testparsers.py

示例13: test_plot_opts_nested_brackets

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_plot_opts_nested_brackets(self):
     line = "Curve [title_format=', '.join(('A', 'B'))]"
     expected = {'Curve': {'plot': Options(title_format='A, B')}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:6,代碼來源:testparsers.py

示例14: test_plot_opts_dict_without_space

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 別名]
 def test_plot_opts_dict_without_space(self):
     line = "Curve [fontsize=dict(xlabel=10,title=20)]"
     expected = {'Curve': {'plot': Options(fontsize={'xlabel': 10, 'title': 20})}}
     self.assertEqual(OptsSpec.parse(line), expected)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:6,代碼來源:testparsers.py

示例15: test_plot_opts_with_space_explicit

# 需要導入模塊: from holoviews.util.parser import OptsSpec [as 別名]
# 或者: from holoviews.util.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)
開發者ID:mforbes,項目名稱:holoviews,代碼行數:8,代碼來源:testparsers.py


注:本文中的holoviews.util.parser.OptsSpec.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。