Skip to content

Commit a7719ff

Browse files
authored
refactor: move the resolution methods into a RevisionManager mixin, completing the package split (ROADMAP.md #73) (#94)
* refactor: move the resolution methods into a RevisionManager mixin (ROADMAP.md #73) Completes the track_changes package split: manager.py keeps only the RevisionManager class header and __init__, and the 21 accept/reject methods move verbatim into _ResolutionMixin. base.py gains six stubs for the cross-cluster callees the cluster reaches (_find_revision_element, list_revisions, _unhandled_elements, group_revisions, changeset_groups, _paragraph_mark_rPr). scripts/check_pure_move.py --base main: 3/3 ok. * test: cover rejecting a w:pPrChange placed outside w:pPr (ROADMAP.md #73) The schema-invalid-placement guard in _restore_paragraph_properties had no test: a record whose parent is not w:pPr is dropped rather than restored into whatever parent it has. Takes resolution.py to 100% statement and branch coverage.
1 parent c53ce37 commit a7719ff

4 files changed

Lines changed: 717 additions & 658 deletions

File tree

‎docx_editor/track_changes/base.py‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from xml.dom.minidom import Element
2121

2222
from ..xml_editor import DocxXMLEditor, ParagraphRef, TextMap, TextMapMatch, TextPosition
23-
from .models import GroupSource, _GroupCapture, _RegistrySnapshot
23+
from .models import GroupSource, Revision, _GroupCapture, _RegistrySnapshot
2424

2525

2626
class _RevisionManagerBase:
@@ -145,3 +145,29 @@ def _split_foreign_ins_at(self, edge_node, offset: int) -> Element | None:
145145

146146
def changeset_id_of(self, group_id: int) -> int | None:
147147
raise NotImplementedError
148+
149+
def _find_revision_element(
150+
self, revision_id: int, element_index: dict[str, list[Element]] | None
151+
) -> Element | None:
152+
raise NotImplementedError
153+
154+
def list_revisions(
155+
self,
156+
author: str | None = None,
157+
paragraph: str | None = None,
158+
*,
159+
with_location: bool = True,
160+
) -> list[Revision]:
161+
raise NotImplementedError
162+
163+
def _unhandled_elements(self, author: str | None = None) -> list[Element]:
164+
raise NotImplementedError
165+
166+
def group_revisions(self, group_id: int) -> tuple[int, ...]:
167+
raise NotImplementedError
168+
169+
def changeset_groups(self, changeset_id: int) -> tuple[int, ...]:
170+
raise NotImplementedError
171+
172+
def _paragraph_mark_rPr(self, p1) -> Element:
173+
raise NotImplementedError

0 commit comments

Comments
 (0)