From a47ac01eb626859fda3a25996ed3d9665f6001fe Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 5 Apr 2024 19:51:14 +0200 Subject: [PATCH] Remove a duplicate function This is a leftover from today's best-effort merges. --- libmat2/office.py | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/libmat2/office.py b/libmat2/office.py index fc83a20..f796932 100644 --- a/libmat2/office.py +++ b/libmat2/office.py @@ -355,39 +355,6 @@ class MSOfficeParser(ZipParser): tree.write(full_path, xml_declaration=True, encoding='utf-8') return True - @staticmethod - def __remove_document_comment_meta(full_path: str) -> bool: - try: - tree, namespace = _parse_xml(full_path) - except ET.ParseError as e: # pragma: no cover - logging.error("Unable to parse %s: %s", full_path, e) - return False - - # search the docs to see if we can bail early - range_start = tree.find('.//w:commentRangeStart', namespace) - range_end = tree.find('.//w:commentRangeEnd', namespace) - references = tree.find('.//w:commentReference', namespace) - if range_start is None and range_end is None and references is None: - return True # No comment meta tags are present - - parent_map = {c:p for p in tree.iter() for c in p} - - # iterate over the elements and add them to list - elements_del = list() - for element in tree.iterfind('.//w:commentRangeStart', namespace): - elements_del.append(element) - for element in tree.iterfind('.//w:commentRangeEnd', namespace): - elements_del.append(element) - for element in tree.iterfind('.//w:commentReference', namespace): - elements_del.append(element) - - # remove the elements - for element in elements_del: - parent_map[element].remove(element) - - tree.write(full_path, xml_declaration=True, encoding='utf-8') - return True - def __remove_content_type_members(self, full_path: str) -> bool: """ The method will remove the dangling references form the [Content_Types].xml file, since MS office doesn't like them