;idZddlmZddlZddlZddlmZmZmZm Z m Z erddl m Z e ddZ Gd d eejZGd deejZGd d ZdS)z4Base classes and other objects used by enumerations.) annotationsN) TYPE_CHECKINGAnyDictTypeTypeVar)Self_T BaseXmlEnum)boundc eZdZdZd dZdZdS) 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. ms_api_valueintdocstrstrc|t||}||_||_|SN)r__new___value_strip__doc__)clsrrselfs BC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\docx/enum/base.pyrzBaseEnum.__new__s0{{3 --# ||~~  c&|jd|jdSzEThe symbolic name and string value of this member, e.g. 'MIDDLE (3)'.z ()namevaluers r__str__zBaseEnum.__str__),,tz,,,,rN)rrrr)__name__ __module__ __qualname__rrr$rrrrsA  -----rrc\eZdZUdZded<ddZd Zedd ZeddZ dS)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_valuerrrrct||}||_||_||_|Sr)rrrr,rr)rrr,rrs rrzBaseXmlEnum.__new__*s7{{3 --# "||~~  rc&|jd|jdSrr r#s rr$zBaseXmlEnum.__str__1r%rreturnr cxtfd|Dd}|t|jdd|S)zEnumeration member corresponding to XML attribute value `xml_value`. Example:: >>> WD_PARAGRAPH_ALIGNMENT.from_xml("center") WD_PARAGRAPH_ALIGNMENT.CENTER c32K|]}|jk |VdSr)r,).0memberr,s r z'BaseXmlEnum.from_xml..?s0QQ&63Cy3P3Pv3P3P3P3PQQrNz has no XML mapping for '')next ValueErrorr&)rr,r3s ` rfrom_xmlzBaseXmlEnum.from_xml5sUQQQQCQQQSWXX > SSySSSTT T rrType[_T]r"int | _T | Nonecl||}|j}|st|jd|jd|S)z@XML value of this enum member, generally an XML attribute value..z has no XML representation)r,r7r&r!)rr"r3r,s rto_xmlzBaseXmlEnum.to_xmlDsK U$  X VVv{VVVWW WrN)rrr,r+rr)r,r+r/r )rr9r"r:r/r+) r&r'r(r__annotations__rr$ classmethodr8r=r)rrr r !s ---   [ [rceZdZdZddZedZedZdd Zed Z ed Z edZ dS)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. clsnamerclsdictDict[str, Any]c"||_||_dSr)_clsname_clsdict)rrBrCs r__init__zDocsPageFormatter.__init__Ws  rcDd}|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[s4 3 M        j  rc |jd}n#t$rd}YnwxYw|dStj|S)z?Docstring of the enumeration, formatted for documentation page.r)rGKeyErrortextwrapdedentr)r cls_docstrings rrLzDocsPageFormatter._intro_textjsb  M)4MM   MMM   2}--33555s  r3BaseEnum | BaseXmlEnumc|jJtj|j}tj|ddd}|jd|dS)ztReturn an individual member definition formatted as an RST glossary entry, wrapped to fit within 78 columns.NNz )widthinitial_indentsubsequent_indent )rrTrUrfillr!)rr3member_docstrings r _member_defzDocsPageFormatter._member_defwsm~)))#?6>::@@BB#= "%     $[[[*:*:*:;;rcdjd}fd|D}d|S)zgA single string containing the aggregated member definitions section of the documentation page. __members__cHg|]}|j |Sr)r!r`)r2r3rs r z2DocsPageFormatter._member_defs..s.aaaFI`t''//I`I`I`rr])rGjoin)rmembers member_defss` rrMzDocsPageFormatter._member_defss<- .aaaagaaa yy%%%rc|jdS)z,The Microsoft API name for this enumeration. __ms_name__)rGr#s rrJzDocsPageFormatter._ms_names}]++rcPdt|jdzz}d|jd|S)zThe title for the documentation page, formatted as code (surrounded in double-backtics) and underlined with '=' characters.=z``z`` )lenrF)rtitle_underscores rrKzDocsPageFormatter._page_titles6#dm"4"4q"89#}}}.>.>??rN)rBrrCrD)r3rW) r&r'r(rrHpropertyrPrLr`rMrJrKr)rrrArAPs      ! !X ! 6 6X 6 < < < <&&X&,,X,@@X@@@rrA)r __future__renumrTtypingrrrrrtyping_extensionsr r rEnumrr rAr)rrrus*::"""""" ::::::::::::::'&&&&&& WT'''-----sDI---$,,,,,#ty,,,^F@F@F@F@F@F@F@F@F@F@r