本文整理汇总了Python中attic.archive.Archive.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Archive.delete方法的具体用法?Python Archive.delete怎么用?Python Archive.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类attic.archive.Archive
的用法示例。
在下文中一共展示了Archive.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_delete
# 需要导入模块: from attic.archive import Archive [as 别名]
# 或者: from attic.archive.Archive import delete [as 别名]
def do_delete(self, args):
"""Delete archive
"""
repository = self.open_repository(args.archive)
manifest, key = Manifest.load(repository)
cache = Cache(repository, key, manifest)
archive = Archive(repository, key, manifest, args.archive.archive, cache=cache)
archive.delete(cache)
return self.exit_code
示例2: do_delete
# 需要导入模块: from attic.archive import Archive [as 别名]
# 或者: from attic.archive.Archive import delete [as 别名]
def do_delete(self, args):
"""Delete an existing archive"""
repository = self.open_repository(args.archive, exclusive=True)
manifest, key = Manifest.load(repository)
cache = Cache(repository, key, manifest)
archive = Archive(repository, key, manifest, args.archive.archive, cache=cache)
stats = Statistics()
archive.delete(stats)
manifest.write()
repository.commit()
cache.commit()
if args.stats:
stats.print_('Deleted data:', cache)
return self.exit_code
示例3: do_delete
# 需要导入模块: from attic.archive import Archive [as 别名]
# 或者: from attic.archive.Archive import delete [as 别名]
def do_delete(self, args):
"""Delete an existing repository or archive"""
repository = self.open_repository(args.target, exclusive=True)
manifest, key = Manifest.load(repository)
cache = Cache(repository, key, manifest, do_files=args.cache_files)
if args.target.archive:
archive = Archive(repository, key, manifest, args.target.archive, cache=cache)
stats = Statistics()
archive.delete(stats)
manifest.write()
repository.commit()
cache.commit()
if args.stats:
stats.print_('Deleted data:', cache)
else:
print("You requested to completely DELETE the repository *including* all archives it contains:")
for archive in sorted(Archive.list_archives(repository, key, manifest), key=attrgetter('ts')):
print(format_archive(archive))
print("""Type "YES" if you understand this and want to continue.\n""")
if input('Do you want to continue? ') == 'YES':
repository.destroy()
cache.destroy()
print("Repository and corresponding cache were deleted.")
return self.exit_code