MCPcopy Create free account
hub / github.com/SpaceZephyr/myskill / _get_next_comment_id

Method _get_next_comment_id

docx/scripts/document.py:888–902  ·  view source on GitHub ↗

Get the next available comment ID.

(self)

Source from the content-addressed store, hash-verified

886 # ==================== Private: Initialization ====================
887
888 def _get_next_comment_id(self):
889 """Get the next available comment ID."""
890 if not self.comments_path.exists():
891 return 0
892
893 editor = self["word/comments.xml"]
894 max_id = -1
895 for comment_elem in editor.dom.getElementsByTagName("w:comment"):
896 comment_id = comment_elem.getAttribute("w:id")
897 if comment_id:
898 try:
899 max_id = max(max_id, int(comment_id))
900 except ValueError:
901 pass
902 return max_id + 1
903
904 def _load_existing_comments(self):
905 """Load existing comments from files to enable replies."""

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected