
    h                        S r SSKJr  SSKrSSKrSSKJrJrJrJ	r	J
r
  \(       a  SSKJr  \
" SSS9r " S	 S
\\R                  5      r " S S\\R                  5      r " S S5      rg)z4Base classes and other objects used by enumerations.    )annotationsN)TYPE_CHECKINGAnyDictTypeTypeVar)Self_TBaseXmlEnum)boundc                  (    \ rS rSrSrSS jrS rSrg)BaseEnum   zBase class for Enums that do not map XML attr values.

The enum's value will be an integer, corresponding to the integer assigned the
corresponding member in the MS API enum of the same name.
c                f    [         R                  X5      nXl        UR                  5       Ul        U$ N)int__new___value_strip__doc__)clsms_api_valuedocstrselfs       @/var/www/html/env/lib/python3.13/site-packages/docx/enum/base.pyr   BaseEnum.__new__   s'    {{3-#||~    c                :    U R                    SU R                   S3$ zEThe symbolic name and string value of this member, e.g. 'MIDDLE (3)'.z ()namevaluer   s    r   __str__BaseEnum.__str__       ))Btzzl!,,r   )r   r   N)r   r   r   str)__name__
__module____qualname____firstlineno__r   r   r%   __static_attributes__ r   r   r   r      s    -r   r   c                  \    \ rS rSr% SrS\S'   SS jrS r\SS j5       r	\SS j5       r
S	rg
)r   !   zBase class for Enums that also map XML attr values.

The enum's value will be an integer, corresponding to the integer assigned the
corresponding member in the MS API enum of the same name.
r(   	xml_valuec                r    [         R                  X5      nXl        X$l        UR	                  5       Ul        U$ r   )r   r   r   r1   r   r   )r   r   r1   r   r   s        r   r   BaseXmlEnum.__new__*   s,    {{3-#"||~r   c                :    U R                    SU R                   S3$ r   r!   r$   s    r   r%   BaseXmlEnum.__str__1   r'   r   c                p   ^ [        U4S jU  5       S5      nUc  [        U R                   ST S35      eU$ )zEnumeration member corresponding to XML attribute value `xml_value`.

Example::

    >>> WD_PARAGRAPH_ALIGNMENT.from_xml("center")
    WD_PARAGRAPH_ALIGNMENT.CENTER

c              3  J   >#    U  H  oR                   T:X  d  M  Uv   M     g 7fr   r1   ).0memberr1   s     r   	<genexpr>'BaseXmlEnum.from_xml.<locals>.<genexpr>?   s     QC&3C3Cy3PvvCs   #	#Nz has no XML mapping for '')next
ValueErrorr)   )r   r1   r:   s    ` r   from_xmlBaseXmlEnum.from_xml5   s@     QCQSWX>~-FykQRSTTr   c                &    U " U5      R                   $ )z@XML value of this enum member, generally an XML attribute value.r8   )r   r#   s     r   to_xmlBaseXmlEnum.to_xmlD   s    
 5z###r   )r   r   r1   N)r   r   r1   r(   r   r(   )r1   
str | Nonereturnr	   )r   zType[_T]r#   zint | _T | NonerF   rE   )r)   r*   r+   r,   r   __annotations__r   r%   classmethodr@   rC   r-   r.   r   r   r   r   !   s@     N-   $ $r   c                  |    \ rS rSrSrSS jr\S 5       r\S 5       rSS jr	\S 5       r
\S 5       r\S	 5       rS
rg)DocsPageFormatterL   zGenerate an .rst doc page for an enumeration.

Formats a RestructuredText documention page (string) for the enumeration class parts
passed to the constructor. An immutable one-shot service object.
c                    Xl         X l        g r   )_clsname_clsdict)r   clsnameclsdicts      r   __init__DocsPageFormatter.__init__S   s    r   c                j    SnU R                   U R                  U R                  U R                  4nX-  $ )ziThe RestructuredText documentation page for the enumeration.

This is the only API member for the class.
z.. _%s:

%s

%s

----

%s)_ms_name_page_title_intro_text_member_defs)r   tmpl
componentss      r   page_strDocsPageFormatter.page_strW   s=     3MM	

   r   c                     U R                   S   nUc  g[        R                  " U5      R	                  5       $ ! [         a    Sn N6f = f)z?Docstring of the enumeration, formatted for documentation page.r    )rN   KeyErrortextwrapdedentr   )r   cls_docstrings     r   rV   DocsPageFormatter._intro_textf   sN    	 MM)4M  }-3355  	M	s   9 AAc                    UR                   c   e[        R                  " UR                   5      R                  5       n[        R                  " USSSS9nUR
                  < SU< S3$ )zlReturn an individual member definition formatted as an RST glossary entry,
wrapped to fit within 78 columns.N   z    )widthinitial_indentsubsequent_indent
)r   r_   r`   r   fillr"   )r   r:   member_docstrings      r   _member_defDocsPageFormatter._member_defs   s]     ~~)))#??6>>:@@B#=="%	
 $[[*:;;r   c                    U R                   S   nU Vs/ s H"  o"R                  c  M  U R                  U5      PM$     nnSR                  U5      $ s  snf )z_A single string containing the aggregated member definitions section of the
documentation page.__members__rh   )rN   r"   rk   join)r   membersr:   member_defss       r   rW   DocsPageFormatter._member_defs   sM     --.>EagF/t''/gayy%% bs
   AAc                     U R                   S   $ )z,The Microsoft API name for this enumeration.__ms_name__)rN   r$   s    r   rT   DocsPageFormatter._ms_name   s     }}]++r   c                `    S[        U R                  5      S-   -  nSU R                  < SU< 3$ )z{The title for the documentation page, formatted as code (surrounded in
double-backtics) and underlined with '=' characters.=   z``z``
)lenrM   )r   title_underscores     r   rU   DocsPageFormatter._page_title   s-     #dmm"4q"89#}}.>??r   )rN   rM   N)rO   r(   rP   zDict[str, Any])r:   zBaseEnum | BaseXmlEnum)r)   r*   r+   r,   r   rQ   propertyrZ   rV   rk   rW   rT   rU   r-   r.   r   r   rJ   rJ   L   sw      ! ! 
6 
6< & & , , @ @r   rJ   )r   
__future__r   enumr_   typingr   r   r   r   r   typing_extensionsr	   r
   r   Enumr   r   rJ   r.   r   r   <module>r      s\    : "   : :&T'-sDII -$($#tyy ($VF@ F@r   