本文整理汇总了Python中dulwich.objects.ShaFile.from_file方法的典型用法代码示例。如果您正苦于以下问题:Python ShaFile.from_file方法的具体用法?Python ShaFile.from_file怎么用?Python ShaFile.from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dulwich.objects.ShaFile
的用法示例。
在下文中一共展示了ShaFile.from_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deflated_smaller_window_buffer
# 需要导入模块: from dulwich.objects import ShaFile [as 别名]
# 或者: from dulwich.objects.ShaFile import from_file [as 别名]
def test_deflated_smaller_window_buffer(self):
# zlib on some systems uses smaller buffers,
# resulting in a different header.
# See https://github.com/libgit2/libgit2/pull/464
sf = ShaFile.from_file(BytesIO(small_buffer_zlib_object))
self.assertEqual(sf.type_name, b'tag')
self.assertEqual(sf.tagger, b' <@localhost>')
示例2: _get_loose_object
# 需要导入模块: from dulwich.objects import ShaFile [as 别名]
# 或者: from dulwich.objects.ShaFile import from_file [as 别名]
def _get_loose_object(self, sha):
path = self._get_shafile_path(sha)
try:
return ShaFile.from_file(path)
except (OSError, IOError), e:
if e.errno == errno.ENOENT:
return None
raise
示例3: _get_shafile
# 需要导入模块: from dulwich.objects import ShaFile [as 别名]
# 或者: from dulwich.objects.ShaFile import from_file [as 别名]
def _get_shafile(self, sha):
path = self._get_shafile_path(sha)
if os.path.exists(path):
return ShaFile.from_file(path)
return None