
    ,ha                        d Z ddlmZmZ ddl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mZ ddlmZ d)dZd 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 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  G d" d#e      Z! G d$ d%e      Z" G d& d'ejF                        Z$ ed(ejF                  f e%e$jL                              Z'y)*zU
Base and meta classes that enable declarative definition of custom element
classes.
    )absolute_importprint_functionN)etree   )oxml_parser   )Unicode)InvalidXmlError)NamespacePrefixedTag_nsmapqn)lazypropertyc                 z    t        |       }||n|j                  }t        j                  |j                  |      S )a
  
    Return a 'loose' lxml element having the tag specified by *nsptag_str*.
    *nsptag_str* must contain the standard namespace prefix, e.g. 'a:tbl'.
    The resulting element is an instance of the custom element class for this
    tag name if one is defined.
    )nsmap)r   r   r   makeelement
clark_name)
nsptag_strr   nsptags      T/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/oxml/xmlchemy.pyOxmlElementr      s7     "*-F&EFLLE""6#4#4EBB    c                 H    t        j                  | dd      }t        |      S )z_
    Serialize *element* to human-readable XML suitable for tests. No XML
    declaration.
    unicodeT)encodingpretty_print)r   tostring	XmlString)elementxmls     r   serialize_for_readingr    !   s     
 ..94
HCS>r   c                   R    e Zd ZdZ ej
                  d      Zd Zd Zd Z	d Z
d Zy)	r   zg
    Provides string comparison override suitable for serialized XML that is
    useful for tests.
    z(( *</?[\w:]+)(.*?)(/?>)([^<]*</[\w:]+>)?c                     | j                         }|j                         }t        |      t        |      k7  ryt        ||      D ]  \  }}| j                  ||      r y y)NFT)
splitlineslenzip_eq_elm_strs)selfotherlineslines_otherline
line_others         r   __eq__zXmlString.__eq__8   sc    !&&(u:[)) #E; 7 	D*$$T:6	 r   c                 &    | j                  |       S N)r-   )r'   r(   s     r   __ne__zXmlString.__ne__B   s    ;;u%%%r   c                 X    |j                         }|j                         }t        |      S )z
        Return a sequence of attribute strings parsed from *attrs*. Each
        attribute string is stripped of whitespace on both ends.
        )stripsplitsorted)r'   attrsattr_lsts      r   	_attr_seqzXmlString._attr_seqE   s%    
 ;;=hr   c                     | j                  |      \  }}}}| j                  |      \  }}}	}
||k7  ry| j                  |      | j                  |      k7  ry||	k7  ry||
k7  ryy)zl
        Return True if the element in *line_2* is XML equivalent to the
        element in *line*.
        FT)_parse_liner7   )r'   r+   line_2frontr5   closetextfront_2attrs_2close_2text_2s              r   r&   zXmlString._eq_elm_strsN   sv    
 %)$4$4T$:!ueT,0,<,<V,D)'6G>>% DNN7$;;G6>r   c                     | j                   j                  |      }t        dd      D cg c]  }|j                  |       c}\  }}}}||||fS c c}w )zo
        Return front, attrs, close, text 4-tuple result of parsing XML element
        string *line*.
        r      )_xml_elm_line_pattmatchrangegroup)r'   r+   rE   nr;   r5   r<   r=   s           r   r9   zXmlString._parse_line_   sV    
 ''--d3=B1a[$IU[[^$I!ueTeUD(( %Js   AN)__name__
__module____qualname____doc__recompilerD   r-   r0   r7   r&   r9    r   r   r   r   *   s4     $$OP& ")r   r   c                       e Zd ZdZd Zy)MetaOxmlElementz'
    Metaclass for BaseOxmlElement
    c                     t         t        t        t        t        t
        t        f}|j                         D ]$  \  }}t        ||      s|j                  | |       & y r/   )
