diff options
| author | jvoisin | 2012-12-27 17:01:30 +0100 |
|---|---|---|
| committer | jvoisin | 2012-12-27 17:01:30 +0100 |
| commit | cffdcc1b1e78d48cad62c54432a9d8ce41f4d616 (patch) | |
| tree | f07e10cdbfb6fa1a5de4edb84435f10cb50ee191 /MAT/archive.py | |
| parent | a36f48b460f7638052f2e8ac3f9ddde8232cf339 (diff) | |
Refactor the archive parser
Refactoring of the archive and office parser,
in order to simplify the code and reduce abstraction
Diffstat (limited to 'MAT/archive.py')
| -rw-r--r-- | MAT/archive.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/MAT/archive.py b/MAT/archive.py index 69c8f1b..1dcddef 100644 --- a/MAT/archive.py +++ b/MAT/archive.py | |||
| @@ -35,9 +35,6 @@ class GenericArchiveStripper(parser.GenericParser): | |||
| 35 | shutil.rmtree(self.tempdir) | 35 | shutil.rmtree(self.tempdir) |
| 36 | 36 | ||
| 37 | def remove_all(self): | 37 | def remove_all(self): |
| 38 | return self._remove_all() | ||
| 39 | |||
| 40 | def _remove_all(self): | ||
| 41 | raise NotImplementedError | 38 | raise NotImplementedError |
| 42 | 39 | ||
| 43 | 40 | ||
| @@ -113,7 +110,7 @@ harmless format' % item.filename) | |||
| 113 | zipin.close() | 110 | zipin.close() |
| 114 | return metadata | 111 | return metadata |
| 115 | 112 | ||
| 116 | def _remove_all(self): | 113 | def remove_all(self): |
| 117 | ''' | 114 | ''' |
| 118 | So far, the zipfile module does not allow to write a ZipInfo | 115 | So far, the zipfile module does not allow to write a ZipInfo |
| 119 | object into a zipfile (and it's a shame !) : so data added | 116 | object into a zipfile (and it's a shame !) : so data added |
| @@ -162,7 +159,7 @@ class TarStripper(GenericArchiveStripper): | |||
| 162 | current_file.gname = '' | 159 | current_file.gname = '' |
| 163 | return current_file | 160 | return current_file |
| 164 | 161 | ||
| 165 | def _remove_all(self): | 162 | def remove_all(self): |
| 166 | tarin = tarfile.open(self.filename, 'r' + self.compression) | 163 | tarin = tarfile.open(self.filename, 'r' + self.compression) |
| 167 | tarout = tarfile.open(self.output, 'w' + self.compression) | 164 | tarout = tarfile.open(self.output, 'w' + self.compression) |
| 168 | for item in tarin.getmembers(): | 165 | for item in tarin.getmembers(): |
