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/oxml/__pycache__/styles.cpython-310.pyc
o

$we�)�@s�dZddlmZddlmZddlmZmZmZddl	m
Z
mZmZm
Z
mZdd�ZGdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�de
�ZdS)z2Custom element classes related to the styles part.�)�annotations)�
WD_STYLE_TYPE)�ST_DecimalNumber�ST_OnOff�	ST_String)�BaseOxmlElement�OptionalAttribute�RequiredAttribute�
ZeroOrMore�	ZeroOrOnecCs*ddddddddd	d
d�
�||�dd
��S)zlReturn the style id corresponding to `name`, taking into account special-case
    names such as 'Heading 1'.�Caption�Heading1�Heading2�Heading3�Heading4�Heading5�Heading6�Heading7�Heading8�Heading9)
�captionz	heading 1z	heading 2z	heading 3z	heading 4z	heading 5z	heading 6z	heading 7z	heading 8z	heading 9� �)�get�replace)�name�r�I/home/arjun/projects/env/lib/python3.10/site-packages/docx/oxml/styles.py�styleId_from_names��rc@speZdZdZeddd�Zede�Zede	�Z
ede	�Zede	�Zed	e�Z
ed
e	�Zdd�Zd
d�Zdd�ZdS)�CT_LatentStylesz�`w:latentStyles` element, defining behavior defaults for latent styles and
    containing `w:lsdException` child elements that each override those defaults for a
    named latent style.zw:lsdExceptionr��
successorszw:countzw:defLockedStatezw:defQFormatzw:defSemiHiddenzw:defUIPriorityzw:defUnhideWhenUsedcCst||�}|durdS|S)z`Return the boolean value of the attribute having `attr_name`, or |False| if
        not present.NF��getattr��self�	attr_name�valuerrr�	bool_prop/s
zCT_LatentStyles.bool_propcCs|�d|�}|sdS|dS)zHReturn the `w:lsdException` child having `name`, or |None| if not found.zw:lsdException[@w:name="%s"]Nr��xpath)r%r�foundrrr�get_by_name7szCT_LatentStyles.get_by_namecCst||t|��dS�z7Set the on/off attribute having `attr_name` to `value`.N)�setattr�boolr$rrr�
set_bool_prop>�zCT_LatentStyles.set_bool_propN)�__name__�
__module__�__qualname__�__doc__r
�lsdExceptionrr�countr�defLockedState�
defQFormat�
defSemiHidden�
defUIPriority�defUnhideWhenUsedr(r,r0rrrrr!s





rc@sdeZdZdZede�Zede�Z	ede�Z
ede�Zede�Z
ede�Zdd	�Zd
d�Zdd
�ZdS)�CT_LsdExceptionzb``<w:lsdException>`` element, defining override visibility behaviors for a named
    latent style.�w:locked�w:name�	w:qFormat�w:semiHidden�w:uiPriority�w:unhideWhenUsedcC�|���|�dS)z;Remove this `w:lsdException` element from the XML document.N��	getparent�remove�r%rrr�deleteN�zCT_LsdException.deletecCs
t||�S)z_Return the boolean value of the attribute having `attr_name`, or |None| if
        not present.r")r%r&rrr�on_off_propRs
zCT_LsdException.on_off_propcCst|||�dSr-)r.r$rrr�set_on_off_propWszCT_LsdException.set_on_off_propN)r2r3r4r5rr�lockedr	rr�qFormat�
semiHiddenr�
uiPriority�unhideWhenUsedrIrKrLrrrrr=Cs





r=c@s�eZdZUdZdZededd�d�Zededd�d�Zed	ed
d�d�Zededd�d�Z	ed
edd�d�Z
ededd�d�Zededd�d�Zededd�d�Z
ededd�d�Zededd�d�Z[ede�Zded<ede�Zded<ede�Zed e�Zed!d"��Zejd#d"��Zed$d%��Zd&d'�Zed(d)��Zejd*d)��Zed+d,��Zejd-d,��Zed.d/��Z ed0d1��Z!e!jd2d1��Z!ed3d4��Z"e"jd5d4��Z"ed6d7��Z#e#jd8d7��Z#ed9d:��Z$e$jd;d:��Z$dS)<�CT_Stylez9A ``<w:style>`` element, representing a style definition.)r?z	w:aliases�	w:basedOn�w:nextzw:linkzw:autoRedefinezw:hiddenrBrArCr@r>z
w:personalzw:personalComposezw:personalReplyzw:rsid�w:pPr�w:rPrzw:tblPrzw:trPrzw:tcPrzw:tblStylePrr?�Nr rS�rT�rB�rA�	rC�
r@�r>�rU�rV�zw:typezWD_STYLE_TYPE | None�typez	w:styleIdz
str | None�styleIdz	w:defaultz
w:customStylecC�|j}|dur	dS|jS)z5Value of `w:basedOn/@w:val` or |None| if not present.N)�basedOn�val)r%rdrrr�basedOn_val��zCT_Style.basedOn_valcCs"|dur
|��dS||��_dS�N)�_remove_basedOn�get_or_add_basedOnre�r%r'rrrrf�scCs6|j}|dur	dS|��}|�|j�}|durdS|S)zkSibling CT_Style element this style is based on or |None| if no base style or
        base style not found.N)rdrF�	get_by_idre)r%rd�styles�
base_stylerrrrn�szCT_Style.base_stylecCrD)zARemove this `w:style` element from its parent `w:styles` element.NrErHrrrrI�rJzCT_Style.deletecC�|j}|dur	dS|jS)z5Value of `w:locked/@w:val` or |False| if not present.NF)rMre)r%rMrrr�
locked_val�rgzCT_Style.locked_valcC�*|��t|�dur|��}||_dSdS�NT)�_remove_lockedr/�_add_lockedre)r%r'rMrrrrp��

�cCrc)z5Value of ``<w:name>`` child or |None| if not present.N)rre)r%rrrr�name_val�rgzCT_Style.name_valcC�&|��|dur|��}||_dSdSrh)�_remove_name�	_add_namere)r%r'rrrrrv��

�cCs&|j}|dur	dS|��}|�|j�S)z�Sibling CT_Style element identified by the value of `w:name/@w:val` or |None|
        if no value is present or no style with that style id is found.N)�nextrFrlre)r%r{rmrrr�
next_style�s
zCT_Style.next_stylecCro)z6Value of `w:qFormat/@w:val` or |False| if not present.NF)rNre)r%rNrrr�qFormat_val�rgzCT_Style.qFormat_valcCs |��t|�r|��dSdSrh)�_remove_qFormatr/�_add_qFormatrkrrrr}�s�cCro)z<Value of ``<w:semiHidden>`` child or |False| if not present.NF)rOre)r%rOrrr�semiHidden_val�rgzCT_Style.semiHidden_valcCrqrr)�_remove_semiHiddenr/�_add_semiHiddenre)r%r'rOrrrr��rucCrc)z;Value of ``<w:uiPriority>`` child or |None| if not present.N)rPre)r%rPrrr�uiPriority_val�rgzCT_Style.uiPriority_valcCrwrh)�_remove_uiPriority�_add_uiPriorityre)r%r'rPrrrr��rzcCro)z=Value of `w:unhideWhenUsed/@w:val` or |False| if not present.NF)rQre)r%rQrrr�unhideWhenUsed_valrgzCT_Style.unhideWhenUsed_valcCrqrr)�_remove_unhideWhenUsedr/�_add_unhideWhenUsedre)r%r'rQrrrr�
ru)%r2r3r4r5�_tag_seqrrrdr{rPrOrQrNrM�pPr�rPrrrra�__annotations__rrbr�default�customStyle�propertyrf�setterrnrIrprvr|r}r�r�r�rrrrrR\sp
�
��









	






rRc@sbeZdZdZdZededd�d�Zeddd�Z[d	d
�Z	dd�Z
ddd�Zddd�Zdd�Z
dS)�	CT_StyleszK``<w:styles>`` element, the root element of a styles part, i.e. styles.xml.)z
w:docDefaults�w:latentStyles�w:styler��Nr r�rcCs0|��}||_|rdnd|_t|�|_||_|S)z�Return a newly added `w:style` element having `name` and `style_type`.

        `w:style/@customStyle` is set based on the value of `builtin`.
        NT)�	add_stylerar�rrbrv)r%r�
style_type�builtin�stylerrr�add_style_of_types
zCT_Styles.add_style_of_typecs&�fdd�|��D�}|sdS|dS)zEReturn `w:style[@w:type="*{style_type}*][-1]` or |None| if not found.cs g|]}|j�kr|jr|�qSr)rar�)�.0�s�r�rr�
<listcomp>(sz)CT_Styles.default_for.<locals>.<listcomp>N���)�_iter_styles)r%r��default_styles_for_typerr�r�default_for&s
�zCT_Styles.default_forrb�str�return�CT_Style | NonecCs d|�d�}tt|�|��d�S)zR`w:style` child where @styleId = `styleId`.

        |None| if not found.
        zw:style[@w:styleId="z"]N�r{�iterr*)r%rbr*rrrrl0szCT_Styles.get_by_idrcCsd|}tt|�|��d�S)zd`w:style` child with `w:name` grandchild having value `name`.

        |None| if not found.
        zw:style[w:name/@w:val="%s"]Nr�)r%rr*rrrr,8szCT_Styles.get_by_namecCsdd�|�d�D�S)z@Generate each of the `w:style` child elements in document order.css�|]}|VqdSrhr)r�r�rrr�	<genexpr>Bs�z)CT_Styles._iter_styles.<locals>.<genexpr>r�r)rHrrrr�@r1zCT_Styles._iter_styles)rbr�r�r�)rr�r�r�)r2r3r4r5r�r�latentStylesr
r�r�r�rlr,r�rrrrr�s


r�N)r5�
__future__r�docx.enum.styler�docx.oxml.simpletypesrrr�docx.oxml.xmlchemyrrr	r
rrrr=rRr�rrrr�<module>s	"7