;iddlZddlmZddlmZmZmZddlmZddl m Z ddl m Z m Z ddlmZmZGdd eZGd d e Zd Zd ZddZdS)N)warn)StringAliasSequence) Serialisable) ElementList)REL_NS PKG_REL_NS)Element fromstringceZdZdZdZeZeZedZ edZ edZ edZ ddZ dS) Relationshipz'Represents many kinds of relationships.TargetT) allow_noneIdNcx|dt|}||_||_||_||_dS)z `type` can be used as a shorthand with the default relationships namespace otherwise the `Type` must be a fully qualified URL Nz{0}/{1})formatr Typer TargetModer)selfrrtyperrs SC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\openpyxl/packaging/relationship.py__init__zRelationship.__init__"s?  ##FD11D  $)NNNNN)__name__ __module__ __qualname____doc__tagnamerrrrtargetrridrrrrrs11G 688D VXXF U8__F4(((J 4 B tB rrcBeZdZdZeZfdZdZdZdZ fdZ xZ S)RelationshipList Relationshipsct||jsdt||_dSdS)NrId)superappendrlen)rvalue __class__s rr)zRelationshipList.append;sF ux )(SYY((EHHH ) )rc#2K|D]}|j|kr|VdS)z Find relationships by content-type NB. these content-types namespaced objects and different to the MIME-types in the package manifest :-( N)r)r content_typers rfindzRelationshipList.findAs8   Av%%  rcn|D]}|j|kr|cStd|)NzUnknown relationship: {0})rKeyErrorr)rkeyr/s rgetzRelationshipList.getLsG  Ats{{299#>>???rcd|DS)z,Return a dictionary of relations keyed by idci|] }|j| Sr")r!).0r/s r z,RelationshipList.to_dict..Us%%%1Q%%%rr")rs rto_dictzRelationshipList.to_dictSs%%%%%%rc~t}|dt|S)Nxmlns)r(to_treesetr )rtreer,s rr<zRelationshipList.to_treeXs/ww   *%%% r) rrrrr expected_typer)r0r4r9r< __classcell__)r,s@rr$r$5sG M))))) @@@&&& rr$ctj|\}}tj|dd|}|S)z Convert relative path to absolutes that can be loaded from a zip archive. The path to be passed in is that of containing object (workbook, worksheet, etc.) _relsz{0}.rels) posixpathsplitjoinr)pathfolderobjfilenames r get_rels_pathrJ^s=/$''KFC~fgz/@/@/E/EFFH OrcL||}t|} t|}nB#t$r5d|}t |t}YnwxYwtj|}tj |d}|D]p}|j dkr|j dr|j dd|_ =tj ||j } tj| |_ q|S)zl Normalise dependency file paths to absolute ones Relative paths are relative to parent object z+{0} contains invalid dependency definitionsrExternal/N)readr r$ from_tree TypeErrorrrrCdirnamerDrr startswithrEnormpath) archiverIsrcnoderelsmsgrGparentr/pths rget_dependentsr\js ,,x C c??D"))$// """;BB8LL S !!" x ( (F _V $ $Q 'F // <: % %  X  % % /x|AHH.22C )#..AHH KsArH rels_paths rget_relrgs Cy>>KIJJJ ~hhrll tyy..//CC    FF  :D ,,t  C c??D --  Cd##I!'955  Js#'A"" A0/A0CC-,C-)NN)rCwarningsropenpyxl.descriptorsrrr!openpyxl.descriptors.serialisableropenpyxl.descriptors.containerropenpyxl.xml.constantsr r openpyxl.xml.functionsr r rr$rJr\rgr"rrrnsO ;:::::66666655555555 <@&&&&&{&&&R   6r