OneAndOnlyOne	OneOrMoreOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOneZeroOrOneChoiceitems
isinstancepopulate_class_members)clsclsnamebasesclsdictdispatchablekeyvalues          r   __init__zMetaOxmlElement.__init__n   sS    
 "--/ 	7JC%.,,S#6	7r   N)rI   rJ   rK   rL   rd   rO   r   r   rQ   rQ   i   s    7r   rQ   c                   >     e Zd ZdZ fdZd Zd Zed        Z xZ	S )BaseAttributez_
    Base class for OptionalAttribute and RequiredAttribute, providing common
    methods.
    c                 F    t         t        |           || _        || _        y r/   )superrf   rd   
_attr_name_simple_type)r'   	attr_namesimple_type	__class__s      r   rd   zBaseAttribute.__init__   s    mT+-#'r   c                 @    || _         || _        | j                          yz?
        Add the appropriate methods to *element_cls*.
        N)_element_cls
_prop_name_add_attr_propertyr'   element_cls	prop_names      r   r\   z$BaseAttribute.populate_class_members   s     (#!r   c                     t        | j                  | j                  d      }t        | j                  | j
                  |       y)z
        Add a read/write ``{prop_name}`` property to the element class that
        returns the interpreted value of this attribute on access and changes
        the attribute value to its ST_* counterpart on assignment.
        N)property_getter_settersetattrrp   rq   r'   	property_s     r   rr   z BaseAttribute._add_attr_property   s0     T\\4<<>	!!4??I>r   c                 `    d| j                   v rt        | j                         S | j                   S )N:)ri   r   r'   s    r   _clark_namezBaseAttribute._clark_name   s'    $//!doo&&r   )
rI   rJ   rK   rL   rd   r\   rr   rw   r   __classcell__rm   s   @r   rf   rf   }   s+    
(
"?  r   rf   c                   T     e Zd ZdZd fd	Zed        Zed        Zed        Z xZ	S )rU   z
    Defines an optional attribute on a custom element class. An optional
    attribute returns a default value when not present for reading. When
    assigned |None|, the attribute is removed.
    c                 <    t         t        |   ||       || _        y r/   )rh   rU   rd   _default)r'   rk   rl   defaultrm   s       r   rd   zOptionalAttribute.__init__   s    /	;Gr   c                 N    | j                   j                  d| j                  dS )s
        Return the string to use as the ``__doc__`` attribute of the property
        for this attribute.
         type-converted value of ``z`` attribute, or |None| (or specified default value) if not present. Assigning the default value causes the attribute to be removed from the element.rj   rI   ri   r   s    r   
_docstringzOptionalAttribute._docstring   s#       ))4??<	
r   c                 4      fd} j                   |_        |S )t
        Return a function object suitable for the "get" side of the attribute
        property descriptor.
        c                     | j                  j                        }|j                  S j                  j	                  |      S r/   )getr   r   rj   from_xmlobjattr_str_valuer'   s     r   get_attr_valuez1OptionalAttribute._getter.<locals>.get_attr_value   s>     WWT%5%56N%}}$$$--n==r   r   rL   r'   r   s   ` r   rx   zOptionalAttribute._getter   s    	> "&r   c                       fd}|S )t
        Return a function object suitable for the "set" side of the attribute
        property descriptor.
        c                     |j                   k(  r0j                  | j                  v r| j                  j                  = y j                  j	                  |      }| j                  j                  |       y r/   )r   r   attribrj   to_xmlsetr   rc   	str_valuer'   s      r   set_attr_valuez1OptionalAttribute._setter.<locals>.set_attr_value   s`    %##szz1

4#3#34))007IGGD$$i0r   rO   r'   r   s   ` r   ry   zOptionalAttribute._setter   s    	1 r   r/   )
rI   rJ   rK   rL   rd   rw   r   rx   ry   r   r   s   @r   rU   rU      sI      

 

    r   rU   c                   @    e Zd ZdZed        Zed        Zed        Zy)rV   a  
    Defines a required attribute on a custom element class. A required
    attribute is assumed to be present for reading, so does not have
    a default value; its actual value is always used. If missing on read,
    an |InvalidXmlError| is raised. It also does not remove the attribute if
    |None| is assigned. Assigning |None| raises |TypeError| or |ValueError|,
    depending on the simple type of the attribute.
    c                 4      fd} j                   |_        |S )r   c                     | j                  j                        }|%t        dj                  d| j                        j
                  j                  |      S )Nz
