
    xZiv                     6   S r SSKrSSKrSSKrSSKJr  SSKJrJrJ	r	J
r
Jr  SSKJr  SSKJr  SSKJr  SSKJrJr  S	S
KJr  S	SKJrJrJr  S	SKJrJr  S	SKJrJ r   Sr!Sr"Sr#Sr$Sr%Sr&Sr'\"S\#S\$S\%S\'S\&S0r(\RR                  " S\RT                  5      r+\
" S5      r,S\! S\" S\# S \$ S!\% S"\' S#\& S$3r-S%\,S&\,4S' jr.S%\/S&\R                  4S( jr0S%\R                  S&\/4S) jr1\.4S*\S+S,S-\/S.\\/\4   S&\	\2\/      4
S/ jjr3 " S0 S1\5      r4 " S2 S,\\ 5      r5g)3z~
Anything related to Extensible Metadata Platform (XMP) metadata.

https://en.wikipedia.org/wiki/Extensible_Metadata_Platform
    N)Iterator)AnyCallableOptionalTypeVarUnion)ExpatBuilderNS)Document)Element)
ExpatErrorXMLParserType   )XmpInformationProtocol)
StreamTypedeprecate_with_replacementdeprecation_no_replacement)PdfReadErrorXmpDocumentError)ContentStream	PdfObjectz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://purl.org/dc/elements/1.1/zhttp://ns.adobe.com/xap/1.0/zhttp://ns.adobe.com/pdf/1.3/zhttp://ns.adobe.com/xap/1.0/mm/zhttp://ns.adobe.com/pdfx/1.3/zhttp://www.aiim.org/pdfa/ns/id/dcxmppdfxmpMMpdfaidpdfxa{  
        (?P<year>[0-9]{4})
        (-
            (?P<month>[0-9]{2})
            (-
                (?P<day>[0-9]+)
                (T
                    (?P<hour>[0-9]{2}):
                    (?P<minute>[0-9]{2})
                    (:(?P<second>[0-9]{2}(.[0-9]+)?))?
                    (?P<tzd>Z|[-+][0-9]{2}:[0-9]{2})
                )?
            )?
        )?
        Ku   <?xpacket begin="﻿" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="pypdf">
    <rdf:RDF xmlns:rdf="z?">
        <rdf:Description rdf:about=""
            xmlns:dc="z"
            xmlns:xmp="z"
            xmlns:pdf="z"
            xmlns:xmpMM="z"
            xmlns:pdfaid="z"
            xmlns:pdfx="zM">
        </rdf:Description>
    </rdf:RDF>
