summaryrefslogtreecommitdiff
path: root/libmat2/archive.py
diff options
context:
space:
mode:
authorjvoisin2018-10-03 15:22:36 +0200
committerjvoisin2018-10-03 15:22:36 +0200
commit1b356b8c6ff8154f64e2019721897e0a7e909a54 (patch)
treee155d29fda0ce10ea201c5bcdccf6bcc67f01955 /libmat2/archive.py
parentc67bbafb2c60782096af4f6225d94e18225d2ecf (diff)
Improve mat2's cli reliability
- Replace some class members by instance members - Don't thread the cleaning process anymore for now
Diffstat (limited to 'libmat2/archive.py')
-rw-r--r--libmat2/archive.py23
1 files changed, 12 insertions, 11 deletions
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
15 15
16class ArchiveBasedAbstractParser(abstract.AbstractParser): 16class ArchiveBasedAbstractParser(abstract.AbstractParser):
17 """ Office files (.docx, .odt, …) are zipped files. """ 17 """ Office files (.docx, .odt, …) are zipped files. """
18 # Those are the files that have a format that _isn't_ 18 def __init__(self, filename):
19 # supported by MAT2, but that we want to keep anyway. 19 super().__init__(filename)
20 files_to_keep = set() # type: Set[Pattern]
21 20
22 # Those are the files that we _do not_ want to keep, 21 # Those are the files that have a format that _isn't_
23 # no matter if they are supported or not. 22 # supported by MAT2, but that we want to keep anyway.
24 files_to_omit = set() # type: Set[Pattern] 23 self.files_to_keep = set() # type: Set[Pattern]
25 24
26 # what should the parser do if it encounters an unknown file in 25 # Those are the files that we _do not_ want to keep,
27 # the archive? 26 # no matter if they are supported or not.
28 unknown_member_policy = UnknownMemberPolicy.ABORT # type: UnknownMemberPolicy 27 self.files_to_omit = set() # type: Set[Pattern]
28
29 # what should the parser do if it encounters an unknown file in
30 # the archive?
31 self.unknown_member_policy = UnknownMemberPolicy.ABORT # type: UnknownMemberPolicy
29 32
30 def __init__(self, filename):
31 super().__init__(filename)
32 try: # better fail here than later 33 try: # better fail here than later
33 zipfile.ZipFile(self.filename) 34 zipfile.ZipFile(self.filename)
34 except zipfile.BadZipFile: 35 except zipfile.BadZipFile: