diff options
Diffstat (limited to 'MAT/parser.py')
| -rw-r--r-- | MAT/parser.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/MAT/parser.py b/MAT/parser.py index c1c3f4c..ae07d7e 100644 --- a/MAT/parser.py +++ b/MAT/parser.py | |||
| @@ -1,22 +1,22 @@ | |||
| 1 | ''' Parent class of all parser | ||
| 1 | ''' | 2 | ''' |
| 2 | Parent class of all parser | ||
| 3 | ''' | ||
| 4 | |||
| 5 | import hachoir_core | ||
| 6 | import hachoir_editor | ||
| 7 | 3 | ||
| 8 | import os | 4 | import os |
| 9 | import tempfile | ||
| 10 | import shutil | 5 | import shutil |
| 6 | import tempfile | ||
| 7 | |||
| 8 | import hachoir_core | ||
| 9 | import hachoir_editor | ||
| 11 | 10 | ||
| 12 | import mat | 11 | import mat |
| 13 | 12 | ||
| 14 | NOMETA = frozenset(('.bmp', # image | 13 | NOMETA = frozenset(( |
| 15 | '.rdf', # text | 14 | '.bmp', # "raw" image |
| 16 | '.txt', # plain text | 15 | '.rdf', # text |
| 17 | '.xml', # formated text (XML) | 16 | '.txt', # plain text |
| 18 | '.rels', # openXML formated text | 17 | '.xml', # formated text (XML) |
| 19 | )) | 18 | '.rels', # openXML formated text |
| 19 | )) | ||
| 20 | 20 | ||
| 21 | FIELD = object() | 21 | FIELD = object() |
| 22 | 22 | ||
| @@ -92,8 +92,7 @@ class GenericParser(object): | |||
| 92 | del fieldset[field] | 92 | del fieldset[field] |
| 93 | 93 | ||
| 94 | def get_meta(self): | 94 | def get_meta(self): |
| 95 | ''' | 95 | ''' Return a dict with all the meta of the file |
| 96 | Return a dict with all the meta of the file | ||
| 97 | ''' | 96 | ''' |
| 98 | metadata = {} | 97 | metadata = {} |
| 99 | self._get_meta(self.editor, metadata) | 98 | self._get_meta(self.editor, metadata) |
| @@ -113,8 +112,7 @@ class GenericParser(object): | |||
| 113 | self._get_meta(field, None) | 112 | self._get_meta(field, None) |
| 114 | 113 | ||
| 115 | def _should_remove(self, key): | 114 | def _should_remove(self, key): |
| 116 | ''' | 115 | ''' Return True if the field is compromising |
| 117 | Return True if the field is compromising | ||
| 118 | abstract method | 116 | abstract method |
| 119 | ''' | 117 | ''' |
| 120 | raise NotImplementedError | 118 | raise NotImplementedError |
| @@ -125,8 +123,7 @@ class GenericParser(object): | |||
| 125 | shutil.copy2(self.filename, self.filename + '.bak') | 123 | shutil.copy2(self.filename, self.filename + '.bak') |
| 126 | 124 | ||
| 127 | def do_backup(self): | 125 | def do_backup(self): |
| 128 | ''' | 126 | ''' Keep a backup of the file if asked. |
| 129 | Keep a backup of the file if asked. | ||
| 130 | 127 | ||
| 131 | The process of double-renaming is not very elegant, | 128 | The process of double-renaming is not very elegant, |
| 132 | but it greatly simplify new strippers implementation. | 129 | but it greatly simplify new strippers implementation. |