required 'z#' attribute not present on element )r   r   r
   ri   tagrj   r   r   s     r   r   z1RequiredAttribute._getter.<locals>.get_attr_value   sU     WWT%5%56N%%1  $$--n==r   r   r   s   ` r   rx   zRequiredAttribute._getter   s    	> "&r   c                 N    | j                   j                  d| j                  dS )r   r   z`` attribute.r   r   s    r   r   zRequiredAttribute._docstring   s$     &&OO
 	
r   c                       fd}|S )r   c                 t    j                   j                  |      }| j                  j                  |       y r/   )rj   r   r   r   r   s      r   r   z1RequiredAttribute._setter.<locals>.set_attr_value  s-    ))007IGGD$$i0r   rO   r   s   ` r   ry   zRequiredAttribute._setter  s    	1 r   N)rI   rJ   rK   rL   rw   rx   r   ry   rO   r   r   rV   rV      sC      $ 
 
 
 
r   rV   c                        e Zd ZdZd fd	Zd Zd Zd Zd Zd Z	d Z
ed	        Zd
 Zed        Zed        Zed        Zed        Zed        Zed        Z xZS )_BaseChildElementz
    Base class for the child element classes corresponding to varying
    cardinalities, such as ZeroOrOne and ZeroOrMore.
    c                 F    t         t        |           || _        || _        y r/   )rh   r   rd   _nsptagname_successors)r'   
nsptagname
successorsrm   s      r   rd   z_BaseChildElement.__init__  s!    /1%%r   c                      || _         || _        y)z`
        Baseline behavior for adding the appropriate methods to
        *element_cls*.
        N)rp   rq   rs   s      r   r\   z(_BaseChildElement.populate_class_members  s    
 (#r   c                 p      fd}d j                   z  |_         j                   j                  |       y)za
        Add an ``_add_x()`` method to the element class for this child
        element.
        c                     t        | j                        } |       }|j                         D ]  \  }}t        |||        t        | j                        } ||       |S r/   )getattr_new_method_namerZ   rz   _insert_method_name)r   r5   
new_methodchildrb   rc   insert_methodr'   s          r   
_add_childz0_BaseChildElement._add_adder.<locals>._add_child+  s`     d&;&;<JLE#kkm +
UsE*+#C)A)ABM% Lr   SAdd a new ``<%s>`` child element unconditionally, inserted in the correct sequence.N)r   rL   _add_to_class_add_method_name)r'   r   s   ` r   
_add_adderz_BaseChildElement._add_adder%  s;    	#%)%5%56 	 	400*=r   c                 |    | j                   }d| j                  z  |_        | j                  | j                  |       y)z
        Add a ``_new_{prop_name}()`` method to the element class that creates
        a new, empty element of the correct type, having no attributes.
        zYReturn a "loose", newly created ``<%s>`` element having no attributes, text, or children.N)_creatorr   rL   r   r   )r'   creators     r   _add_creatorz_BaseChildElement._add_creator:  s?    
 --(*.*:*:; 	 	400':r   c                 t    t        | j                  dd      }t        | j                  | j                  |       y)zo
        Add a read-only ``{prop_name}`` property to the element class for
        this child element.
        N)rw   rx   rz   rp   rq   r{   s     r   _add_getterz_BaseChildElement._add_getterF  s,    
 T\\46	!!4??I>r   c                 p      fd}d j                   z  |_         j                   j                  |       y)zd
        Add an ``_insert_x()`` method to the element class for this child
        element.
        c                 B     | j                   |gj                    |S r/   )insert_element_beforer   r   r   r'   s     r   _insert_childz6_BaseChildElement._add_inserter.<locals>._insert_childU  s#    %C%%e?d.>.>?Lr   zYReturn the passed ``<%s>`` element after inserting it as a child in the correct sequence.N)r   rL   r   r   )r'   r   s   ` r   _add_inserterz_BaseChildElement._add_inserterO  s;    	
)+/+;+;< 	 	433]Cr   c                 ~    d| j                   z  }t        | j                  dd      }t        | j                  ||       y)z
        Add a read-only ``{prop_name}_lst`` property to the element class to
        retrieve a list of child elements matching this type.
        z%s_lstN)rq   rw   _list_getterrz   rp   )r'   ru   r|   s      r   _add_list_getterz"_BaseChildElement._add_list_getter_  s8    
 t.	T..d;	!!9i8r   c                      d| j                   z  S )Nz_add_%srq   r   s    r   r   z"_BaseChildElement._add_method_nameh      4??**r   c                 `    t        | j                  |      ryt        | j                  ||       y)zt
        Add *method* to the target class as *name*, unless *name* is already
        defined on the class.
        N)hasattrrp   rz   )r'   namemethods      r   r   z_BaseChildElement._add_to_classl  s)    
 4$$d+!!40r   c                       fd}|S )z}
        Return a function object that creates a new, empty element of the
        right type, having no attributes.
        c                 .    t        j                        S r/   )r   r   r   r'   s    r   new_child_elementz5_BaseChildElement._creator.<locals>.new_child_element|  s    t//00r   rO   )r'   r   s   ` r   r   z_BaseChildElement._creatoru  s    	1 ! r   c                 :      fd}d j                   z  |_        |S )z
        Return a function object suitable for the "get" side of the property
        descriptor. This default getter returns the child element with
        matching tag name or |None| if not present.
        c                 L    | j                  t        j                              S r/   )findr   r   r   s    r   get_child_elementz4_BaseChildElement._getter.<locals>.get_child_element  s    88Bt//011r   z0``<%s>`` child element or |None| if not present.r   rL   r'   r   s   ` r   rx   z_BaseChildElement._getter  s(    	2 ?AQAQQ 	! ! r   c                      d| j                   z  S )Nz
