Second pass of minor formatting
This commit is contained in:
parent
2e243355f5
commit
719cdf20fa
@ -138,7 +138,7 @@ class MSOfficeParser(ArchiveBasedAbstractParser):
|
|||||||
|
|
||||||
elements = list()
|
elements = list()
|
||||||
for element in tree.iterfind('.//w:ins', namespace):
|
for element in tree.iterfind('.//w:ins', namespace):
|
||||||
for position, item in enumerate(tree.iter()): #pragma: no cover
|
for position, item in enumerate(tree.iter()): # pragma: no cover
|
||||||
if item == element:
|
if item == element:
|
||||||
for children in element.iterfind('./*'):
|
for children in element.iterfind('./*'):
|
||||||
elements.append((element, position, children))
|
elements.append((element, position, children))
|
||||||
@ -212,7 +212,6 @@ class LibreOfficeParser(ArchiveBasedAbstractParser):
|
|||||||
'^Thumbnails/',
|
'^Thumbnails/',
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __remove_revisions(full_path: str) -> bool:
|
def __remove_revisions(full_path: str) -> bool:
|
||||||
try:
|
try:
|
||||||
|
@ -118,7 +118,6 @@ class PDFParser(abstract.AbstractParser):
|
|||||||
document.save('file://' + os.path.abspath(out_file))
|
document.save('file://' + os.path.abspath(out_file))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __parse_metadata_field(data: str) -> dict:
|
def __parse_metadata_field(data: str) -> dict:
|
||||||
metadata = {}
|
metadata = {}
|
||||||
|
@ -21,7 +21,6 @@ class TorrentParser(abstract.AbstractParser):
|
|||||||
metadata[key.decode('utf-8')] = value
|
metadata[key.decode('utf-8')] = value
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
|
|
||||||
def remove_all(self) -> bool:
|
def remove_all(self) -> bool:
|
||||||
cleaned = dict()
|
cleaned = dict()
|
||||||
for key, value in self.dict_repr.items():
|
for key, value in self.dict_repr.items():
|
||||||
|
@ -104,7 +104,6 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
|
|||||||
box.add(self.__create_treeview())
|
box.add(self.__create_treeview())
|
||||||
window.show_all()
|
window.show_all()
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __validate(fileinfo) -> Tuple[bool, str]:
|
def __validate(fileinfo) -> Tuple[bool, str]:
|
||||||
""" Validate if a given file FileInfo `fileinfo` can be processed.
|
""" Validate if a given file FileInfo `fileinfo` can be processed.
|
||||||
@ -115,7 +114,6 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
|
|||||||
return False, "Not writeable"
|
return False, "Not writeable"
|
||||||
return True, ""
|
return True, ""
|
||||||
|
|
||||||
|
|
||||||
def __create_treeview(self) -> Gtk.TreeView:
|
def __create_treeview(self) -> Gtk.TreeView:
|
||||||
liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
|
liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
|
||||||
treeview = Gtk.TreeView(model=liststore)
|
treeview = Gtk.TreeView(model=liststore)
|
||||||
@ -148,7 +146,6 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
|
|||||||
treeview.show_all()
|
treeview.show_all()
|
||||||
return treeview
|
return treeview
|
||||||
|
|
||||||
|
|
||||||
def __create_progressbar(self) -> Gtk.ProgressBar:
|
def __create_progressbar(self) -> Gtk.ProgressBar:
|
||||||
""" Create the progressbar used to notify that files are currently
|
""" Create the progressbar used to notify that files are currently
|
||||||
being processed.
|
being processed.
|
||||||
@ -211,7 +208,6 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
|
|||||||
processing_queue.put(None) # signal that we processed all the files
|
processing_queue.put(None) # signal that we processed all the files
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def __cb_menu_activate(self, menu, files):
|
def __cb_menu_activate(self, menu, files):
|
||||||
""" This method is called when the user clicked the "clean metadata"
|
""" This method is called when the user clicked the "clean metadata"
|
||||||
menu item.
|
menu item.
|
||||||
@ -228,7 +224,6 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
|
|
||||||
def get_background_items(self, window, file):
|
def get_background_items(self, window, file):
|
||||||
""" https://bugzilla.gnome.org/show_bug.cgi?id=784278 """
|
""" https://bugzilla.gnome.org/show_bug.cgi?id=784278 """
|
||||||
return None
|
return None
|
||||||
|
@ -30,7 +30,6 @@ class TestZipMetadata(unittest.TestCase):
|
|||||||
self.assertEqual(item.date_time, (1980, 1, 1, 0, 0, 0))
|
self.assertEqual(item.date_time, (1980, 1, 1, 0, 0, 0))
|
||||||
self.assertEqual(item.create_system, 3) # 3 is UNIX
|
self.assertEqual(item.create_system, 3) # 3 is UNIX
|
||||||
|
|
||||||
|
|
||||||
def test_office(self):
|
def test_office(self):
|
||||||
shutil.copy('./tests/data/dirty.docx', './tests/data/clean.docx')
|
shutil.copy('./tests/data/dirty.docx', './tests/data/clean.docx')
|
||||||
p = office.MSOfficeParser('./tests/data/clean.docx')
|
p = office.MSOfficeParser('./tests/data/clean.docx')
|
||||||
@ -50,7 +49,6 @@ class TestZipMetadata(unittest.TestCase):
|
|||||||
os.remove('./tests/data/clean.docx')
|
os.remove('./tests/data/clean.docx')
|
||||||
os.remove('./tests/data/clean.cleaned.docx')
|
os.remove('./tests/data/clean.cleaned.docx')
|
||||||
|
|
||||||
|
|
||||||
def test_libreoffice(self):
|
def test_libreoffice(self):
|
||||||
shutil.copy('./tests/data/dirty.odt', './tests/data/clean.odt')
|
shutil.copy('./tests/data/dirty.odt', './tests/data/clean.odt')
|
||||||
p = office.LibreOfficeParser('./tests/data/clean.odt')
|
p = office.LibreOfficeParser('./tests/data/clean.odt')
|
||||||
|
@ -55,8 +55,8 @@ class TestGetMeta(unittest.TestCase):
|
|||||||
self.assertEqual(meta['producer'], 'pdfTeX-1.40.14')
|
self.assertEqual(meta['producer'], 'pdfTeX-1.40.14')
|
||||||
self.assertEqual(meta['creator'], "'Certified by IEEE PDFeXpress at 03/19/2016 2:56:07 AM'")
|
self.assertEqual(meta['creator'], "'Certified by IEEE PDFeXpress at 03/19/2016 2:56:07 AM'")
|
||||||
self.assertEqual(meta['DocumentID'], "uuid:4a1a79c8-404e-4d38-9580-5bc081036e61")
|
self.assertEqual(meta['DocumentID'], "uuid:4a1a79c8-404e-4d38-9580-5bc081036e61")
|
||||||
self.assertEqual(meta['PTEX.Fullbanner'], "This is pdfTeX, Version " \
|
self.assertEqual(meta['PTEX.Fullbanner'], "This is pdfTeX, Version "
|
||||||
"3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) kpathsea " \
|
"3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) kpathsea "
|
||||||
"version 6.1.1")
|
"version 6.1.1")
|
||||||
|
|
||||||
def test_torrent(self):
|
def test_torrent(self):
|
||||||
@ -329,7 +329,6 @@ class TestCleaning(unittest.TestCase):
|
|||||||
os.remove('./tests/data/clean.docx')
|
os.remove('./tests/data/clean.docx')
|
||||||
os.remove('./tests/data/clean.cleaned.docx')
|
os.remove('./tests/data/clean.cleaned.docx')
|
||||||
|
|
||||||
|
|
||||||
def test_libreoffice(self):
|
def test_libreoffice(self):
|
||||||
shutil.copy('./tests/data/dirty.odt', './tests/data/clean.odt')
|
shutil.copy('./tests/data/dirty.odt', './tests/data/clean.odt')
|
||||||
p = office.LibreOfficeParser('./tests/data/clean.odt')
|
p = office.LibreOfficeParser('./tests/data/clean.odt')
|
||||||
@ -410,7 +409,6 @@ class TestCleaning(unittest.TestCase):
|
|||||||
os.remove('./tests/data/clean.odf')
|
os.remove('./tests/data/clean.odf')
|
||||||
os.remove('./tests/data/clean.cleaned.odf')
|
os.remove('./tests/data/clean.cleaned.odf')
|
||||||
|
|
||||||
|
|
||||||
def test_odg(self):
|
def test_odg(self):
|
||||||
shutil.copy('./tests/data/dirty.odg', './tests/data/clean.odg')
|
shutil.copy('./tests/data/dirty.odg', './tests/data/clean.odg')
|
||||||
p = office.LibreOfficeParser('./tests/data/clean.odg')
|
p = office.LibreOfficeParser('./tests/data/clean.odg')
|
||||||
|
Loading…
Reference in New Issue
Block a user