本文整理汇总了Python中types.SimpleNamespace.walkers方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleNamespace.walkers方法的具体用法?Python SimpleNamespace.walkers怎么用?Python SimpleNamespace.walkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类types.SimpleNamespace
的用法示例。
在下文中一共展示了SimpleNamespace.walkers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_chain_get_cold_walker
# 需要导入模块: from types import SimpleNamespace [as 别名]
# 或者: from types.SimpleNamespace import walkers [as 别名]
def test_chain_get_cold_walker():
walker1 = SimpleNamespace(heat=0.1)
walker2 = SimpleNamespace(heat=0.4)
chain = SimpleNamespace(walkers=[walker1, walker2], get_cold_walker=mcmcmc._Chain.get_cold_walker, cold_heat=0.1)
assert chain.get_cold_walker(chain) == walker1
chain.walkers = [walker2, walker1]
assert chain.get_cold_walker(chain) == walker1
示例2: test_chain_get_best_walker
# 需要导入模块: from types import SimpleNamespace [as 别名]
# 或者: from types.SimpleNamespace import walkers [as 别名]
def test_chain_get_best_walker():
walker1 = SimpleNamespace(current_score=35)
walker2 = SimpleNamespace(current_score=15)
chain = SimpleNamespace(walkers=[walker1, walker2], get_best_walker=mcmcmc._Chain.get_best_walker)
assert chain.get_best_walker(chain) == walker1
chain.walkers = [walker2, walker1]
assert chain.get_best_walker(chain) == walker1
示例3: test_chain_get_ice_walker
# 需要导入模块: from types import SimpleNamespace [as 别名]
# 或者: from types.SimpleNamespace import walkers [as 别名]
def test_chain_get_ice_walker():
walker1 = SimpleNamespace(ice=False)
walker2 = SimpleNamespace(ice=False)
ice_walker = SimpleNamespace(ice=True)
chain = SimpleNamespace(walkers=[walker1, walker2], get_ice_walker=mcmcmc._Chain.get_ice_walker)
assert chain.get_ice_walker(chain) is False
chain.walkers = [walker2, ice_walker, walker1]
assert chain.get_ice_walker(chain) == ice_walker