XjdZddlmZddlZddlmZmZddlm Z erddl m Z m Z ddl mZddlmZdd lmZGd d ZGd d e Zy)z?Collection providing access to comments added to this document.) annotationsN) TYPE_CHECKINGIterator)BlockItemContainer) CT_Comment CT_Comments) CommentsPart)ParagraphStyle) Paragraphc:eZdZdZddZd dZd dZd d dZd dZy)Commentsz:Collection containing the comments added to this document.c ||_||_yN) _comments_elm_comments_part)self comments_elm comments_parts a/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/docx/comments.py__init__zComments.__init__s)+cBfdjjDS)z.Iterator over the comments in this collection.c3JK|]}t|jywr)Commentr).0 comment_elmrs r z$Comments.__iter__..s&  K!4!4 5 s #)r comment_lstrs`r__iter__zComments.__iter__s! #11==  rc@t|jjS)z*The number of comments in this collection.)lenrrrs r__len__zComments.__len__s4%%1122rc|jj}||_||_tj j tjj|_ t||j}|dk(r|St|jd}t|}|jd}|j!||D]} |j#| |S)aAdd a new comment to the document and return it. The comment is added to the end of the comments collection and is assigned a unique comment-id. If `text` is provided, it is added to the comment. This option provides for the common case where a comment contains a modest passage of plain text. Multiple paragraphs can be added using the `text` argument by separating their text with newlines (`"\\n"`). Between newlines, text is interpreted as it is in `Document.add_paragraph(text=...)`. The default is to place a single empty paragraph in the comment, which is the same behavior as the Word UI when you add a comment. New runs can be added to the first paragraph in the empty comment with `comments.paragraphs[0].add_run()` to adding more complex text with emphasis or images. Additional paragraphs can be added using `.add_paragraph()`. `author` is a required attribute, set to the empty string by default. `initials` is an optional attribute, set to the empty string by default. Passing |None| for the `initials` parameter causes that attribute to be omitted from the XML.  rtext)r add_commentauthorinitialsdtdatetimenowtimezoneutcdaterritersplitnext paragraphsadd_run add_paragraph) rr(r*r+rcommentpara_text_iterfirst_para_text first_parass rr)zComments.add_comment#s,((446 # ' ;;??2;;??; +t':':; 2:Ndjj./~.''* ?+ *A  ! !q ! ) *rcl|jj|}|t||jSdS)zFReturn the comment identified by `comment_id`, or |None| if not found.N)rget_comment_by_idrr)r comment_idrs rgetz Comments.getMs6((:::F .s9A9s)joinr5rs rr(z Comment.textsyy9999rc.|jjS)zThe date and time this comment was authored. This attribute is optional in the XML, returns |None| if not set. )rNr1rs r timestampzComment.timestamps   %%%r)rrrr )r%N)r(rDrSzstr | ParagraphStyle | NonerAr )rArD)rYrDrB)rArE)rYrE)rAzdt.datetime | None)rFrGrHrIrr7propertyr*setterr?r+r(rd __classcell__)rOs@rrrSs ( (( ]]))$$**__++::&&rr)rI __future__rr-r,typingrr docx.blkcntnrrdocx.oxml.commentsrrdocx.parts.commentsr docx.styles.styler docx.text.paragraphr r rrJrrros?E"*,:00-?^?^DP& P&r