
    \Di                        S r SSKJr  SSKrSSKJrJr  SSKJ	r	  \(       a  SSK
JrJr  SSKJr  SSKJr  SS	KJr   " S
 S5      r " S S\	5      rg)z?Collection providing access to comments added to this document.    )annotationsN)TYPE_CHECKINGIterator)BlockItemContainer)
CT_CommentCT_Comments)CommentsPart)ParagraphStyle)	Paragraphc                  N    \ rS rSrSrS
S jrSS jrSS jrSSS jjrSS jr	Sr
g	)Comments   z:Collection containing the comments added to this document.c                    Xl         X l        g N_comments_elm_comments_part)selfcomments_elmcomments_parts      U/var/www/html/Aiprofessor/professorTrac/lib/python3.13/site-packages/docx/comments.py__init__Comments.__init__   s    )+    c                D   ^  U 4S jT R                   R                   5       $ )z.Iterator over the comments in this collection.c              3  P   >#    U  H  n[        UTR                  5      v   M     g 7fr   )Commentr   ).0comment_elmr   s     r   	<genexpr>$Comments.__iter__.<locals>.<genexpr>   s(      
= K!4!455=s   #&)r   comment_lstr   s   `r   __iter__Comments.__iter__   s!    
#11==
 	
r   c                @    [        U R                  R                  5      $ )z*The number of comments in this collection.)lenr   r"   r#   s    r   __len__Comments.__len__   s    4%%1122r   c                   U R                   R                  5       nX$l        X4l        [        R
                  R                  [        R                  R                  5      Ul	        [        X@R                  5      nUS:X  a  U$ [        UR                  S5      5      n[        U5      nUR                  S   nUR!                  U5        U H  n	UR#                  U	S9  M     U$ )a:  Add 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.
 
r   text)r   add_commentauthorinitialsdtdatetimenowtimezoneutcdater   r   itersplitnext
paragraphsadd_runadd_paragraph)
r   r.   r0   r1   r   commentpara_text_iterfirst_para_text
first_parass
             r   r/   Comments.add_comment#   s    , ((446#';;??2;;??;+':':;2:Ndjj./~.''*
?+A!!q!)   r   c                l    U R                   R                  U5      nUb  [        X R                  5      $ S$ )zFReturn the comment identified by `comment_id`, or |None| if not found.N)r   get_comment_by_idr   r   )r   
comment_idr   s      r   getComments.getM   s4    ((:::F<G<Sw{$7$78]Y]]r   r   N)r   r   r   r	   )returnzIterator[Comment]rI   int)r+   r+   r+   )r.   strr0   rL   r1   
str | NonerI   r   )rF   rK   rI   zComment | None)__name__
__module____qualname____firstlineno____doc__r   r$   r(   r/   rG   __static_attributes__ r   r   r   r      s     D,
3(T^r   r   c                     ^  \ rS rSrSrSU 4S jjrSSU 4S jjjr\SS j5       r\R                  SS j5       r\SS j5       r
\SS j5       r\R                  SS	 j5       r\SS
 j5       r\SS j5       rSrU =r$ )r   S   aS  Proxy for a single comment in the document.

Provides methods to access comment metadata such as author, initials, and date.

A comment is also a block-item container, similar to a table cell, so it can contain both
paragraphs and tables and its paragraphs can contain rich text, hyperlinks and images,
although the common case is that a comment contains a single paragraph of plain text like a
sentence or phrase.

Note that certain content like tables may not be displayed in the Word comment sidebar due to
space limitations. Such "over-sized" content can still be viewed in the review pane.
c                0   > [         TU ]  X5        Xl        g r   )superr   _comment_elm)r   r   r   	__class__s      r   r   Comment.__init__a   s    4'r   c                N   > [         TU ]  X5      nUc  SUR                  l        U$ )a!  Return paragraph newly added to the end of the content in this container.

The paragraph has `text` in a single run if present, and is given paragraph style `style`.
When `style` is |None| or ommitted, the "CommentText" paragraph style is applied, which is
the default style for comments.
CommentText)rX   r=   _pstyle)r   r.   r_   	paragraphrZ   s       r   r=   Comment.add_paragraphe   s-     G)$6	 =!.ILLr   c                .    U R                   R                  $ )zmRead/write. The recorded author of this comment.

This field is required but can be set to the empty string.
rY   r0   r#   s    r   r0   Comment.authoru   s       '''r   c                $    XR                   l        g r   rc   r   values     r   r0   rd   }   s    #( r   c                .    U R                   R                  $ )z&The unique identifier of this comment.)rY   idr#   s    r   rF   Comment.comment_id   s       ###r   c                .    U R                   R                  $ )zRead/write. The recorded initials of the comment author.

This attribute is optional in the XML, returns |None| if not set. Assigning |None| removes
any existing initials from the XML.
rY   r1   r#   s    r   r1   Comment.initials   s       )))r   c                $    XR                   l        g r   rl   rf   s     r   r1   rm      s    %*"r   c                F    SR                  S U R                   5       5      $ )zThe text content of this comment as a string.

Only content in paragraphs is included and of course all emphasis and styling is stripped.

Paragraph boundaries are indicated with a newline (`"\\n"`)
r,   c              3  8   #    U  H  oR                   v   M     g 7fr   r-   )r   ps     r   r    Comment.text.<locals>.<genexpr>   s     9As   )joinr;   r#   s    r   r.   Comment.text   s     yy9999r   c                .    U R                   R                  $ )zpThe date and time this comment was authored.

This attribute is optional in the XML, returns |None| if not set.
)rY   r7   r#   s    r   	timestampComment.timestamp   s       %%%r   )rY   )r   r   r   r	   )r+   N)r.   rL   r_   zstr | ParagraphStyle | NonerI   r   )rI   rL   )rg   rL   rJ   )rI   rM   )rg   rM   )rI   zdt.datetime | None)rN   rO   rP   rQ   rR   r   r=   propertyr0   setterrF   r1   r.   rv   rS   __classcell__)rZ   s   @r   r   r   S   s    (   ( ( ]]) ) $ $ * * __+ + : : & &r   r   )rR   
__future__r   r3   r2   typingr   r   docx.blkcntnrr   docx.oxml.commentsr   r   docx.parts.commentsr	   docx.styles.styler
   docx.text.paragraphr   r   r   rT   r   r   <module>r      s?    E "  * ,:00-?^ ?^DP&  P&r   