From 1b356b8c6ff8154f64e2019721897e0a7e909a54 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 3 Oct 2018 15:22:36 +0200 Subject: Improve mat2's cli reliability - Replace some class members by instance members - Don't thread the cleaning process anymore for now --- libmat2/archive.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'libmat2/archive.py') diff --git a/libmat2/archive.py b/libmat2/archive.py index b29d690..016142d 100644 --- a/libmat2/archive.py +++ b/libmat2/archive.py @@ -15,20 +15,21 @@ assert Pattern class ArchiveBasedAbstractParser(abstract.AbstractParser): """ Office files (.docx, .odt, …) are zipped files. """ - # Those are the files that have a format that _isn't_ - # supported by MAT2, but that we want to keep anyway. - files_to_keep = set() # type: Set[Pattern] + def __init__(self, filename): + super().__init__(filename) - # Those are the files that we _do not_ want to keep, - # no matter if they are supported or not. - files_to_omit = set() # type: Set[Pattern] + # Those are the files that have a format that _isn't_ + # supported by MAT2, but that we want to keep anyway. + self.files_to_keep = set() # type: Set[Pattern] - # what should the parser do if it encounters an unknown file in - # the archive? - unknown_member_policy = UnknownMemberPolicy.ABORT # type: UnknownMemberPolicy + # Those are the files that we _do not_ want to keep, + # no matter if they are supported or not. + self.files_to_omit = set() # type: Set[Pattern] + + # what should the parser do if it encounters an unknown file in + # the archive? + self.unknown_member_policy = UnknownMemberPolicy.ABORT # type: UnknownMemberPolicy - def __init__(self, filename): - super().__init__(filename) try: # better fail here than later zipfile.ZipFile(self.filename) except zipfile.BadZipFile: -- cgit v1.3