HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/docx/__pycache__/blkcntnr.cpython-310.pyc
o

$we�
�@s�UdZddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZer[dd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZdZded<Gdd�de
�ZdS)z�Block item container, used by body, cell, header, etc.

Block level items are things like paragraph and table, although there are a few other
specialized ones like structured document tags.
�)�annotations)�
TYPE_CHECKING�Iterator)�	TypeAlias)�CT_Tbl)�CT_P)�
StoryChild��	Paragraph)�types)�CT_Body)�	CT_HdrFtr)�CT_Tc)�Length)�ParagraphStyle��TablezCT_Body | CT_HdrFtr | CT_Tcr�BlockItemElementcsdeZdZdZd#�fdd�Z		d$d%dd�Zd&dd�Zd'dd�Zedd��Z	edd ��Z
d!d"�Z�ZS)(�BlockItemContaineraBase class for proxy objects that can contain block items.

    These containers include _Body, _Cell, header, footer, footnote, endnote, comment,
    and text box objects. Provides the shared functionality to add a block item like a
    paragraph or table.
    �elementr�parent�t.ProvidesStoryPartcstt|��|�||_dS)N)�superr�__init__�_element)�selfrr��	__class__��F/home/arjun/projects/env/lib/python3.10/site-packages/docx/blkcntnr.pyr(s
zBlockItemContainer.__init__�N�text�str�style�str | ParagraphStyle | None�returnr
cCs(|��}|r|�|�|dur||_|S)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`.

        If `style` is |None|, no paragraph style is applied, which has the same effect
        as applying the 'Normal' style.
        N)�_add_paragraph�add_runr#)rr!r#�	paragraphrrr�
add_paragraph,s
z BlockItemContainer.add_paragraph�rows�int�cols�widthrrcCs0ddlm}t�|||�}|j�|�|||�S)z�Return table of `width` having `rows` rows and `cols` columns.

        The table is appended appended at the end of the content in this container.

        `width` is evenly distributed between the table columns.
        rr)�
docx.tablerr�new_tblr�_insert_tbl)rr*r,r-r�tblrrr�	add_table>s
zBlockItemContainer.add_table�Iterator[Paragraph | Table]ccs@�ddlm}|jjD]}t|t�rt||�n|||�VqdS)zIGenerate each `Paragraph` or `Table` in this container in document order.rrN)r.rr�inner_content_elements�
isinstancerr
)rrrrrr�iter_inner_contentKs����z%BlockItemContainer.iter_inner_contentcs�fdd��jjD�S)zcA list containing the paragraphs in this container, in document order.

        Read-only.
        csg|]}t|���qSrr	)�.0�p�rrr�
<listcomp>\�z1BlockItemContainer.paragraphs.<locals>.<listcomp>)r�p_lstr9rr9r�
paragraphsVszBlockItemContainer.paragraphscs$ddlm���fdd��jjD�S)z_A list containing the tables in this container, in document order.

        Read-only.
        rrcsg|]}�|���qSrr)r7r1�rrrrr:fr;z-BlockItemContainer.tables.<locals>.<listcomp>)r.rr�tbl_lstr9rr>r�tables^szBlockItemContainer.tablescCst|j��|�S)zIReturn paragraph newly added to the end of the content in this container.)r
r�add_pr9rrrr&hsz!BlockItemContainer._add_paragraph)rrrr)r N)r!r"r#r$r%r
)r*r+r,r+r-rr%r)r%r3)
�__name__�
__module__�__qualname__�__doc__rr)r2r6�propertyr=r@r&�
__classcell__rrrrr s�




	rN) rE�
__future__r�typingrr�typing_extensionsr�docx.oxml.tabler�docx.oxml.text.paragraphr�docx.sharedr�docx.text.paragraphr
�docxr�t�docx.oxml.documentr�docx.oxml.sectionr
rr�docx.styles.stylerr.rr�__annotations__rrrrr�<module>s$