MCPcopy
hub / github.com/python-openxml/python-docx / get_comment_by_id

Method get_comment_by_id

src/docx/oxml/comments.py:63–66  ·  view source on GitHub ↗

Return the `w:comment` element identified by `comment_id`, or |None| if not found.

(self, comment_id: int)

Source from the content-addressed store, hash-verified

61 return comment
62
63 def get_comment_by_id(self, comment_id: int) -> CT_Comment | None:
64 """Return the `w:comment` element identified by `comment_id`, or |None| if not found."""
65 comment_elms = self.xpath(f"(./w:comment[@w:id='{comment_id}'])[1]")
66 return comment_elms[0] if comment_elms else None
67
68 def _next_available_comment_id(self) -> int:
69 """The next available comment id.

Callers 1

getMethod · 0.80

Calls 1

xpathMethod · 0.80

Tested by

no test coverage detected