_insert_%sr   r   s    r   r   z%_BaseChildElement._insert_method_name      doo--r   c                 :      fd}d j                   z  |_        |S )zm
        Return a function object suitable for the "get" side of a list
        property descriptor.
        c                 L    | j                  t        j                              S r/   )findallr   r   r   s    r   get_child_element_listz>_BaseChildElement._list_getter.<locals>.get_child_element_list  s    ;;r$"2"2344r   zPA list containing each of the ``<%s>`` child elements, in the order they appear.r   )r'   r   s   ` r   r   z_BaseChildElement._list_getter  s+    	5 "&"2"23 	& &%r   c                      d| j                   z  S Nz
_remove_%sr   r   s    r   _remove_method_namez%_BaseChildElement._remove_method_name  r   r   c                      d| j                   z  S )Nz_new_%sr   r   s    r   r   z"_BaseChildElement._new_method_name  r   r   rO   )rI   rJ   rK   rL   rd   r\   r   r   r   r   r   r   r   r   rw   r   rx   r   r   r   r   r   r   s   @r   r   r     s    
&
$>*
;?D 9 + +1 	! 	! ! ! . . & & . . + +r   r   c                   \    e Zd ZdZed        Zd Zd Zed        Ze	d        Z
e	d        Zy)	Choicezd
    Defines a child element belonging to a group, only one of which may
    appear as a child.
    c                     | j                   S r/   )r   r   s    r   r   zChoice.nsptagname  s    r   c                     || _         || _        || _        | j                          | j	                          | j                          | j                          | j                          yro   )rp   _group_prop_namer   r   r   r   r   _add_get_or_change_to_method)r'   rt   group_prop_namer   s       r   r\   zChoice.populate_class_members  sV     ( /%))+r   c                 p      fd}d j                   z  |_         j                   j                  |       y)zl
        Add a ``get_or_change_to_x()`` method to the element class for this
        child element.
        c                     t        | j                        }||S t        | j                        } |        t        | j                        } |       }|S r/   )r   rq   _remove_group_method_namer   )r   r   remove_group_method
