本文整理汇总了Python中pyhocon.ConfigFactory.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigFactory.from_dict方法的具体用法?Python ConfigFactory.from_dict怎么用?Python ConfigFactory.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyhocon.ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory.from_dict方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_from_dict_with_ordered_dict
# 需要导入模块: from pyhocon import ConfigFactory [as 别名]
# 或者: from pyhocon.ConfigFactory import from_dict [as 别名]
def test_from_dict_with_ordered_dict(self):
d = OrderedDict()
d['banana'] = 3
d['apple'] = 4
d['pear'] = 1
d['orange'] = 2
config = ConfigFactory.from_dict(d)
assert config == d
示例2: test_from_dict_with_dict
# 需要导入模块: from pyhocon import ConfigFactory [as 别名]
# 或者: from pyhocon.ConfigFactory import from_dict [as 别名]
def test_from_dict_with_dict(self):
d = {
'banana': 3,
'apple': 4,
'pear': 1,
'orange': 2,
}
config = ConfigFactory.from_dict(d)
assert config == d
示例3: test_from_dict_with_nested_dict
# 需要导入模块: from pyhocon import ConfigFactory [as 别名]
# 或者: from pyhocon.ConfigFactory import from_dict [as 别名]
def test_from_dict_with_nested_dict(self):
d = OrderedDict()
d['banana'] = 3
d['apple'] = 4
d['pear'] = 1
d['tree'] = {
'a': 'abc\ntest\n',
'b': [1, 2, 3]
}
config = ConfigFactory.from_dict(d)
assert config == d
示例4: update_parameters
# 需要导入模块: from pyhocon import ConfigFactory [as 别名]
# 或者: from pyhocon.ConfigFactory import from_dict [as 别名]
def update_parameters(parameters, template_variables, instance_path, param_type):
updated_parameters = deepcopy(parameters)
info_variables = set(updated_parameters.keys())
for variable in info_variables.union(template_variables):
if variable not in info_variables:
print("Adding missing variable '%s' to the parameterInfos of instance %s" % (variable, instance_path))
updated_parameters[variable] = ConfigFactory.from_dict({"type": param_type})
else:
if "type" not in updated_parameters[variable]:
print("Adding missing type for '%s' to the parameterInfos of instance %s" % (variable, instance_path))
updated_parameters[variable]["type"] = param_type
return updated_parameters
示例5: test_from_dict_with_dict
# 需要导入模块: from pyhocon import ConfigFactory [as 别名]
# 或者: from pyhocon.ConfigFactory import from_dict [as 别名]
def test_from_dict_with_dict(self):
d = {"banana": 3, "apple": 4, "pear": 1, "orange": 2}
config = ConfigFactory.from_dict(d)
assert config == d