本文整理匯總了Python中vital.ConfigBlock.set_value方法的典型用法代碼示例。如果您正苦於以下問題:Python ConfigBlock.set_value方法的具體用法?Python ConfigBlock.set_value怎麽用?Python ConfigBlock.set_value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vital.ConfigBlock
的用法示例。
在下文中一共展示了ConfigBlock.set_value方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_read_only_unset
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_read_only_unset(self):
cb = ConfigBlock()
cb.set_value('a', '1')
cb.mark_read_only('a')
cb.unset_value('a')
nose.tools.assert_true(cb.has_value('a'))
nose.tools.assert_equal(cb.get_value('a'), '1')
示例2: test_write_fail
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_write_fail(self):
cb = ConfigBlock()
cb.set_value('foo', 'bar')
nose.tools.assert_raises(VitalConfigBlockIoException,
cb.write,
'/not/valid')
示例3: get_configuration
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def get_configuration(self):
"""
:return: the current tool configuration
:rtype: ConfigBlock
"""
c = ConfigBlock("track_features")
c.set_value(
"image_list_file",
self.image_list_filepath or "",
"Path to an input file containing new-line separated paths " "to sequential image files",
)
c.set_value(
"mask_list_file",
self.mask_list_filepath or "",
"Optional path to an input file containing new-line "
"separated paths to mask images. This list should be "
"parallel in association to files specified in "
"``image_list_file``. Mask image must be the same size as "
"the image they are associated with.\n"
"\n"
"Leave this blank if no image masking is desired.",
)
c.set_value(
"invert_masks",
str(self.invert_masks).lower(),
"If true, all mask images will be inverted after loading. "
"This is useful if mask images read in use positive "
"values to indicated masked areas instead of non-masked "
"areas.",
)
c.set_value(
"expect_multichannel_masks",
str(self.expect_multichannel_masks).lower(),
"A majority of the time, mask images are a single channel, "
"however it is feasibly possible that certain "
"implementations may use multi-channel masks. If this is "
"true we will expect multiple-channel mask images, "
"warning when a single-channel mask is provided. If this "
"is false we error upon seeing a multi-channel mask "
"image.",
)
c.set_value(
"output_tracks_file",
self.output_tracks_filepath or "",
"Path to a file to write output tracks to. If this " "file exists, it will be overwritten.",
)
# Required algorithm does not have an implemented interface yet
# c.set_value("output_homography_file",
# self.output_homography_filepath or "",
# "Optional path to a file to write source-to-reference "
# "homographies for each frame. Leave blank to disable this "
# "output. The output_homography_generator algorithm type "
# "only needs to be set if this is set.")
self.algo_convert_img.get_config(c)
self.algo_image_io.get_config(c)
self.algo_track_features.get_config(c)
return c
示例4: test_subblock_view_match
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_subblock_view_match(self):
cb = ConfigBlock()
bname = 'block'
va = 'va'
cb.set_value(bname, va)
sb = cb.subblock_view(bname)
keys = sb.available_keys()
nose.tools.assert_equal(len(keys), 0)
示例5: test_available_keys
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_available_keys(self):
cb = ConfigBlock()
cb.set_value("foo", 1)
cb.set_value('bar', 'baz')
r = cb.available_keys()
nose.tools.assert_set_equal(set(r),
{'foo', 'bar'},
"Returned key list was incorrect.")
示例6: test_read_only
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_read_only(self):
cb = ConfigBlock()
cb.set_value('a', '1')
cb.mark_read_only('a')
nose.tools.assert_equal(cb.get_value('a'), '1')
cb.set_value('a', '2')
nose.tools.assert_equal(cb.get_value('a'), '1')
示例7: test_get_value
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_get_value(self):
cb = ConfigBlock()
cb.set_value('a', 'b')
cb.set_value('longer_value:foo', "BarBazThing")
nose.tools.assert_equal(cb.get_value('a'), 'b')
nose.tools.assert_equal(cb.get_value('longer_value:foo'),
'BarBazThing')
示例8: test_read_only_unset
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_read_only_unset(self):
cb = ConfigBlock()
cb.set_value('a', '1')
cb.mark_read_only('a')
nose.tools.assert_raises(
VitalConfigBlockReadOnlyException,
cb.unset_value, 'a'
)
nose.tools.assert_true(cb.has_value('a'))
nose.tools.assert_equal(cb.get_value('a'), '1')
示例9: test_subblock_view_prefix_match
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_subblock_view_prefix_match(self):
cb = ConfigBlock()
bname = 'block'
ka = 'ka'
va = 'va'
# intentionally not adding block separator
cb.set_value(bname + ka, va)
sb = cb.subblock_view(bname)
keys = sb.available_keys()
nose.tools.assert_equal(len(keys), 0)
示例10: test_check_conf
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_check_conf(self):
ci = ConvertImage('ci')
c = ConfigBlock()
nt.assert_false(ci.check_config(c))
c.set_value('ci:type', '')
nt.assert_false(ci.check_config(c))
c.set_value('ci:type', 'not_an_impl')
nt.assert_false(ci.check_config(c))
示例11: test_set_conf
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_set_conf(self):
ci = ConvertImage('ci')
nt.assert_false(ci)
nt.assert_is_none(ci.impl_name())
c = ConfigBlock()
c.set_value('ci:type', 'bypass')
ci.set_config(c)
nt.assert_true(ci)
nt.assert_equal(ci.impl_name(), 'bypass')
示例12: test_get_value_nested
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_get_value_nested(self):
cb = ConfigBlock()
k1 = 'a'
k2 = 'b'
v = 'c'
cb.set_value(k1 + ConfigBlock.BLOCK_SEP + k2, v)
nose.tools.assert_equal(cb.get_value(k1 + ConfigBlock.BLOCK_SEP + k2),
v)
sb = cb.subblock(k1)
nose.tools.assert_equal(sb.get_value(k2), v)
示例13: test_subblock_view_nested
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_subblock_view_nested(self):
cb = ConfigBlock()
b_name = 'block'
o_name = 'other_block'
n_name = b_name + ConfigBlock.BLOCK_SEP + o_name
ka = 'ka'
kb = 'kb'
kc = 'kc'
va = 'va'
vb = 'vb'
vc = 'vc'
cb.set_value(n_name + ConfigBlock.BLOCK_SEP + ka, va)
cb.set_value(n_name + ConfigBlock.BLOCK_SEP + kb, vb)
cb.set_value(o_name + ConfigBlock.BLOCK_SEP + kc, vc)
sb = cb.subblock_view(n_name)
nose.tools.assert_true(sb.has_value(ka))
nose.tools.assert_false(sb.has_value(kc))
cb.set_value(n_name + ConfigBlock.BLOCK_SEP + ka, vb)
nose.tools.assert_equal(sb.get_value(ka), vb)
sb.set_value(ka, va)
nose.tools.assert_equal(cb.get_value(n_name + ConfigBlock.BLOCK_SEP + ka), va)
sb.unset_value(kb)
nose.tools.assert_false(cb.has_value(n_name + ConfigBlock.BLOCK_SEP + kb))
cb.set_value(n_name + ConfigBlock.BLOCK_SEP + kc, vc)
sb_keys = sb.available_keys()
nose.tools.assert_set_equal(set(sb_keys), {ka, kc})
示例14: test_unset_value
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_unset_value(self):
cb = ConfigBlock()
cb.set_value('a', '1')
cb.set_value('b', '2')
cb.unset_value('a')
nose.tools.assert_false(cb.has_value('a'))
nose.tools.assert_raises(
VitalConfigBlockNoSuchValueException,
cb.get_value, 'a'
)
nose.tools.assert_equal(cb.get_value('b'), '2')
nose.tools.assert_true(cb.has_value('b'))
示例15: test_merge_config
# 需要導入模塊: from vital import ConfigBlock [as 別名]
# 或者: from vital.ConfigBlock import set_value [as 別名]
def test_merge_config(self):
cb1 = ConfigBlock()
cb2 = ConfigBlock()
ka = 'ka'
kb = 'kb'
kc = 'kc'
va = 'va'
vb = 'vb'
vc = 'vc'
cb1.set_value(ka, va)
cb1.set_value(kb, va)
cb2.set_value(kb, vb)
cb2.set_value(kc, vc)
cb1.merge_config(cb2)
nose.tools.assert_equal(cb1.get_value(ka), va)
nose.tools.assert_equal(cb1.get_value(kb), vb)
nose.tools.assert_equal(cb1.get_value(kc), vc)