add_methodr'   s       r   get_or_change_to_childzCChoice._add_get_or_change_to_method.<locals>.get_or_change_to_child  sU    C1E ")#t/M/M"N! d&;&;<JLELr   zFReturn the ``<%s>`` child, replacing any other group element if found.N)r   rL   r   _get_or_change_to_method_name)r'   r   s   ` r   r   z#Choice._add_get_or_change_to_method  s;    	 X*& 	4==?UVr   c                 ~    d| j                   v r| j                   j                  d      dz   }nd}| j                   |d S )zW
        Calculate property name from tag name, e.g. a:schemeClr -> schemeClr.
        r~   r   r   N)r   index)r'   starts     r   rq   zChoice._prop_name  sE    
 $"""$$**3/!3EE''r   c                      d| j                   z  S )Nzget_or_change_to_%sr   r   s    r   r   z$Choice._get_or_change_to_method_name  s    $t66r   c                      d| j                   z  S r   )r   r   s    r   r   z Choice._remove_group_method_name  s    d3333r   N)rI   rJ   rK   rL   rw   r   r\   r   rq   r   r   r   rO   r   r   r   r     sb    
    ,W* ( ( 7 7 4 4r   r   c                   <     e Zd ZdZ fdZ fdZed        Z xZS )rS   z?
    Defines a required child element for MetaOxmlElement.
    c                 .    t         t        |   |d        y r/   )rh   rS   rd   )r'   r   rm   s     r   rd   zOneAndOnlyOne.__init__  s    mT+J=r   c                 N    t         t        |   ||       | j                          yro   )rh   rS   r\   r   r'   rt   ru   rm   s      r   r\   z$OneAndOnlyOne.populate_class_members  s"     	mT9+yQr   c                 :      fd}d j                   z  |_        |S )j
        Return a function object suitable for the "get" side of the property
        descriptor.
        c                     | j                  t        j                              }|t        dj                  z        |S )Nz+required ``<%s>`` child element not present)r   r   r   r
   r   s     r   r   z0OneAndOnlyOne._getter.<locals>.get_child_element  sC    HHR 0 012E}%ADDTDTT  Lr   z Required ``<%s>`` child element.r   r   s   ` r   rx   zOneAndOnlyOne._getter  s(    	 /1A1AA 	! ! r   )	rI   rJ   rK   rL   rd   r\   rw   rx   r   r   s   @r   rS   rS     s&    > ! !r   rS   c                   8     e Zd ZdZ fdZd Zed        Z xZS )rT   zc
    Defines a repeating child element for MetaOxmlElement that must appear at
    least once.
    c                     t         t        |   ||       | j                          | j	                          | j                          | j                          | j                          t        ||       yro   )	rh   rT   r\   r   r   r   r   _add_public_adderdelattrr   s      r   r\   z OneOrMore.populate_class_members  sZ     	i5k9M Y'r   c                 p      fd}d j                   z  |_         j                   j                  |       y)zN
        Add a public ``add_x()`` method to the parent element class.
        c                 B    t        | j                        } |       }|S r/   )r   r   )r   private_add_methodr   r'   s      r   	add_childz.OneOrMore._add_public_adder.<locals>.add_child*  s#    !(d.C.C!D&(ELr   r   N)r   rL   r   _public_add_method_name)r'   r	  s   ` r   r  zOneOrMore._add_public_adder%  s;    
	#%)%5%56 	 	477Cr   c                      d| j                   z  S )a  
        add_childElement() is public API for a repeating element, allowing
        new elements to be added to the sequence. May be overridden to
        provide a friendlier API to clients having domain appropriate
        parameter names for required attributes.
        zadd_%sr   r   s    r   r
  z!OneOrMore._public_add_method_name5  s     $//))r   )	rI   rJ   rK   rL   r\   r  r   r
  r   r   s   @r   rT   rT     s'    

(D  * *r   rT   c                   "     e Zd ZdZ fdZ xZS )rW   zJ
    Defines an optional repeating child element for MetaOxmlElement.
    c                     t         t        |   ||       | j                          | j	                          | j                          | j                          t        ||       yro   )rh   rW   r\   r   r   r   r   r  r   s      r   r\   z!ZeroOrMore.populate_class_membersE  sN     	j$6{INY'r   )rI   rJ   rK   rL   r\   r   r   s   @r   rW   rW   @  s    	( 	(r   rW   c                   >     e Zd ZdZ fdZd Zd Zed        Z xZ	S )rX   z@
    Defines an optional child element for MetaOxmlElement.
    c                     t         t        |   ||       | j                          | j	                          | j                          | j                          | j                          | j                          yro   )	rh   rX   r\   r   r   r   r   _add_get_or_adder_add_removerr   s      r   r\   z ZeroOrOne.populate_class_membersV  s\     	i5k9M r   c                 p      fd}d j                   z  |_         j                   j                  |       y)zf
        Add a ``get_or_add_x()`` method to the element class for this
        child element.
        c                 r    t        | j                        }|t        | j                        } |       }|S r/   )r   rq   r   )r   r   r   r'   s      r   get_or_add_childz5ZeroOrOne._add_get_or_adder.<locals>.get_or_add_childh  s6    C1E}$S$*?*?@
"Lr   z>Return the ``<%s>`` child element, newly added if not present.N)r   rL   r   _get_or_add_method_name)r'   r  s   ` r   r  zZeroOrOne._add_get_or_adderb  s;    	 M$  	4779IJr   c                 p      fd}d j                   z  |_         j                   j                  |       y)zc
        Add a ``_remove_x()`` method to the element class for this child
        element.
        c                 <    | j                  j                         y r/   )
