Code cleanup

This commit is contained in:
Timmy Welch 2022-04-20 13:13:03 -07:00
parent d56238663d
commit 7798aec1db
2 changed files with 4 additions and 10 deletions

View File

@ -83,10 +83,10 @@ class SevenZipArchiver:
data = zf.read(archive_file)[archive_file].read() data = zf.read(archive_file)[archive_file].read()
except py7zr.Bad7zFile as e: except py7zr.Bad7zFile as e:
logger.error("bad 7zip file [%s]: %s :: %s", e, self.path, archive_file) logger.error("bad 7zip file [%s]: %s :: %s", e, self.path, archive_file)
raise IOError raise IOError from e
except Exception as e: except Exception as e:
logger.error("bad 7zip file [%s]: %s :: %s", e, self.path, archive_file) logger.error("bad 7zip file [%s]: %s :: %s", e, self.path, archive_file)
raise IOError raise IOError from e
return data return data
@ -143,7 +143,6 @@ class SevenZipArchiver:
zout.writef(bio, fname) zout.writef(bio, fname)
except Exception: except Exception:
logger.exception("Error rebuilding 7zip file: %s", self.path) logger.exception("Error rebuilding 7zip file: %s", self.path)
return []
# replace with the new file # replace with the new file
os.remove(self.path) os.remove(self.path)
@ -248,8 +247,7 @@ class ZipArchiver:
# preserve the old comment # preserve the old comment
zout.comment = zin.comment zout.comment = zin.comment
except Exception: except Exception:
logger.exception("Error rebuilding 7zip file: %s", self.path) logger.exception("Error rebuilding zip file: %s", self.path)
return []
# replace with the new file # replace with the new file
os.remove(self.path) os.remove(self.path)
@ -422,8 +420,7 @@ class RarArchiver:
break break
else: else:
# Success" # Success. Entries is a list of of tuples: ( rarinfo, filedata)
# entries is a list of of tuples: ( rarinfo, filedata)
if tries > 1: if tries > 1:
logger.info("Attempted read_files() {%d} times", tries) logger.info("Attempted read_files() {%d} times", tries)
if len(entries) == 1: if len(entries) == 1:
@ -593,7 +590,6 @@ class FolderArchiver:
return itemlist return itemlist
# noinspection PyUnusedLocal
class UnknownArchiver: class UnknownArchiver:
"""Unknown implementation""" """Unknown implementation"""

View File

@ -107,8 +107,6 @@ class FileNameParser:
# some titles) # some titles)
filename = re.sub(r"of [\d]+", self.repl, filename) filename = re.sub(r"of [\d]+", self.repl, filename)
# print u"[{0}]".format(filename)
# we should now have a cleaned up filename version with all the words in # we should now have a cleaned up filename version with all the words in
# the same positions as original filename # the same positions as original filename