当前位置: 首页>>代码示例>>Python>>正文


Python Config.merge方法代码示例

本文整理汇总了Python中traitlets.config.loader.Config.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Config.merge方法的具体用法?Python Config.merge怎么用?Python Config.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在traitlets.config.loader.Config的用法示例。


在下文中一共展示了Config.merge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_fromdictmerge2

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_fromdictmerge2(self):
     c1 = Config({'Foo' : {'baz' : 2}})
     c2 = Config({'Foo' : {'bar' : 1}})
     c1.merge(c2)
     self.assertEqual(c1.Foo.__class__, Config)
     self.assertEqual(c1.Foo.bar, 1)
     self.assertEqual(c1.Foo.baz, 2)
     self.assertNotIn('baz', c2.Foo)
开发者ID:Carreau,项目名称:traitlets,代码行数:10,代码来源:test_loader.py

示例2: test_fromdictmerge2

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_fromdictmerge2(self):
     c1 = Config({"Foo": {"baz": 2}})
     c2 = Config({"Foo": {"bar": 1}})
     c1.merge(c2)
     self.assertEqual(c1.Foo.__class__, Config)
     self.assertEqual(c1.Foo.bar, 1)
     self.assertEqual(c1.Foo.baz, 2)
     self.assertNotIn("baz", c2.Foo)
开发者ID:willingc,项目名称:traitlets,代码行数:10,代码来源:test_loader.py

示例3: test_merge_no_copies

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_merge_no_copies(self):
     c = Config()
     c2 = Config()
     c2.Foo.trait = []
     c.merge(c2)
     c2.Foo.trait.append(1)
     self.assertIs(c.Foo, c2.Foo)
     self.assertEqual(c.Foo.trait, [1])
     self.assertEqual(c2.Foo.trait, [1])
开发者ID:Carreau,项目名称:traitlets,代码行数:11,代码来源:test_loader.py

示例4: test_merge_doesnt_exist

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_merge_doesnt_exist(self):
     c1 = Config()
     c2 = Config()
     c2.bar = 10
     c2.Foo.bar = 10
     c1.merge(c2)
     self.assertEqual(c1.Foo.bar, 10)
     self.assertEqual(c1.bar, 10)
     c2.Bar.bar = 10
     c1.merge(c2)
     self.assertEqual(c1.Bar.bar, 10)
开发者ID:Carreau,项目名称:traitlets,代码行数:13,代码来源:test_loader.py

示例5: load_config_file

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def load_config_file(self, filename, path=None):
     """Load config files by filename and path."""
     filename, ext = os.path.splitext(filename)
     new_config = Config()
     for config in self._load_config_files(filename, path=path, log=self.log,
         raise_config_file_errors=self.raise_config_file_errors,
     ):
         new_config.merge(config)
     # add self.cli_config to preserve CLI config priority
     new_config.merge(self.cli_config)
     self.update_config(new_config)
开发者ID:SylvainCorlay,项目名称:traitlets,代码行数:13,代码来源:application.py

示例6: test_merge_exists

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_merge_exists(self):
     c1 = Config()
     c2 = Config()
     c1.Foo.bar = 10
     c1.Foo.bam = 30
     c2.Foo.bar = 20
     c2.Foo.wow = 40
     c1.merge(c2)
     self.assertEqual(c1.Foo.bam, 30)
     self.assertEqual(c1.Foo.bar, 20)
     self.assertEqual(c1.Foo.wow, 40)
     c2.Foo.Bam.bam = 10
     c1.merge(c2)
     self.assertEqual(c1.Foo.Bam.bam, 10)
开发者ID:Carreau,项目名称:traitlets,代码行数:16,代码来源:test_loader.py

示例7: test_fromdictmerge

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_fromdictmerge(self):
     c1 = Config()
     c2 = Config({'Foo' : {'bar' : 1}})
     c1.merge(c2)
     self.assertEqual(c1.Foo.__class__, Config)
     self.assertEqual(c1.Foo.bar, 1)
开发者ID:Carreau,项目名称:traitlets,代码行数:8,代码来源:test_loader.py

示例8: print

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
#
# 3. Update nbconvert configuration
#
json_config = os.path.join(jupyter_config_dir(), 'jupyter_nbconvert_config.json')
print("Configuring %s" % json_config)
if os.path.isfile(json_config) is True:
    cl = JSONFileConfigLoader(json_config)
    config = cl.load_config()
else:
    config = Config()
newconfig = Config()
# Set template path, pre- and postprocessors of notebook extensions
newconfig.Exporter.template_path = [os.path.join(data_dir, 'templates')]
newconfig.Exporter.preprocessors = ["pre_codefolding.CodeFoldingPreprocessor", "pre_pymarkdown.PyMarkdownPreprocessor"]
newconfig.NbConvertApp.postprocessor_class = 'post_embedhtml.EmbedPostProcessor'
config.merge(newconfig)
config.version = 1
s=json.dumps(config, indent=2, separators=(',', ': '), sort_keys=True)
with open(json_config, 'w') as f:
    f.write(s)

py_config = os.path.join(jupyter_config_dir(), 'jupyter_nbconvert_config.py')
print("Configuring %s" % py_config)

new_py_config = 'jupyter_nbconvert_config.py'
update_config(py_config, new_py_config)

#
# 4. Update notebook configuration
#
fname = os.path.join(config_dir, 'jupyter_notebook_config.json')
开发者ID:mangorilla,项目名称:IPython-notebook-extensions,代码行数:33,代码来源:setup.py

示例9: test_fromdictmerge

# 需要导入模块: from traitlets.config.loader import Config [as 别名]
# 或者: from traitlets.config.loader.Config import merge [as 别名]
 def test_fromdictmerge(self):
     c1 = Config()
     c2 = Config({"Foo": {"bar": 1}})
     c1.merge(c2)
     self.assertEqual(c1.Foo.__class__, Config)
     self.assertEqual(c1.Foo.bar, 1)
开发者ID:willingc,项目名称:traitlets,代码行数:8,代码来源:test_loader.py


注:本文中的traitlets.config.loader.Config.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。