
    ,h)                        d Z ddlmZmZ ddlZddlZd Z G d de      Z G d de	      Z
 G d	 d
e      Z e
def eej                              Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)z5
Base classes and other objects used by enumerations
    )absolute_importprint_functionNc                        fd}|S )z
    Decorating a class with @alias('FOO', 'BAR', ..) allows the class to
    be referenced by each of the names provided as arguments.
    c                 b    t        j                  d      }|j                  }D ]  }| ||<   	 | S )N   )sys	_getframe	f_globals)clscallerglobals_dictaliasaliasess       P/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/enum/base.py	decoratorzalias.<locals>.decorator   s:    q!'' 	&E"%L	&
     )r   r   s   ` r   r   r      s     r   c                   l    e Zd ZdZd Zed        Zed        Zd Zed        Z	ed        Z
ed        Zy	)
_DocsPageFormatterz
    Formats a RestructuredText documention page (string) for the enumeration
    class parts passed to the constructor. An immutable one-shot service
    object.
    c                      || _         || _        y N)_clsname_clsdict)selfclsnameclsdicts      r   __init__z_DocsPageFormatter.__init__%   s    r   c                 l    d}| j                   | j                  | j                  | j                  f}||z  S )z
        The 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_strz_DocsPageFormatter.page_str)   s?     3MM	

 j  r   c                     	 | j                   d   }|yt        j                  |      j	                         S # t        $ r d}Y 3w xY w)zr
        The docstring of the enumeration, formatted for use at the top of the
        documentation page
        __doc__ )r   KeyErrortextwrapdedentstrip)r   cls_docstrings     r   r!   z_DocsPageFormatter._intro_text8   sN    	 MM)4M  }-3355  	M	s   7 AAc                     t        j                  |j                        j                         }t        j                  |ddd      }|j
                  d|dS )z
        Return 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+   	docstringr,   fillname)r   membermember_docstrings      r   _member_defz_DocsPageFormatter._member_defH   sO    
 $??6+;+;<BBD#=="%	
 $[[*:;;r   c                     | j                   d   }|D cg c]   }|j                  | j                  |      " }}dj                  |      S c c}w )zx
        A single string containing the aggregated member definitions section
        of the documentation page
        __members__r3   )r   r6   r9   join)r   membersr7   member_defss       r   r"   z_DocsPageFormatter._member_defsV   sV     --.3:
)/fkk>UDV$
 
 yy%%
s
   AAc                      | j                   d   S )z=
        The Microsoft API name for this enumeration
        __ms_name__)r   r   s    r   r   z_DocsPageFormatter._ms_nameb   s    
 }}]++r   c                 \    dt        | j                        dz   z  }d| j                  d|S )z
        The title for the documentation page, formatted as code (surrounded
        in double-backtics) and underlined with '=' characters
        =   z``z``
)lenr   )r   title_underscores     r   r    z_DocsPageFormatter._page_titlei   s-     #dmm"4q"89#}}.>??r   N)__name__
__module____qualname__r'   r   propertyr%   r!   r9   r"   r   r    r   r   r   r   r      sw      ! ! 6 6< 	& 	& , , @ @r   r   c                   F    e Zd ZdZd Zed        Zed        Zed        Zy)MetaEnumerationz
    The metaclass for Enumeration and its subclasses. Adds a name for each
    named member and compiles state needed by the enumeration class to
    respond to other attribute gets
    c                     | j                  |       | j                  |       | j                  ||       t        j	                  | |||      S r   )_add_enum_members_collect_valid_settings_generate_docs_pagetype__new__)metar   basesr   s       r   rR   zMetaEnumeration.__new__z   sC    w'$$W-  '2||D'5'::r   c                 >    |d   }|D ]  }|j                  |        y)z
        Dispatch ``.add_to_enum()`` call to each member so it can do its
        thing to properly add itself to the enumeration class. This
        delegation allows member sub-classes to add specialized behaviors.
        r;   N)add_to_enum)rS   r   enum_membersr7   s       r   rN   z!MetaEnumeration._add_enum_members   s+     }-" 	(Fw'	(r   c                 `    |d   }g }|D ]  }|j                  |j                          ||d<   y)z
        Return a sequence containing the enumeration values that are valid
        assignment values. Return-only values are excluded.
        r;   _valid_settingsN)extendvalid_settings)rS   r   rW   r[   r7   s        r   rO   z'MetaEnumeration._collect_valid_settings   sA     }-" 	9F!!&"7"78	9%3!"r   c                 6    t        ||      j                  |d<   y)zH
        Return the RST documentation page for the enumeration.
        __docs_rst__N)r   r%   )rS   r   r   s      r   rP   z#MetaEnumeration._generate_docs_page   s    
 #5Wg"F"O"Or   N)	rG   rH   rI   r'   rR   classmethodrN   rO   rP   r   r   r   rL   rL   s   sJ    ; ( ( 	4 	4 P Pr   rL   c                   (    e Zd ZdZdZdZed        Zy)EnumerationBasez
    Base class for all enumerations, used directly for enumerations requiring
    only basic behavior. It's __dict__ is used below in the Python 2+3
    compatible metaclass definition.
    r   r(   c                 V    || j                   vrt        |d| j                  d      y)zK
        Raise |ValueError| if *value* is not an assignable value.
        z not a member of z enumerationN)rY   
