§
    £”jè  ã                  óŠ   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZmZ  G d
„ de
¦  «        ZdS )z<Styles object, container for all objects in the styles part.é    )Úannotations)Úwarn)ÚWD_STYLE_TYPE)Ú	CT_Styles)ÚElementProxy)Ú	BabelFish)ÚLatentStyles)Ú	BaseStyleÚStyleFactoryc                  óŠ   ‡ — e Zd ZdZdˆ fd„Zd„ Zdd„Zd	„ Zd
„ Zdd„Z	dd„Z
d d„Zd„ Zed„ ¦   «         Zd d„Zd!d„Zd"d„Zˆ xZS )#ÚStyleszÂProvides access to the styles defined in a document.

    Accessed using the :attr:`.Document.styles` property. Supports ``len()``, iteration,
    and dictionary-style access by style name.
    Ústylesr   c                óX   •— t          ¦   «                              |¦  «         || _        d S ©N)ÚsuperÚ__init__Ú_element)Úselfr   Ú	__class__s     €úa/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/docx/styles/styles.pyr   zStyles.__init__   s&   ø€ Ý‰Œ×Ò˜Ñ Ô Ð ØˆŒˆˆó    c                óv   ‡— t          j        |¦  «        Št          ˆfd„| j        j        D ¦   «         ¦  «        S )z$Enables `in` operator on style name.c              3  ó.   •K  — | ]}|j         ‰k    V — Œd S r   )Úname_val)Ú.0ÚstyleÚinternal_names     €r   ú	<genexpr>z&Styles.__contains__.<locals>.<genexpr>   s*   øè è € ÐXÐX°u�5”> ]Ò2ÐXÐXÐXÐXÐXÐXr   )r   Úui2internalÚanyr   Ú	style_lst)r   Únamer   s     @r   Ú__contains__zStyles.__contains__   s;   ø€ å!Ô-¨dÑ3Ô3ˆÝÐXÐXÐXÐXÀÄÔ@WÐXÑXÔXÑXÔXÐXr   ÚkeyÚstrc                ó(  — | j                              t          j        |¦  «        ¦  «        }|�t	          |¦  «        S | j                              |¦  «        }|�(d}t          |t          d¬¦  «         t	          |¦  «        S t          d|z  ¦  «        ‚)z©Enables dictionary-style access by UI name.

        Lookup by style id is deprecated, triggers a warning, and will be removed in a
        near-future release.
        NzFstyle lookup by style_id is deprecated. Use style name as key instead.é   )Ú
stacklevelzno style with name '%s')	r   Úget_by_namer   r   r   Ú	get_by_idr   ÚUserWarningÚKeyError)r   r$   Ú	style_elmÚmsgs       r   Ú__getitem__zStyles.__getitem__   s�   € ð ”M×-Ò-­iÔ.CÀCÑ.HÔ.HÑIÔIˆ	ØÐ Ý 	Ñ*Ô*Ð*à”M×+Ò+¨CÑ0Ô0ˆ	ØÐ ØZˆCÝ�•k¨aÐ0Ñ0Ô0Ð0Ý 	Ñ*Ô*Ð*åÐ0°3Ñ6Ñ7Ô7Ð7r   c                ó.   — d„ | j         j        D ¦   «         S )Nc              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   )r   )r   r   s     r   r   z"Styles.__iter__.<locals>.<genexpr>2   s*   è è € ÐIÐI¨•˜UÑ#Ô#ÐIÐIÐIÐIÐIÐIr   )r   r!   ©r   s    r   Ú__iter__zStyles.__iter__1   s   € ØIÐI°´Ô1HÐIÑIÔIÐIr   c                ó4   — t          | j        j        ¦  «        S r   )Úlenr   r!   r2   s    r   Ú__len__zStyles.__len__4   s   € Ý�4”=Ô*Ñ+Ô+Ð+r   Fc                ó¬   — t          j        |¦  «        }|| v rt          d|z  ¦  «        ‚| j                             |||¦  «        }t          |¦  «        S )z¹Return a newly added style object of `style_type` and identified by `name`.

        A builtin style can be defined by passing True for the optional `builtin`
        argument.
        z$document already contains style '%s')r   r   Ú
ValueErrorr   Úadd_style_of_typer   )r   r"   Ú
style_typeÚbuiltinÚ
style_namer   s         r   Ú	add_stylezStyles.add_style7   sZ   € õ Ô*¨4Ñ0Ô0ˆ
Ø˜ÐÐÝÐCÀdÑJÑKÔKÐKØ”×/Ò/°
¸JÈÑPÔPˆÝ˜EÑ"Ô"Ð"r   r:   r   c                ó\   — | j                              |¦  «        }|€dS t          |¦  «        S )zpReturn the default style for `style_type` or |None| if no default is defined
        for that type (not common).N)r   Údefault_forr   )r   r:   r   s      r   ÚdefaultzStyles.defaultC   s1   € ð ”×)Ò)¨*Ñ5Ô5ˆØˆ=Ø�4Ý˜EÑ"Ô"Ð"r   Ústyle_idú