remove_allr   r   s    r   _remove_childz-ZeroOrOne._add_remover.<locals>._remove_childz  s    NN4++,r   z#Remove all ``<%s>`` child elements.N)r   rL   r   r   )r'   r  s   ` r   r  zZeroOrOne._add_removert  s8    	- 2! 	433]Cr   c                      d| j                   z  S )Nzget_or_add_%sr   r   s    r   r  z!ZeroOrOne._get_or_add_method_name  s    00r   )
rI   rJ   rK   rL   r\   r  r  r   r  r   r   s   @r   rX   rX   Q  s-    
K$D 1 1r   rX   c                   f     e Zd ZdZd	dZ fdZd Zd Zed        Z	e
d        Ze
d        Z xZS )
rY   zo
    Correspondes to an ``EG_*`` element group where at most one of its
    members may appear as a child.
    c                      || _         || _        y r/   )_choicesr   )r'   choicesr   s      r   rd   zZeroOrOneChoice.__init__  s    %r   c                     t         t        |   ||       | j                          | j                  D ])  }|j                  || j
                  | j                         + | j                          yro   )rh   rY   r\   _add_choice_getterr  rq   r   _add_group_remover)r'   rt   ru   choicerm   s       r   r\   z&ZeroOrOneChoice.populate_class_members  sb     	ot;KS!mm 	F))T__d.>.>	 	!r   c                 t    t        | j                  dd      }t        | j                  | j                  |       y)z
        Add a read-only ``{prop_name}`` property to the element class that
        returns the present member of this group, or |None| if none are
        present.
        N)rw   _choice_getterrz   rp   rq   r{   s     r   r   z"ZeroOrOneChoice._add_choice_getter  s.     T00$=	!!4??I>r   c                 V      fd}d|_          j                   j                  |       y)ze
        Add a ``_remove_eg_x()`` method to the element class for this choice
        group.
        c                 J    j                   D ]  }| j                  |        y r/   )_member_nsptagnamesr  )r   tagnamer'   s     r   _remove_choice_groupz@ZeroOrOneChoice._add_group_remover.<locals>._remove_choice_group  s$    33 (w'(r   z9Remove the current choice group child element if present.N)rL   r    _remove_choice_group_method_name)r'   r)  s   ` r   r!  z"ZeroOrOneChoice._add_group_remover  s/    	(
 H 	$ 	4@@BVWr   c                        fd}d|_         |S )r   c                 6     | j                   j                   S r/   )first_child_found_inr'  r   s    r   get_group_member_elementz@ZeroOrOneChoice._choice_getter.<locals>.get_group_member_element  s    +3++T-E-EFFr   zbReturn the child element belonging to this element group, or |None| if no member child is present.)rL   )r'   r.  s   ` r   r$  zZeroOrOneChoice._choice_getter  s    	G4 	!( ('r   c                 T    | j                   D cg c]  }|j                   c}S c c}w )z|
        Sequence of namespace-prefixed tagnames, one for each of the member
        elements of this choice group.
        )r  r   )r'   r"  s     r   r'  z#ZeroOrOneChoice._member_nsptagnames  s"     15>f!!>>>s   %c                      d| j                   z  S r   r   r   s    r   r*  z0ZeroOrOneChoice._remove_choice_group_method_name  r   r   r   )rI   rJ   rK   rL   rd   r\   r   r!  rw   r$  r   r'  r*  r   r   s   @r   rY   rY     sY    
&
"?X ( ( ? ? . .r   rY   c                   `     e Zd ZdZed        Zd Zd Zd Zd Z	d Z
ed        Z fd	Z xZS )
_OxmlElementBasez;
    Provides common behavior for oxml element classes
    c                 8    | j                   j                  |      S )z
        Return a sequence containing the namespace prefixed child tagnames,
        e.g. 'a:prstGeom', that occur after *tagname* in this element.
        )child_tagnamestagnames_after)r]   r(  s     r   child_tagnames_afterz%_OxmlElementBase.child_tagnames_after  s     !!0099r   c                 B    | j                         j                  |        y)z8
        Remove this element from the XML tree.
        N)	getparentremover   s    r   deletez_OxmlElementBase.delete  s     	%r   c                 R    |D ]"  }| j                  t        |            }| |c S  y)zd
        Return the first child found with tag in *tagnames*, or None if
        not found.
        N)r   r   )r'   tagnamesr(  r   s       r   r-  z%_OxmlElementBase.first_child_found_in  s5    
   	GIIbk*E 	 r   c                 p     | j                   | }||j                  |       |S | j                  |       |S r/   )r-  addpreviousappend)r'   elmr<  	successors       r   r   z&_OxmlElementBase.insert_element_before  sB    -D--x8	 !!#& 
 KK