ValueErrorrG   )r   values     r   validatezEnumerationBase.validate   s0    
 +++7<cllK  ,r   N)rG   rH   rI   r'   r;   r@   r^   rd   r   r   r   r`   r`      s%     KK r   r`   Enumerationc                   8    e Zd ZdZdZdZed        Zed        Zy)XmlEnumerationzg
    Provides ``to_xml()`` and ``from_xml()`` methods in addition to base
    enumeration features
    r   r(   c                      | j                   |   S )za
        Return the enumeration member corresponding to the XML value
        *xml_val*.
        )_xml_to_member)r   xml_vals     r   from_xmlzXmlEnumeration.from_xml   s     !!'**r   c                 B    | j                  |       | j                  |   S )zK
        Return the XML value of the enumeration value *enum_val*.
        )rd   _member_to_xml)r   enum_vals     r   to_xmlzXmlEnumeration.to_xml   s!    
 	X!!(++r   N)	rG   rH   rI   r'   r;   r@   r^   rk   ro   r   r   r   rg   rg      s9    
 KK+ + , ,r   rg   c                   b    e Zd ZdZd Zd Zed        Zed        Zd Z	ed        Z
ed        Zy	)

EnumMemberz`
    Used in the enumeration class definition to define a member value and its
    mappings
    c                 h    || _         t        |t              rt        |||      }|| _        || _        y r   )_name
isinstanceint	EnumValue_value
_docstring)r   r6   rc   r4   s       r   r   zEnumMember.__init__   s/    
eS!dE95E#r   c                 &    | j                  |       y)z:
        Add a name to *clsdict* for this member.
        N)register_namer   r   s     r   rV   zEnumMember.add_to_enum   s     	7#r   c                     | j                   S )z0
        The description of this member
        )rx   rA   s    r   r4   zEnumMember.docstring       
 r   c                     | j                   S )z
        The distinguishing name of this member within the enumeration class,
        e.g. 'MIDDLE' for MSO_VERTICAL_ANCHOR.MIDDLE, if this is a named
        member. Otherwise the primitive value such as |None|, |True| or
        |False|.
        )rs   rA   s    r   r6   zEnumMember.name   s     zzr   c                 P    | j                   y| j                  || j                   <   y)a  
        Add a member name to the class dict *clsdict* containing the value of
        this member object. Where the name of this object is None, do
        nothing; this allows out-of-band values to be defined without adding
        a name to the class dict.
        N)r6   rc   r{   s     r   rz   zEnumMember.register_name   s#     99!ZZ		r   c                     | j                   fS )z
        A sequence containing the values valid for assignment for this
        member. May be zero, one, or more in number.
        rw   rA   s    r   r[   zEnumMember.valid_settings   s     ~r   c                     | j                   S )z
        The enumeration value for this member, often an instance of
        EnumValue, but may be a primitive value such as |None|.
        r   rA   s    r   rc   zEnumMember.value  s     {{r   N)rG   rH   rI   r'   r   rV   rJ   r4   r6   rz   r[   rc   r   r   r   rq   rq      sf    
$$    	(    r   rq   c                   B     e Zd ZdZ fdZ fdZed        Zd Z xZS )rv   z
    A named enumeration value, providing __str__ and __doc__ string values
    for its symbolic name and description, respectively. Subclasses int, so
    behaves as a regular int unless the strings are asked for.
    c                 ,    t         t        |   | |      S r   )superrv   rR   )r   member_name	int_valuer4   	__class__s       r   rR   zEnumValue.__new__  s    Y,S)<<r   c                 F    t         t        |           || _        || _        y r   )r   rv   r   _member_namerx   )r   r   r   r4   r   s       r   r   zEnumValue.__init__  s    i')'#r   c                 6    | j                   j                         S )z<
        The description of this enumeration member
        )rx   r,   rA   s    r   r'   zEnumValue.__doc__   s    
 $$&&r   c                 :    dj                  | j                  |       S )zV
        The symbolic name and string value of this member, e.g. 'MIDDLE (3)'
        z{0:s} ({1:d}))formatr   rA   s    r   __str__zEnumValue.__str__'  s     %%d&7&7>>r   )	rG   rH   rI   r'   rR   r   rJ   r   __classcell__r   s   @r   rv   rv     s+    =$
 ' '?r   rv   c                        e Zd ZdZed        Zy)ReturnValueOnlyEnumMemberz
    Used to define a member of an enumeration that is only valid as a query
    result and is not valid as a setting, e.g. MSO_VERTICAL_ANCHOR.MIXED (-2)
    c                      y)z@
        No settings are valid for a return-only value.
        r   r   rA   s    r   r[   z(ReturnValueOnlyEnumMember.valid_settings4  s    
 r   N)rG   rH   rI   r'   rJ   r[   r   r   r   r   r   .  s    
  r   r   c                   b     e Zd ZdZ fdZ fdZd Zed        Ze	d        Z
e	d        Z xZS )XmlMappedEnumMemberzM
    Used to define a member whose value maps to an XML attribute value.
    c                 >    t         t        |   |||       || _        y r   )r   r   r   
_xml_value)r   r6   rc   	xml_valuer4   r   s        r   r   zXmlMappedEnumMember.__init__A  s    !41$yI#r   c                 N    t         t        |   |       | j                  |       y)zH
        Compile XML mappings in addition to base add behavior.
        N)r   r   rV   register_xml_mapping)r   r   r   s     r   rV   zXmlMappedEnumMember.add_to_enumE  s#     	!44W=!!'*r   c                     | j                  |      }| j                  || j                  <   | j                  |      }| j                  || j                  <   y)zR
        Add XML mappings to the enumeration class state for this member.
        N)_get_or_add_member_to_xmlr   rc   _get_or_add_xml_to_member)r   r   member_to_xmlxml_to_members       r   r   z(XmlMappedEnumMember.register_xml_mappingL  sH     66w?$(NNdjj!66w?(,

dnn%r   c                     | j                   S )zT
        The XML attribute value that corresponds to this enumeration value
        )r   rA   s    r   r   zXmlMappedEnumMember.xml_valueU  r}   r   c                 .    d| vrt               | d<   | d   S )zR
        Add the enum -> xml value mapping to the enumeration class state
        rm   dictr   s    r   r   z-XmlMappedEnumMember._get_or_add_member_to_xml\  %    
 7*(,G$%'((r   c                 .    d| vrt               | d<   | d   S )zR
        Add the xml -> enum value mapping to the enumeration class state
        ri   r   r   s    r   r   z-XmlMappedEnumMember._get_or_add_xml_to_membere  r   r   )rG   rH   rI   r'   r   rV   r   rJ   r   staticmethodr   r   r   r   s   @r   r   r   <  sS    $+3   ) ) ) )r   r   )r'   
__future__r   r   r   r*   r   objectr   rQ   rL   r`   r   __dict__re   rg   rq   ru   rv   r   r   r   r   r   <module>r      s    7 
 "R@ R@j)Pd )PXf * mfY_=U=U8VW,[ ,4= =@? ?:
 0)* 0)r   