</x:xmpmeta>
<?xpacket end="r"?>valuereturnc                     U $ N r   s    c/var/www/eduai.edurigo.com/question_generate/ques_gen_env/lib/python3.13/site-packages/pypdf/xmp.py	_identityr%   j   s    L    c           	      f   [         R                  U 5      nUc  [        SU  35      e[        UR	                  S5      5      n[        UR	                  S5      =(       d    S5      n[        UR	                  S5      =(       d    S5      n[        UR	                  S5      =(       d    S5      n[        UR	                  S5      =(       d    S5      n[
        R                  " UR	                  S	5      =(       d    S5      nUR                  [
        R                  5      nXx-
  S
-  n	[        U5      n
[        U	5      nUR	                  S5      =(       d    Sn[        R                  " X#XEXjU5      nUS:w  aA  S UR                  S5       5       u  pUS-  nUS:  a  US-  nU[        R                  " XS9-   nU$ )NzInvalid date format: yearmonth1dayhour0minutesecondi@B tzdZc              3   8   #    U  H  n[        U5      v   M     g 7fr!   )int).0xs     r$   	<genexpr>"_converter_date.<locals>.<genexpr>   s     !A.Q#a&&.s   :r   )hoursminutes)iso8601match
ValueErrorr3   groupdecimalDecimalto_integralROUND_FLOORdatetimesplit	timedelta)r   matchesr(   r)   r+   r,   r.   r/   seconds_decmilliseconds_decsecondsmillisecondsr0   dt	tzd_hourstzd_minutess                   r$   _converter_daterO   n   si   mmE"G0899w}}V$%Dg&-#.E
gmmE")c
*Cw}}V$+,Dx(/C0F__W]]84;<F$$W%8%89K,	9+G'(L
--

%#C			46L	QB
cz!A#))C.!A	R	q=2K($$9JJIr&   c                     U R                   b:  U R                  5       b)  U R                  [        R                  R
                  5      n U R                  SS9n U R                  S5      $ )z}Format a datetime as UTC with trailing 'Z'.

- If the input is timezone-aware, convert to UTC first.
- If naive, assume UTC.
N)tzinfoz%Y-%m-%dT%H:%M:%S.%fZ)rQ   	utcoffset
astimezonerD   timezoneutcreplacestrftimer#   s    r$   _format_datetime_utcrX      sV     ||EOO$5$A  !2!2!6!67MMM&E>>122r&   elementselfXmpInformation	list_type	converterc                     U R                  [        U5      n/ n[        U5      (       aR  U HJ  nUR                  [        S5       H-  nUR                  U5      nU" U5      nUR	                  U5        M/     ML     U$ g )Nli)getElementsByTagNameNSRDF_NAMESPACElen	_get_textappend)	rY   rZ   r\   r]   
containersretval	containeritemr   s	            r$   _generic_getri      st     //yIJF
:#I!88Mt,!%(e$ N $
 r&   c                   z   ^  \ rS rSrSrS\S\S\\   S\\   S\S\\   S	\\   S
S4S jrS\	S
S4U 4S jjr
SrU =r$ )_XmpBuilder   aO  
Custom XML parser denying all entity declarations.

This is a stripped down and typed version inspired by what *defusedxml* does.

Why do we need this? The default limits of *libexpat* used by Python only block exponential entity expansion,
but not cases like quadratic entity expansion which can still cause quite some memory usage.
entity_nameis_parameter_entityr   base	system_id	public_idnotation_namer   Nc                      [        SU< 35      e)NzForbidden entities: )r   )rZ   rm   rn   r   ro   rp   rq   rr   s           r$   !custom_entity_declaration_handler-_XmpBuilder.custom_entity_declaration_handler   s     /?@@r&   parserc                 F   > [         TU ]  U5        U R                  Ul        g r!   )superinstallrt   EntityDeclHandler)rZ   rv   	__class__s     r$   ry   _XmpBuilder.install   s    #'#I#I r&   r"   )__name__
__module____qualname____firstlineno____doc__strboolr   rt   r   ry   __static_attributes____classcell__)r{   s   @r$   rk   rk      s    
A
A "&
A C=	
A
 3-
A 
A  }
A $C=
A 

AJm J J Jr&   rk   c                   4   \ rS rSrSrS\SS4S jr\SVS j5       r SWS\	S\
S\\4   SS4S	 jjrS
\S\S\S\\   4S jrS
\S\S\\   4S jrS\S\4S jr\4S\S\S\\/\4   S\\   4S jjrS\S\S\\\      4S jr\4S\S\S\\/\4   S\\\      4S jjrS\S\S\\\\4      4S jr\S\\\      4S j5       r\R>                  S\\\      SS4S j5       r\S\\   4S j5       r \ R>                  S\\   SS4S j5       r \S\\\      4S j5       r!\!R>                  S\\\      SS4S j5       r!\S\\\"RD                        4S j5       r#\#R>                  S\\\
\\"RD                  4         SS4S j5       r#\S\\\\4      4S  j5       r$\$R>                  S\\\\4      SS4S! j5       r$\S\\   4S" j5       r%\%R>                  S\\   SS4S# j5       r%\S\\   4S$ j5       r&\&R>                  S\\   SS4S% j5       r&\S\\\      4S& j5       r'\'R>                  S\\\      SS4S' j5       r'\S\\\      4S( j5       r(\(R>                  S\\\      SS4S) j5       r(\S\\\      4S* j5       r)\)R>                  S\\\      SS4S+ j5       r)\S\\\\4      4S, j5       r*\*R>                  S\\\\4      SS4S- j5       r*\S\\   4S. j5       r+\+R>                  S\\   SS4S/ j5       r+\S\\\      4S0 j5       r,\,R>                  S\\\      SS4S1 j5       r,\S\\\\4      4S2 j5       r-\-R>                  S\\\\4      SS4S3 j5       r-\S\\\      4S4 j5       r.\.R>                  S\\\      SS4S5 j5       r.\S\\   4S6 j5       r/\/R>                  S\\   SS4S7 j5       r/\S\\   4S8 j5       r0\0R>                  S\\   SS4S9 j5       r0\S\\   4S: j5       r1\1R>                  S\\   SS4S; j5       r1\S\\"RD                     4S< j5       r2\2R>                  S\\"RD                     SS4S= j5       r2\S\\"RD                     4S> j5       r3\3R>                  S\\"RD                     SS4S? j5       r3\S\\"RD                     4S@ j5       r4\4R>                  S\\"RD                     SS4SA j5       r4\S\\   4SB j5       r5\5R>                  S\\   SS4SC j5       r5\S\\   4SD j5       r6\6R>                  S\\   SS4SE j5       r6\S\\   4SF j5       r7\7R>                  S\\   SS4SG j5       r7\S\\   4SH j5       r8\8R>                  S\\   SS4SI j5       r8\S\\   4SJ j5       r9\9R>                  S\\   SS4SK j5       r9\S\\\4   4SL j5       r:SXS
\S\4SM jjr;S\S\SS4SN jr<S\S\S\\   SS4SO jr=S\S\S\\\      SS4SP jr>S\S\S\\\      SS4SQ jr?S\S\S\\\\4      SS4SR jr@S\S\4SS jrASYST jrBSUrCg)Zr[      z
An object that represents Extensible Metadata Platform (XMP) metadata.
Usually accessed by :py:attr:`xmp_metadata()<pypdf.PdfReader.xmp_metadata>`.

Raises:
  PdfReadError: if XML is invalid

streamr   Nc                    Xl          U R                   R                  5       n[        5       R                  U5      nUR                  [        S5      S   U l	        0 U l
        g ! [        [
        4 a  n[        SU 35      eS nAff = f)Nz#XML in XmpInformation was invalid: RDFr   )r   get_datark   parseStringAttributeErrorr   r   r`   ra   rdf_rootcache)rZ   r   datadoc_rootes        r$   __init__XmpInformation.__init__   s    	J;;'')D!,!:!:4!@H %-$C$C5%

% &(
 
+ 	J!DQCHII	Js   3A! !B1A??Bc                 r    [        SS5      nUR                  [        R                  S5      5        U " U5      $ )z
Create a new XmpInformation object with minimal structure.

Returns:
    A new XmpInformation instance with empty metadata fields.
Nutf-8)r   set_data_MINIMAL_XMPencode)clsr   s     r$   createXmpInformation.create   s1     tT*++G456{r&   encryption_keyc                 r    [        SSS5        Ub  [        SS5        U R                  R                  U5        g )NzXmpInformation.write_to_streamzPdfWriter.xmp_metadataz6.0.0z/the encryption_key parameter of write_to_streamz5.0.0)r   r   r   write_to_stream)rZ   r   r   s      r$   r   XmpInformation.write_to_stream   s>     	#,$	

 %&A7 	##F+r&   	about_uri	namespacenamec              #      #    U R                   R                  [        S5       HP  nUR                  [        S5      U:X  d  M  UR	                  X#5      nUb  Uv   UR                  X#5       S h  vN   MR     g  N	7fNDescriptionabout)r   r`   ra   getAttributeNSgetAttributeNodeNS)rZ   r   r   r   descattrs         r$   get_elementXmpInformation.get_element   sk     MM88VD""=':iG..y?#J66yGGG W
 Hs   <A:,A:.A8/
A:c              #     #    U R                   R                  [        S5       H  nUR                  [        S5      U:X  d  M  [	        UR
                  R                  5       H=  nUR
                  R                  U5      nU(       d  M'  UR                  U:X  d  M9  Uv   M?     UR                   H  nUR                  U:X  d  M  Uv   M     M     g 7fr   )
r   r`   ra   r   range
attributeslengthrh   namespaceURI
childNodes)rZ   r   r   r   ir   childs          r$   get_nodes_in_namespace%XmpInformation.get_nodes_in_namespace   s     MM88VD""=':iGt556A??//2Dt 1 1Y >"
 7 "__E))Y6# - Ws   <CACC%CCrY   c                     SnUR                    H-  nUR                  UR                  :X  d  M  X#R                  -  nM/     U$ N )r   nodeType	TEXT_NODEr   )rZ   rY   textr   s       r$   rc   XmpInformation._get_text  s:    ''E~~0

" ( r&   r]   c                 j   U R                   R                  U0 5      R                  U5      nU(       a  U$ S nU R                  SX5       H;  nUR                  UR                  :X  a  UR
                  nOU R                  U5      n  O   Ub  U" U5      nU R                   R                  U0 5      nXWU'   U$ r   )r   getr   r   ATTRIBUTE_NODE	nodeValuerc   
setdefault)rZ   r   r   r]   cachedr   rY   ns_caches           r$   _get_single_value XmpInformation._get_single_value  s     	2.2248M''I<G7#9#99))w/ = e$E::((B7r&   c                 h   U R                   R                  U0 5      R                  U5      nU(       a  U$ / nU R                  SX5       HE  n[        XPSS9=nb  UR	                  U5        M#  U R                  U5      nUR                  U5        MG     U R                   R                  U0 5      nXHU'   U$ )Nr   Bagr\   r   r   r   ri   extendrc   rd   r   )	rZ   r   r   r   rf   rY   bagsr   r   s	            r$   _getter_bagXmpInformation._getter_bag!  s    	2.2248M''I<G$WeDDQd#w/e$ = ::((B7r&   c                    U R                   R                  U0 5      R                  U5      nU(       a  U$ / nU R                  SX5       Hl  n[        X`SUS9=nb  UR	                  U5        M$  [        X`SS9=nb  UR	                  U5        MD  U" U R                  U5      5      n	UR                  U	5        Mn     U R                   R                  U0 5      n
XZU'   U$ )Nr   Seq)r\   r]   r   r   r   )rZ   r   r   r]   r   rf   rY   seqsr   r   r   s              r$   _get_seq_valuesXmpInformation._get_seq_values0  s     	2.2248M''I<G$WeyYYfd#&wFF$S d#!$.."9:e$ = ::((B7r&   c                    U R                   R                  U0 5      R                  U5      nU(       a  U$ 0 nU R                  SX5       H  nUR                  [        S5      n[        U5      (       aL  U HD  nUR                  [        S5       H'  nU R                  U5      n	XUR                  S5      '   M)     MF     Mu  U R                  U5      US'   M     U R                   R                  U0 5      n
XJU'   U$ )Nr   Altr_   xml:langz	x-default)	r   r   r   r`   ra   rb   rc   getAttributer   )rZ   r   r   r   rf   rY   altsaltrh   r   r   s              r$   _get_langalt_values"XmpInformation._get_langalt_valuesM  s    	2.2248M!#''I<G11-GD4yyC # : :=$ O $t 4@Et00<= !P  
 '+nnW&={# = ::((B7r&   c                 .    U R                  [        S5      $ )z6Contributors to the resource (other than the authors).contributorr   DC_NAMESPACErZ   s    r$   dc_contributorXmpInformation.dc_contributor_  s     m<<r&   valuesc                 2    U R                  [        SU5        g )Nr   _set_bag_valuesr   rZ   r   s     r$   r   r   d  s    \=&Ar&   c                 .    U R                  [        S5      $ )z4Text describing the extent or scope of the resource.coverager   r   r   s    r$   dc_coverageXmpInformation.dc_coverageh  s     %%lJ??r&   r   c                 2    U R                  [        SU5        g )Nr   _set_single_valuer   rZ   r   s     r$   r   r   m  s    |Z?r&   c                 .    U R                  [        S5      $ )zVA sorted array of names of the authors of the resource, listed in order of precedence.creator)r   r   r   s    r$   
dc_creatorXmpInformation.dc_creatorq  s     ##L)<<r&   c                 2    U R                  [        SU5        g )Nr   )_set_seq_valuesr   r   s     r$   r   r   v      \9f=r&   c                 8    U R                  [        S[        5      $ )zXA sorted array of dates of significance to the resource. The dates and times are in UTC.date)r   r   rO   r   s    r$   dc_dateXmpInformation.dc_datez  s     ##L&/JJr&   c                 (   Uc  U R                  [        SS 5        g / nU HX  n[        U[        R                  5      (       a  UR	                  [        U5      5        M>  UR	                  [        U5      5        MZ     U R                  [        SU5        g )Nr   )r   r   
isinstancerD   rd   rX   r   )rZ   r   date_stringsr   s       r$   r   r     su    >  vt<LeX%6%677 ''(<U(CD ''E
3	  
   v|Dr&   c                 .    U R                  [        S5      $ )zSA language-keyed dictionary of textual descriptions of the content of the resource.descriptionr   r   r   s    r$   dc_descriptionXmpInformation.dc_description  s     ''mDDr&   c                 2    U R                  [        SU5        g )Nr  _set_langalt_valuesr   r   s     r$   r  r    s      }fEr&   c                 .    U R                  [        S5      $ )zThe mime-type of the resource.formatr   r   s    r$   	dc_formatXmpInformation.dc_format       %%lH==r&   c                 2    U R                  [        SU5        g )Nr	  r   r   s     r$   r
  r        |Xu=r&   c                 .    U R                  [        S5      $ )z"Unique identifier of the resource.
identifierr   r   s    r$   dc_identifierXmpInformation.dc_identifier  s     %%lLAAr&   c                 2    U R                  [        SU5        g )Nr  r   r   s     r$   r  r    s    |\5Ar&   c                 .    U R                  [        S5      $ )zAAn unordered array specifying the languages used in the resource.languager   r   s    r$   dc_languageXmpInformation.dc_language       j99r&   c                 2    U R                  [        SU5        g )Nr  r   r   s     r$   r  r        \:v>r&   c                 .    U R                  [        S5      $ )z&An unordered array of publisher names.	publisherr   r   s    r$   dc_publisherXmpInformation.dc_publisher  s     k::r&   c                 2    U R                  [        SU5        g )Nr  r   r   s     r$   r  r    s    \;?r&   c                 .    U R                  [        S5      $ )zLAn unordered array of text descriptions of relationships to other documents.relationr   r   s    r$   dc_relationXmpInformation.dc_relation  r  r&   c                 2    U R                  [        SU5        g )Nr!  r   r   s     r$   r"  r#    r  r&   c                 .    U R                  [        S5      $ )z`A language-keyed dictionary of textual descriptions of the rights the user has to this resource.rightsr  r   s    r$   	dc_rightsXmpInformation.dc_rights  s     ''h??r&   c                 2    U R                  [        SU5        g )Nr&  r  r   s     r$   r'  r(    s      x@r&   c                 .    U R                  [        S5      $ )zCUnique identifier of the work from which this resource was derived.sourcer   r   s    r$   	dc_sourceXmpInformation.dc_source  r  r&   c                 2    U R                  [        SU5        g )Nr+  r   r   s     r$   r,  r-    r  r&   c                 .    U R                  [        S5      $ )z\An unordered array of descriptive phrases or keywords that specify the topic of the content.subjectr   r   s    r$   
dc_subjectXmpInformation.dc_subject  s     i88r&   c                 2    U R                  [        SU5        g )Nr0  r   r   s     r$   r1  r2    r   r&   c                 .    U R                  [        S5      $ )z9A language-keyed dictionary of the title of the resource.titler  r   s    r$   dc_titleXmpInformation.dc_title  s     ''g>>r&   c                 2    U R                  [        SU5        g )Nr5  r  r   s     r$   r6  r7    s      w?r&   c                 .    U R                  [        S5      $ )z@An unordered array of textual descriptions of the document type.typer   r   s    r$   dc_typeXmpInformation.dc_type  s     f55r&   c                 2    U R                  [        SU5        g )Nr:  r   r   s     r$   r;  r<    s    \66:r&   c                 .    U R                  [        S5      $ )z:An unformatted text string representing document keywords.Keywordsr   PDF_NAMESPACEr   s    r$   pdf_keywordsXmpInformation.pdf_keywords       %%mZ@@r&   c                 2    U R                  [        SU5        g )Nr?  r   rA  r   s     r$   rB  rC        }j%@r&   c                 .    U R                  [        S5      $ )z-The PDF file version, for example 1.0 or 1.3.
PDFVersionr@  r   s    r$   pdf_pdfversionXmpInformation.pdf_pdfversion  s     %%m\BBr&   c                 2    U R                  [        SU5        g )NrI  rF  r   s     r$   rJ  rK    s    }lEBr&   c                 .    U R                  [        S5      $ )z6The name of the tool that saved the document as a PDF.Producerr@  r   s    r$   pdf_producerXmpInformation.pdf_producer  rD  r&   c                 2    U R                  [        SU5        g )NrN  rF  r   s     r$   rO  rP    rG  r&   c                 8    U R                  [        S[        5      $ )zYThe date and time the resource was originally created. Returned as a UTC datetime object.
CreateDater   XMP_NAMESPACErO   r   s    r$   xmp_create_dateXmpInformation.xmp_create_date
       %%m\?SSr&   c                     U(       a#  [        U5      nU R                  [        SU5        g U R                  [        SS 5        g )NrS  rX   r   rU  rZ   r   date_strs      r$   rV  rW    3    +E2H""=,I""=,Er&   c                 8    U R                  [        S[        5      $ )zTThe date and time the resource was last modified. Returned as a UTC datetime object.
ModifyDaterT  r   s    r$   xmp_modify_dateXmpInformation.xmp_modify_date  rX  r&   c                     U(       a#  [        U5      nU R                  [        SU5        g U R                  [        SS 5        g )Nr_  rZ  r[  s      r$   r`  ra    r]  r&   c                 8    U R                  [        S[        5      $ )zjThe date and time that any metadata for this resource was last changed. Returned as a UTC datetime object.MetadataDaterT  r   s    r$   xmp_metadata_date XmpInformation.xmp_metadata_date$  s     %%m^_UUr&   c                     U(       a#  [        U5      nU R                  [        SU5        g U R                  [        SS 5        g )Nrd  rZ  r[  s      r$   re  rf  )  s3    +E2H""=.(K""=.$Gr&   c                 .    U R                  [        S5      $ )z=The name of the first known tool used to create the resource.CreatorTool)r   rU  r   s    r$   xmp_creator_toolXmpInformation.xmp_creator_tool1  s     %%m]CCr&   c                 2    U R                  [        SU5        g )Nri  )r   rU  r   s     r$   rj  rk  6  s    }mUCr&   c                 .    U R                  [        S5      $ )zGThe common identifier for all versions and renditions of this resource.
DocumentIDr   XMPMM_NAMESPACEr   s    r$   xmpmm_document_id XmpInformation.xmpmm_document_id:       %%o|DDr&   c                 2    U R                  [        SU5        g )Nrn  r   rp  r   s     r$   rq  rr  ?      eDr&   c                 .    U R                  [        S5      $ )zZAn identifier for a specific incarnation of a document, updated each time a file is saved.
InstanceIDro  r   s    r$   xmpmm_instance_id XmpInformation.xmpmm_instance_idC  rs  r&   c                 2    U R                  [        SU5        g )Nrx  ru  r   s     r$   ry  rz  H  rv  r&   c                 .    U R                  [        S5      $ )zMThe part of the PDF/A standard that the document conforms to (e.g., 1, 2, 3).partr   PDFAID_NAMESPACEr   s    r$   pdfaid_partXmpInformation.pdfaid_partL  s     %%&6??r&   c                 2    U R                  [        SU5        g )Nr}  r   r  r   s     r$   r  r  Q  s    /?r&   c                 .    U R                  [        S5      $ )zFThe conformance level within the PDF/A standard (e.g., 'A', 'B', 'U').conformancer~  r   s    r$   pdfaid_conformance!XmpInformation.pdfaid_conformanceU  s     %%&6FFr&   c                 2    U R                  [        SU5        g )Nr  r  r   s     r$   r  r  Z  s    /Fr&   c           
         [        U S5      (       d  0 U l        U R                  S[        5       H  nUR                  n UR                  S5      nUS:X  a  O+USU [        [        X#S-   US-    SS	95      -   X#S-   S -   nMC  UR                  UR                  :X  a  UR                  nOU R                  U5      nX@R                  U'   M     U R                  $ )
z
Retrieve custom metadata properties defined in the undocumented pdfx
metadata schema.

Returns:
    A dictionary of key/value items for custom metadata properties.

_custom_propertiesr   u   ↂr9   Nr         )ro   )hasattrr  r   PDFX_NAMESPACE	localNamefindchrr3   r   r   r   rc   )rZ   nodekeyidxr   s        r$   custom_properties XmpInformation.custom_properties^  s     t122&(D#33BGnn((8,CbyDS	c#Aga"8rBCDAgi.)   ==D$7$77 NNE NN40E/4'',! H" &&&r&   c                 h   U R                   R                  [        S5       H!  nUR                  [        S5      U:X  d  M  Us  $    U R                   R                  nUc  [        S5      eUR                  [        S5      nUR                  [        SU5        U R                   R                  U5        U$ )zBGet or create an rdf:Description element with the given about URI.r   r   XMP Document is Nonezrdf:Descriptionz	rdf:about)	r   r`   ra   r   ownerDocumentr   createElementNSsetAttributeNSappendChild)rZ   r   r   docs       r$   _get_or_create_description)XmpInformation._get_or_create_description}  s    MM88VD""=':iG W mm));"#9::""=2CDM;	B!!$'r&   c                 Z    U R                   R                  U5      nU(       a	  X#;   a  X2	 ggg)z<Remove a cached value for a given namespace/name if present.N)r   r   )rZ   r   r   r   s       r$   _clear_cache_entry!XmpInformation._clear_cache_entry  s(    ::>>),( )8r&   c                 4   U R                  X5        U R                  5       n[        UR                  X5      5      nU H  nUR	                  U5        M     UR                  X5      =n(       a  UR                  U5        Ub  U R                  R                  nUc  [        S5      eU R                  U5      n	UR                  X SU 35      nUR                  [        U5      5      n
UR                  U
5        UR                  U5        U R                  5         g)z&Set or remove a single metadata value.Nr  r8   )r  r  listr`   removeChildr   removeAttributeNoder   r  r   _get_namespace_prefixr  createTextNoder   r  _update_stream)rZ   r   r   r   r   existing_elementselemexisting_attrr  prefix	text_nodes              r$   r    XmpInformation._set_single_value  s    	0..0 !<!<Y!MN%DT" & !33IDD=D$$]3----C{&'=>>//	:F&&yHAdV2DED**3u:6IY'T"r&   c                    U R                  X5        U R                  5       n[        UR                  X5      5      nU H  nUR	                  U5        M     U(       a  U R
                  R                  nUc  [        S5      eU R                  U5      nUR                  X SU 35      nUR                  [        S5      n	U HU  n
UR                  [        S5      nUR                  [        U
5      5      nUR                  U5        U	R                  U5        MW     UR                  U	5        UR                  U5        U R                  5         g)z+Set or remove bag values (unordered array).Nr  r8   zrdf:Bagrdf:lir  r  r  r`   r  r   r  r   r  r  ra   r  r   r  r  )rZ   r   r   r   r   r  r  r  r  bagr   r_   r  s                r$   r   XmpInformation._set_bag_values      	0..0 !<!<Y!MN%DT" & ----C{&'=>>//	:F&&yHAdV2DED%%mY?C((A..s5z:	y)#	   S!T"r&   c                    U R                  X5        U R                  5       n[        UR                  X5      5      nU H  nUR	                  U5        M     U(       a  U R
                  R                  nUc  [        S5      eU R                  U5      nUR                  X SU 35      nUR                  [        S5      n	U HU  n
UR                  [        S5      nUR                  [        U
5      5      nUR                  U5        U	R                  U5        MW     UR                  U	5        UR                  U5        U R                  5         g)z.Set or remove sequence values (ordered array).Nr  r8   zrdf:Seqr  r  )rZ   r   r   r   r   r  r  r  r  seqr   r_   r  s                r$   r   XmpInformation._set_seq_values  r  r&   c                    U R                  X5        U R                  5       n[        UR                  X5      5      nU H  nUR	                  U5        M     U(       Ga   U R
                  R                  nUc  [        S5      eU R                  U5      nUR                  X SU 35      nUR                  [        S5      n	UR                  5        Hi  u  pUR                  [        S5      nUR                  SU
5        UR                  [        U5      5      nUR                  U5        U	R                  U5        Mk     UR                  U	5        UR                  U5        U R!                  5         g)z*Set or remove language alternative values.Nr  r8   zrdf:Altr  r   )r  r  r  r`   r  r   r  r   r  r  ra   itemssetAttributer  r   r  r  )rZ   r   r   r   r   r  r  r  r  r   langr   r_   r  s                 r$   r  "XmpInformation._set_langalt_values  s6   	0..0 !<!<Y!MN%DT" & ----C{&'=>>//	:F&&yHAdV2DED%%mY?C%||~((A
D1..s5z:	y)#  . S!T"r&   c                 .    [         R                  US5      $ )z?Get the appropriate namespace prefix for a given namespace URI.unknown)_NAMESPACE_PREFIX_MAPr   )rZ   r   s     r$   r  $XmpInformation._get_namespace_prefix  s    $((I>>r&   c                     U R                   R                  nUc  [        S5      eUR                  SS9nU R                  R                  U5        g)z/Update the stream with the current XML content.Nr  r   )encoding)r   r  r   toxmlr   r   )rZ   r  xml_datas      r$   r  XmpInformation._update_stream  sD    mm));"#9::99g9.X&r&   )r  r   r   r   )r   r[   r!   )r   )r   N)Dr}   r~   r   r   r   r   r   classmethodr   r   r   r   bytesr   r   r   r   r   
XmlElementrc   r%   r   r   r   r  r   r   dictr   propertyr   setterr   r   rD   r   r  r
  r  r  r  r"  r'  r,  r1  r6  r;  rB  rJ  rO  rV  r`  re  rj  rq  ry  r  r  r  r  r  r   r   r   r  r  r  r   r"   r&   r$   r[   r[      s|   
(} 
( 
( 	 	 MQ, ,27c58H2I,	,HS HS H HQT H	$ 	$ 	$QT 	$   +4	  SE3J'	
 
#,S  c8K & +4	  SE3J'	
 
$s)	:S  cSVh@X $ =c 3 = = BXd3i%8 BT B B @Xc] @ @ @# @4 @ @ =HT#Y/ = = >$s)!4 > > > K$x'8'8"9: K K ^^
EhtE#x7H7H2H,I'JK 
EPT 
E 
E Ec3h 8 E E FXd38n%= F$ F F >8C= > > >x} > > > Bx} B B B8C= BT B B :Xd3i0 : : ?(49"5 ?$ ? ? ;htCy1 ; ; @8DI#6 @4 @ @ :Xd3i0 : : ?(49"5 ?$ ? ? @8DcN3 @ @ Ac3h 8 AT A A >8C= > > >x} > > > 9HT#Y/ 9 9 >$s)!4 > > > ?(4S>2 ? ? __@xS#X7 @D @ @ 6$s), 6 6 ^^;htCy1 ;d ; ; Ahsm A A A(3- AD A A C C C CHSM Cd C C Ahsm A A A(3- AD A A T(*;*;!< T T FXh.?.?%@ FT F F T(*;*;!< T T FXh.?.?%@ FT F F V8H,=,=#> V V Hx0A0A'B Ht H H D(3- D D Dhsm D D D E8C= E E Ex} E E E E8C= E E Ex} E E E @Xc] @ @ @# @4 @ @ GHSM G G G G$ G G '4S> ' '<C  C s t 3 c (3- TX 0 C $s)AT Y] 8 C $s)AT Y] 8S  XdSVX[S[nE] bf :?s ?s ?'r&   )6r   rD   r@   recollections.abcr   typingr   r   r   r   r   xml.dom.expatbuilderr	   xml.dom.minidomr
   r   r  xml.parsers.expatr   r   
_protocolsr   _utilsr   r   r   errorsr   r   genericr   r   ra   r   rU  rA  rp  r  r  r  compileVERBOSEr<   r   r   r%   r   rO   rX   r  ri   rk   r[   r"   r&   r$   <module>r     s     	 $  0 $ 1 7 . V V 2 -=1..3( 1 5  $55WhF  ** JJ!( CL& (#n %% '% ')* ++, -'( ) Q 1 3 8#4#4 6
3 1 1 
3c 
3 hq#3@CPXZ]Y^`cYcPdd3iJ. J8H	'+Y H	'r&   