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


Python ConfigFile.set方法代码示例

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


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

示例1: _init_files

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
    def _init_files(self, bare):
        """Initialize a default set of named files."""
        from dulwich.config import ConfigFile
        self._put_named_file('description', b"Unnamed repository")
        f = BytesIO()
        cf = ConfigFile()
        cf.set(b"core", b"repositoryformatversion", b"0")
        if self._determine_file_mode():
            cf.set(b"core", b"filemode", True)
        else:
            cf.set(b"core", b"filemode", False)

        cf.set(b"core", b"bare", bare)
        cf.set(b"core", b"logallrefupdates", True)
        cf.write_to_file(f)
        self._put_named_file('config', f.getvalue())
        self._put_named_file(os.path.join('info', 'exclude'), b'')
开发者ID:akbargumbira,项目名称:qgis_resources_sharing,代码行数:19,代码来源:repo.py

示例2: _init_files

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
 def _init_files(self, bare):
     """Initialize a default set of named files."""
     from dulwich.config import ConfigFile
     self._put_named_file('description', "Unnamed repository")
     f = StringIO()
     cf = ConfigFile()
     cf.set("core", "repositoryformatversion", "0")
     cf.set("core", "filemode", "true")
     cf.set("core", "bare", str(bare).lower())
     cf.set("core", "logallrefupdates", "true")
     cf.write_to_file(f)
     self._put_named_file('config', f.getvalue())
     self._put_named_file(os.path.join('info', 'exclude'), '')
开发者ID:rodcloutier,项目名称:dulwich,代码行数:15,代码来源:repo.py

示例3: test_write_to_file_subsection

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set(("branch", "blie"), "foo", "bar")
     f = StringIO()
     c.write_to_file(f)
     self.assertEquals("[branch \"blie\"]\nfoo = bar\n", f.getvalue())
开发者ID:kankri,项目名称:dulwich,代码行数:8,代码来源:test_config.py

示例4: test_write_to_file_section

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set(("core", ), "foo", "bar")
     f = StringIO()
     c.write_to_file(f)
     self.assertEquals("[core]\nfoo = bar\n", f.getvalue())
开发者ID:kankri,项目名称:dulwich,代码行数:8,代码来源:test_config.py

示例5: test_write_to_file_subsection

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set((b"branch", b"blie"), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[branch \"blie\"]\n\tfoo = bar\n", f.getvalue())
开发者ID:stevegt,项目名称:dulwich,代码行数:8,代码来源:test_config.py

示例6: test_write_to_file_section

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set((b"core", ), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[core]\n\tfoo = bar\n", f.getvalue())
开发者ID:stevegt,项目名称:dulwich,代码行数:8,代码来源:test_config.py

示例7: test_set_hash_gets_quoted

# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
 def test_set_hash_gets_quoted(self):
     c = ConfigFile()
     c.set(b"xandikos", b"color", b"#665544")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[xandikos]\n\tcolor = \"#665544\"\n", f.getvalue())
开发者ID:jelmer,项目名称:dulwich,代码行数:8,代码来源:test_config.py


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