r   c                 h    | j                  t        |            }|D ]  }| j                  |        y)z=
        Remove all child elements having *tagname*.
        N)r   r   r9  )r'   r(  matchingr   s       r   r  z_OxmlElementBase.remove_all  s1     <<7, 	EKK	r   c                 n    |D ]0  }| j                  t        |            }| | j                  |       2 y)zI
        Remove all child elements having tagname in *tagnames*.
        N)r   r   r9  )r'   r<  r(  r   s       r   remove_if_presentz"_OxmlElementBase.remove_if_present  s7       	%Gii7,G"G$	%r   c                     t        |       S )z
        Return XML string for this element, suitable for testing purposes.
        Pretty printed for readability and without an XML declaration at the
        top.
        )r    r   s    r   r   z_OxmlElementBase.xml
  s     %T**r   c                 6    t         t        |   |t              S )z
        Override of ``lxml`` _Element.xpath() method to provide standard Open
        XML namespace mapping in centralized location.
        )
namespaces)rh   BaseOxmlElementxpathr   )r'   	xpath_strrm   s     r   rJ  z_OxmlElementBase.xpath  s    
 _d1)1OOr   )rI   rJ   rK   rL   classmethodr6  r:  r-  r   r  rE  rw   r   rJ  r   r   s   @r   r2  r2    sU     : :&	% + +P Pr   r2  rI  r/   )(rL   
__future__r   r   rM   lxmlr    r   compatr	   excr
   nsr   r   r   utilr   r   r    r   typerQ   objectrf   rU   rV   r   r   rS   rT   rW   rX   rY   ElementBaser2  dict__dict__rI  rO   r   r   <module>rY     s  
 7 	    ! 0 0 	C<) <)~7d 7("F "J7 7t3 3lY+ Y+x>4 >4B!!% !!H**! **Z(" ("31! 31lI.' I.XEPu(( EPP "))+T2B2K2K-Lr   