From 7b8ec9e5ce37de7cbf0a9bc61b94cccb682cabd8 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 19 Aug 2015 18:42:28 +0200 Subject: Minor code simplification --- libmat/mat.py | 3 +-- libmat/parser.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'libmat') diff --git a/libmat/mat.py b/libmat/mat.py index d0fd504..f116f54 100644 --- a/libmat/mat.py +++ b/libmat/mat.py @@ -115,7 +115,7 @@ class XMLParser(xml.sax.handler.ContentHandler): def secure_remove(filename): """ Securely remove the file """ - # I want the file removed, even if it's ro + # I want the file removed, even if it's read-only try: os.chmod(filename, 220) except OSError: @@ -159,7 +159,6 @@ def create_class_file(name, backup, **kwargs): logging.error('%s is empty' % name) return None - filename = '' try: filename = hachoir_core.cmd_line.unicodeFilename(name) except TypeError: # get rid of "decoding Unicode is not supported" diff --git a/libmat/parser.py b/libmat/parser.py index eed3140..43de6d6 100644 --- a/libmat/parser.py +++ b/libmat/parser.py @@ -36,8 +36,7 @@ class GenericParser(object): except TypeError: # get rid of "decoding Unicode is not supported" self.filename = filename self.basename = os.path.basename(filename) - _, output = tempfile.mkstemp() - self.output = hachoir_core.cmd_line.unicodeFilename(output) + self.output = hachoir_core.cmd_line.unicodeFilename(tempfile.mkstemp()[1]) def __del__(self): """ Remove tempfile if it was not used -- cgit v1.3