
    	hR                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	J
r
JrJrJrJr  SSKJr  SSKJrJrJr  S	S
KJr   " S S\\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r \S\S \S!\S"\S#\ S$0r!\!RE                  5        V Vs0 s H  u  pX_M	     snn r# " S% S&\5      r$g's  snn f )(uD   Implementation of custom properties see § 22.3 in the specification    )warn)Strict)Serialisable)Sequence)AliasStringIntegerFloatDateTimeBool)
NestedText)CUSTPROPS_NS	VTYPES_NSCPROPS_FMTID   )NestedDateTimec                       \ rS rSrSrSrg)NestedBoolText    zP
Descriptor for handling nested elements with the value stored in the text part
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       K/var/www/html/env/lib/python3.13/site-packages/openpyxl/packaging/custom.pyr   r       s     	r   r   c                      ^  \ rS rSrSrSrSr\" SS9r\	" \
S\S9r\	" \S\S9r\	" \S\S9r\" S\S9r\" \S\S9r\" \
SS	9r\" 5       r\" 5       rSS
\S4S jr\S 5       rSU 4S jjrSrU =r$ )_CustomDocumentProperty(   z
Low-level representation of a Custom Document Property.
Not used directly
Must always contain a child element, even if this is empty
propertyNT
allow_none)expected_typer$   	namespace)r$   r&   )r%   r$   r   c                     X0l         X l        Xl        S U l        X@l        UR                  5        H  u  pg[        XU5        [        U SU5        M      U R                   H  nX;  d  M
  [        XS 5        M     g )N_typ)fmtidpidnamer(   
linkTargetitemssetattr__elements__)	selfr+   r*   r)   r,   kwkves	            r   __init__ _CustomDocumentProperty.__init__=   sh     
		$HHJDADQD&!$  ""A{& #r   c                     U R                   b  U R                   $ U R                   H  n[        X5      c  M  Us  $    U R                  b  gg )Nr,   )r(   r/   getattrr,   )r0   as     r   type_CustomDocumentProperty.typeQ   sJ    99 99""At+ # ??& 'r   c                    > [        X R                  S 5      nUc  [        X R                  S5        [        TU ]  S S S S9$ )N )tagnameidxr&   )r8   r(   r.   superto_tree)r0   r>   r?   r&   child	__class__s        r   rA   _CustomDocumentProperty.to_tree\   s;    ii.=D))R(wtFFr   )r(   r)   r,   r+   r*   NNN) r   r   r   r   r   r>   r(   r   r+   r   strr   lpwstrinti4floatr8r   filetimer   boolr,   r)   r	   r*   r   r5   r"   r:   rA   r   __classcell__rC   s   @r   r    r    (   s     GDT"DcdiPF	#$)	LB	%DI	NBCHSDcd;JHE
)C # 	'(    G Gr   r    c                   b   ^  \ rS rSrSrSr\" \\S9r	\
" S5      rS
S jrS rSU 4S jjrS	rU =r$ )_CustomDocumentPropertyListd   z?
Parses and seriliases property lists but is not used directly

Properties)r%   r&   r"   c                     Xl         g Nr"   )r0   r"   s     r   r5   $_CustomDocumentPropertyList.__init__p   s     r   c                 ,    [        U R                  5      $ rU   )lenr"   r0   s    r   __len__#_CustomDocumentPropertyList.__len__t   s    4==!!r   c                    > [        U R                  S5       H  u  p$X$l        M     [        TU ]  XU5      nUR                  S[        5        U$ )N   xmlns)	enumerater"   r*   r@   rA   setr   )r0   r>   r?   r&   ptreerC   s         r   rA   #_CustomDocumentPropertyList.to_treex   sB    q1FCE 2wwY7,'r   rV   )r   rE   )r   r   r   r   r   r>   r   r    r   r"   r   customPropsr5   r[   rA   r   rN   rO   s   @r   rQ   rQ   d   s:     G&=VH
#K!" r   rQ   c                   4    \ rS rSr\" 5       rS rS rS rSr	g)_TypedProperty   c                     Xl         X l        g rU   r+   value)r0   r+   rk   s      r   r5   _TypedProperty.__init__   s     	
r   c                 t    U R                   UR                   :H  =(       a    U R                  UR                  :H  $ rU   rj   )r0   others     r   __eq___TypedProperty.__eq__   s'    yyEJJ&D4::+DDr   c                 f    U R                   R                   SU R                   SU R                   3$ )Nz, name=z, value=)rC   r   r+   rk   rZ   s    r   __repr___TypedProperty.__repr__   s,    ..))*'$))HTZZLQQr   rj   N)
r   r   r   r   r   r+   r5   ro   rr   r   r   r   r   rg   rg      s    8DERr   rg   c                   "    \ rS rSr\" 5       rSrg)IntProperty   r   N)r   r   r   r   r	   rk   r   r   r   r   ru   ru      s	    IEr   ru   c                   "    \ rS rSr\" 5       rSrg)FloatProperty   r   N)r   r   r   r   r
   rk   r   r   r   r   rx   rx      s	    GEr   rx   c                        \ rS rSr\" SS9rSrg)StringProperty   Tr#   r   Nr   r   r   r   r   rk   r   r   r   r   r{   r{      s    d#Er   r{   c                   "    \ rS rSr\" 5       rSrg)DateTimeProperty   r   N)r   r   r   r   r   rk   r   r   r   r   r   r      s	    JEr   r   c                   "    \ rS rSr\" 5       rSrg)BoolProperty   r   N)r   r   r   r   r   rk   r   r   r   r   r   r      s	    FEr   r   c                   "    \ rS rSr\" 5       rSrg)LinkProperty   r   Nr}   r   r   r   r   r      s	    HEr   r   rG   rI   rK   rL   rM   r,   c                   p    \ rS rSr\" \S9rS r\S 5       r	S r