str | Nonec                ó\   — |€|                       |¦  «        S |                      ||¦  «        S )z×Return the style of `style_type` matching `style_id`.

        Returns the default for `style_type` if `style_id` is not found or is |None|, or
        if the style having `style_id` is not of `style_type`.
        )r@   Ú
_get_by_id)r   rA   r:   s      r   r*   zStyles.get_by_idK   s0   € ð ÐØ—<’< 
Ñ+Ô+Ð+Ø�Š˜x¨Ñ4Ô4Ð4r   c                óŒ   — |€dS t          |t          ¦  «        r|                      ||¦  «        S |                      ||¦  «        S )ar  Return the id of the style corresponding to `style_or_name`, or |None| if
        `style_or_name` is |None|.

        If `style_or_name` is not a style object, the style is looked up using
        `style_or_name` as a style name, raising |ValueError| if no style with that name
        is defined. Raises |ValueError| if the target style is not of `style_type`.
        N)Ú
isinstancer
   Ú_get_style_id_from_styleÚ_get_style_id_from_name)r   Ústyle_or_namer:   s      r   Úget_style_idzStyles.get_style_idU   sN   € ð Ð Ø�4Ý˜¥yÑ1Ô1ð 	KØ×0Ò0°À
ÑKÔKÐKà×/Ò/°¸zÑJÔJÐJr   c                óN   — t          | j                             ¦   «         ¦  «        S )zÝA |LatentStyles| object providing access to the default behaviors for latent
        styles and the collection of |_LatentStyle| objects that define overrides of
        those defaults for a particular named latent style.)r	   r   Úget_or_add_latentStylesr2   s    r   Úlatent_styleszStyles.latent_stylesd   s    € õ
 ˜DœM×AÒAÑCÔCÑDÔDÐDr   c                ó    — |r| j                              |¦  «        nd}|�|j        |k    r|                      |¦  «        S t	          |¦  «        S )zÉReturn the style of `style_type` matching `style_id`.

        Returns the default for `style_type` if `style_id` is not found or if the style
        having `style_id` is not of `style_type`.
        N)r   r*   Útyper@   r   )r   rA   r:   r   s       r   rD   zStyles._get_by_idk   sT   € ð 6>ÐG�”×'Ò'¨Ñ1Ô1Ð1À4ˆØˆ=˜EœJ¨*Ò4Ð4Ø—<’< 
Ñ+Ô+Ð+Ý˜EÑ"Ô"Ð"r   r<   Úreturnc                ó:   — |                       | |         |¦  «        S )a  Return the id of the style of `style_type` corresponding to `style_name`.

        Returns |None| if that style is the default style for `style_type`. Raises
        |ValueError| if the named style is not found in the document or does not match
        `style_type`.
        )rG   )r   r<   r:   s      r   rH   zStyles._get_style_id_from_namev   s   € ð ×,Ò,¨T°*Ô-=¸zÑJÔJÐJr   r   r
   c                ó�   — |j         |k    rt          d|j         ›d|›�¦  «        ‚||                      |¦  «        k    rdS |j        S )z‹Id of `style`, or |None| if it is the default style of `style_type`.

        Raises |ValueError| if style is not of `style_type`.
        zassigned style is type z, need type N)rO   r8   r@   rA   )r   r   r:   s      r   rG   zStyles._get_style_id_from_style   sT   € ð
 Œ:˜Ò#Ð#Ý�*È%Ì*È*È*ÐV`ÐV`ÐaÑbÔbÐbØ�D—L’L Ñ,Ô,Ò,Ð,Ø�4ØŒ~Ðr   )r   r   )r$   r%   )F)r:   r   )rA   rB   r:   r   )r<   r%   r:   r   rP   rB   )r   r
   r:   r   rP   rB   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r#   r/   r3   r6   r=   r@   r*   rJ   ÚpropertyrM   rD   rH   rG   Ú__classcell__)r   s   @r   r   r      s:  ø€ € € € € ðð ðð ð ð ð ð ðYð Yð Yð
8ð 8ð 8ð 8ð$Jð Jð Jð,ð ,ð ,ð
#ð 
#ð 
#ð 
#ð#ð #ð #ð #ð5ð 5ð 5ð 5ðKð Kð Kð ðEð Eñ „XðEð	#ð 	#ð 	#ð 	#ðKð Kð Kð Kð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	r   r   N)rV   Ú
__future__r   Úwarningsr   Údocx.enum.styler   Údocx.oxml.stylesr   Údocx.sharedr   Údocx.stylesr   Údocx.styles.latentr	   Údocx.styles.styler
   r   r   © r   r   ú<module>rb      sß   ðØ BÐ Bà "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð à )Ð )Ð )Ð )Ð )Ð )Ø &Ð &Ð &Ð &Ð &Ð &Ø $Ð $Ð $Ð $Ð $Ð $Ø !Ð !Ð !Ð !Ð !Ð !Ø +Ð +Ð +Ð +Ð +Ð +Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5ðyð yð yð yð yˆ\ñ yô yð yð yð yr   