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


Python PackData.from_file方法代码示例

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


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

示例1: setUp

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def setUp(self):
     conf = swift.load_conf(file=StringIO(config_file % def_config_file))
     sos = swift.SwiftObjectStore(FakeSwiftConnector("fakerepo", conf=conf))
     commit_amount = 10
     self.commits = create_commits(length=commit_amount, marker="m")
     data = [(d.type_num, d.as_raw_string()) for d in self.commits]
     f = StringIO()
     fi = StringIO()
     expected = build_pack(f, data, store=sos)
     entries = [(sha, ofs, checksum) for ofs, _, _, sha, checksum in expected]
     self.pack_data = PackData.from_file(file=f, size=None)
     write_pack_index_v2(fi, entries, self.pack_data.calculate_checksum())
     fi.seek(0)
     self.pack_index = load_pack_index_file("", fi)
开发者ID:coderedfox,项目名称:vfxpipe,代码行数:16,代码来源:test_swift.py

示例2: data_loader

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
		def data_loader():
			# read and writable temporary file
			pack_tmpfile = tempfile.NamedTemporaryFile()

			# download into temporary file
			log.debug('Downloading pack %s into %s' % (path, pack_tmpfile))
			pack_key = self.bucket.new_key('%s.pack' % path)

			# store
			pack_key.get_contents_to_file(pack_tmpfile)
			log.debug('Filesize is %d' % pack_key.size)

			log.debug('Rewinding...')
			pack_tmpfile.flush()
			pack_tmpfile.seek(0)

			return PackData.from_file(pack_tmpfile, pack_key.size)
开发者ID:mbr,项目名称:amazing-git,代码行数:19,代码来源:dulwich_s3.py

示例3: test_from_file

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def test_from_file(self):
     path = os.path.join(self.datadir, "pack-%s.pack" % pack1_sha)
     PackData.from_file(open(path), os.path.getsize(path))
开发者ID:Lutger,项目名称:fuzzballflux,代码行数:5,代码来源:test_pack.py

示例4: commit

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def commit():
     p = PackData.from_file(StringIO(f.getvalue()), f.tell())
     f.close()
     for obj in PackInflater.for_pack_data(p):
         self._data[obj.id] = obj
开发者ID:MadAd360,项目名称:GoGramming,代码行数:7,代码来源:object_store.py

示例5: commit

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def commit():
     p = PackData.from_file(BytesIO(f.getvalue()), f.tell())
     f.close()
     for obj in PackInflater.for_pack_data(p, self.get_raw):
         self.add_object(obj)
开发者ID:bobquest33,项目名称:dulwich,代码行数:7,代码来源:object_store.py

示例6: store

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
		def store():
			p = PackData.from_file(StringIO(fileContents.getvalue()), fileContents.tell())
			for obj in PackInflater.for_pack_data(p):
				self.add_object(obj)
开发者ID:Reidsy,项目名称:memory-git-repo,代码行数:6,代码来源:memr.py

示例7: test_from_file

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def test_from_file(self):
     path = os.path.join(self.datadir,
                         'pack-%s.pack' % pack1_sha.decode('ascii'))
     with open(path, 'rb') as f:
         PackData.from_file(f, os.path.getsize(path))
开发者ID:atbradley,项目名称:dulwich,代码行数:7,代码来源:test_pack.py

示例8: test_from_file

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def test_from_file(self):
     path = os.path.join(self.datadir, 'pack-%s.pack' % str(pack1_sha))
     with PackData.from_file(open(path, 'rb'), os.path.getsize(path)) as p:
         pass
开发者ID:TDC-bob,项目名称:dulwich-py3k,代码行数:6,代码来源:test_pack.py

示例9: test_from_file

# 需要导入模块: from dulwich.pack import PackData [as 别名]
# 或者: from dulwich.pack.PackData import from_file [as 别名]
 def test_from_file(self):
     path = os.path.join(self.datadir, b'pack-' + pack1_sha + b'.pack')
     with open(path, 'rb') as f:
         PackData.from_file(f, os.path.getsize(path))
开发者ID:mmahmedgithub,项目名称:dulwich,代码行数:6,代码来源:test_pack.py


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