S rS r\S 5       rS	 rS
 rS rS rSrg)CustomPropertyList   )r%   c                     / U l         g rU   propsrZ   s    r   r5   CustomPropertyList.__init__   s	    
r   c                    [         R                  U5      n/ nUR                   H  nUR                  n[        R                  US5      nU(       d  [        SUR                   35        MF  [        XE5      nUR                  nUb  [        nUR                  nU" UR                  US9n	UR                  U	5        M     U " 5       n
X:l        U
$ )z 
Create list from OOXML element
NzUnknown type for rj   )rQ   	from_treer"   r:   XML_MAPPINGgetr   r+   r8   r,   r   appendr   )clsrc   	prop_listr   propattrtyprk   linknew_propnew_prop_lists              r   r   CustomPropertyList.from_tree   s    
 099$?	&&D99D//$-C(45D'E??D"		7HLL" '  #r   c                     UR                   U R                  ;   a  [        SUR                    S35      eU R                  R	                  U5        g )NProperty with name z already exists)r+   names
ValueErrorr   r   )r0   r   s     r   r   CustomPropertyList.append   s=    99

"2499+_MNN

$r   c                 `   / nU R                    H  n[        R                  UR                  S 5      nU(       d  [	        S5      e[        SSUR                  0X2R                  0D6n[        U[        5      (       a  SUl
        UR                  U5        M     [        US9nUR                  5       $ )NzUnknown adapter for {p}r+   rG   rV   r   )r   CLASS_MAPPINGr   rC   	TypeErrorr    r+   rk   
isinstancer   r(   r   rQ   rA   )r0   r   rb   r   npr   s         r   rA   CustomPropertyList.to_tree   s    A $$Q[[$7D 9::(GaffGggGB!\**"LL  0?	  ""r   c                 ,    [        U R                  5      $ rU   )rY   r   rZ   s    r   r[   CustomPropertyList.__len__   s    4::r   c                 X    U R                    Vs/ s H  oR                  PM     sn$ s  snf )zList of property names)r   r+   )r0   rb   s     r   r   CustomPropertyList.names  s"     !%

+
1
+++s   'c                 n    U R                    H  nUR                  U:X  d  M  Us  $    [        SU S35      e)z
Get property by name
r   
 not found)r   r+   KeyError)r0   r+   rb   s      r   __getitem__CustomPropertyList.__getitem__  s9     Avv~  ,TF*=>>r   c                     [        U R                  5       H2  u  p#UR                  U:X  d  M  U R                  R                  U5          g   [	        SU S35      e)z
Delete a propery by name
Nr   r   )r`   r   r+   popr   )r0   r+   r?   rb   s       r   __delitem__CustomPropertyList.__delitem__  sN      

+FCvv~

s# , ,TF*=>>r   c                 L    U R                   R                   SU R                   3$ )Nz containing )rC   r   r   rZ   s    r   rr   CustomPropertyList.__repr__  s"    ..))*,tzzlCCr   c                 ,    [        U R                  5      $ rU   )iterr   rZ   s    r   __iter__CustomPropertyList.__iter__   s    DJJr   r   N)r   r   r   r   r   rg   r   r5   classmethodr   r   rA   r[   r"   r   r   r   rr   r   r   r   r   r   r   r      s_     >2E  8 #" , ,
??D r   r   N)%r   warningsr   openpyxl.descriptorsr   !openpyxl.descriptors.serialisabler   openpyxl.descriptors.sequencer   r   r   r	   r
   r   r   openpyxl.descriptors.nestedr   openpyxl.xml.constantsr   r   r   corer   r   r    rQ   rg   ru   rx   r{   r   r   r   r   r-   r   r   )r2   r3   s   00r   <module>r      s   K  ' : 2   !	T: 	9Gl 9Gx, :RV R&. 
N 
$^ $
~ 
> 
>  H4j&, ,11343sqqs34b  b  5s   C/