a tiny helper for zip archive

This commit is contained in:
Faik Uygur
2006-05-23 19:53:59 +00:00
parent 4478ad1be8
commit 8659a38ed4
+4
View File
@@ -182,6 +182,10 @@ class ArchiveZip(ArchiveBase):
self.add_to_archive(file_name) self.add_to_archive(file_name)
os.chdir(cwd) os.chdir(cwd)
def has_file(self, file_path):
""" Returns true if file_path is member of the zip archive"""
return file_path in self.zip_obj.namelist()
def unpack_file_cond(self, pred, target_dir, archive_root = ''): def unpack_file_cond(self, pred, target_dir, archive_root = ''):
"""Unpack/Extract files according to predicate function """Unpack/Extract files according to predicate function
pred: filename -> bool pred: filename -> bool