XjdZddlmZddlZddlZddlmZmZmZm Z m Z erddl m Z e ddZ Gd d eejZGd deejZGd d Zy)z4Base classes and other objects used by enumerations.) annotationsN) TYPE_CHECKINGAnyDictTypeTypeVar)Self_T BaseXmlEnum)boundceZdZdZddZdZy)BaseEnumzBase 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. cjtj||}||_|j|_|SN)int__new___value_strip__doc__)cls ms_api_valuedocstrselfs b/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/docx/enum/base.pyrzBaseEnum.__new__s+{{3 -# ||~  c:|jd|jdSzEThe symbolic name and string value of this member, e.g. 'MIDDLE (3)'.z ()namevaluers r__str__zBaseEnum.__str__))Btzzl!,,rN)rrrstr)__name__ __module__ __qualname__rrr#rrrrs  -rrcNeZdZUdZded<d dZdZed dZed dZ y) 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. str | None xml_valuecxtj||}||_||_|j |_|Sr)rrrr,rr)rrr,rrs rrzBaseXmlEnum.__new__*s2{{3 -# "||~  rc:|jd|jdSrrr"s rr#zBaseXmlEnum.__str__1r$rcltfd|Dd}|t|jdd|S)zEnumeration member corresponding to XML attribute value `xml_value`. Example:: >>> WD_PARAGRAPH_ALIGNMENT.from_xml("center") WD_PARAGRAPH_ALIGNMENT.CENTER c3BK|]}|jk(s|ywr)r,).0memberr,s r z'BaseXmlEnum.from_xml..?sQ&63C3Cy3PvQsNz has no XML mapping for '')next ValueErrorr&)rr,r2s ` rfrom_xmlzBaseXmlEnum.from_xml5s@QCQSWX > ~-FykQRST T rc|||}|j}|s%t|jd|jd|S)z@XML value of this enum member, generally an XML attribute value..z has no XML representation)r,r6r&r )rr!r2r,s rto_xmlzBaseXmlEnum.to_xmlDsB U$$  ~Qv{{m;UVW WrN)rrr,r+rr%)r,r+returnr )rzType[_T]r!zint | _T | Noner;r+) r&r'r(r__annotations__rr# classmethodr7r:r)rrr r !sA -  rcpeZdZdZd dZedZedZd dZedZ edZ edZ y ) DocsPageFormatterzGenerate 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 ||_||_yr)_clsname_clsdict)rclsnameclsdicts r__init__zDocsPageFormatter.__init__Ws  rcld}|j|j|j|jf}||zS)zyThe 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)rtmpl componentss rpage_strzDocsPageFormatter.page_str[s? 3 MM           j  rc |jd}|ytj|j S#t$rd}Y3wxYw)z?Docstring of the enumeration, formatted for documentation page.r)rBKeyErrortextwrapdedentr)r cls_docstrings rrIzDocsPageFormatter._intro_textjsN  MM)4M  }-3355  M s7 AAc|jJtj|jj}tj|ddd}|j d|dS)ztReturn an individual member definition formatted as an RST glossary entry, wrapped to fit within 78 columns.Nz )widthinitial_indentsubsequent_indent )rrQrRrfillr )rr2member_docstrings r _member_defzDocsPageFormatter._member_defws]~~)))#??6>>:@@B#== "%   $[[*:;;rc|jd}|Dcgc] }|j|j|"}}dj|Scc}w)zgA single string containing the aggregated member definitions section of the documentation page. __members__rY)rBr r\join)rmembersr2 member_defss rrJzDocsPageFormatter._member_defssN-- .>EaFI`t''/a ayy%%bs A A c |jdS)z,The Microsoft API name for this enumeration. __ms_name__)rBr"s rrGzDocsPageFormatter._ms_names}}]++rc\dt|jdzz}d|jd|S)zThe title for the documentation page, formatted as code (surrounded in double-backtics) and underlined with '=' characters.=z``z`` )lenrA)rtitle_underscores rrHzDocsPageFormatter._page_titles-#dmm"4q"89#}}.>??rN)rCr%rDzDict[str, Any])r2zBaseEnum | BaseXmlEnum) r&r'r(rrEpropertyrMrIr\rJrGrHr)rrr?r?Psw   ! ! 6 6 <&&,,@@rr?)r __future__renumrQtypingrrrrrtyping_extensionsr r rEnumrr r?r)rrros\:" ::& T'-sDII-$,#tyy,^F@F@r