ó —Àv]c @s*dZddlZddlZddlmZmZddddgZejd ejƒZ ejd ƒZ d d d dddhZ ddddddddddh Z e j e j e d„Zd„Zdddd„Zdddd„Zdefd „ƒYZejd!„ejDƒƒZd"„ZdS(#sDQuote strings to be valid DOT identifiers, assemble attribute lists.iÿÿÿÿNi(t_compatttoolstquotet quote_edgeta_listt attr_lists<.*>$s/([a-zA-Z_][a-zA-Z0-9_]*|-?(\.\d+|\d+(\.\d*)?))$tnodetedgetgraphtdigraphtsubgraphtstricttntnetetsetstswtwtnwtct_cCsV||ƒrt|tƒ rn3||ƒ s>|jƒ|krRd|jddƒS|S(sBReturn DOT identifier from string, quote if needed. >>> quote('') '""' >>> quote('spam') 'spam' >>> quote('spam spam') '"spam spam"' >>> quote('-4.2') '-4.2' >>> quote('.42') '.42' >>> quote('<spam>') '<spam>' >>> quote(nohtml('<>')) '"<>"' s"%s"t"s\"(t isinstancetNoHtmltlowertreplace(t identifierthtmltvalid_idt dot_keywords((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyRs cCs~|jdƒ\}}}t|ƒg}|rq|jdƒ\}}}|jt|ƒƒ|rq|j|ƒqqndj|ƒS(séReturn DOT edge statement node_id from string, quote if needed. >>> quote_edge('spam') 'spam' >>> quote_edge('spam spam:eggs eggs') '"spam spam":"eggs eggs"' >>> quote_edge('spam:eggs:s') 'spam:eggs:s' t:(t partitionRtappendtjoin(RRRtresttpartstporttcompass((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyR7s cCs |dk rdt|ƒgng}|r…gtj|ƒD]4\}}|dk r;dt|ƒt|ƒf^q;}|j|ƒn|rýt|dƒr¬tj|ƒ}ng|D]4\}}|dk r³dt|ƒt|ƒf^q³}|j|ƒndj|ƒS(s•Return assembled DOT a_list string. >>> a_list('spam', {'spam': None, 'ham': 'ham ham', 'eggs': ''}) 'label=spam eggs="" ham="ham ham"' slabel=%ss%s=%stitemst N(tNoneRRt mapping_itemstextendthasattrR"(tlabeltkwargst attributestresulttktvR'((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyRMs%G>cCs$t|||ƒ}|sdSd|S(s£Return assembled DOT attribute list string. Sorts ``kwargs`` and ``attributes`` if they are plain dicts (to avoid unpredictable order from hash randomization in Python 3 versions). >>> attr_list() '' >>> attr_list('spam spam', kwargs={'eggs': 'eggs', 'ham': 'ham ham'}) ' [label="spam spam" eggs=eggs ham="ham ham"]' >>> attr_list(kwargs={'spam': None, 'eggs': ''}) ' [eggs=""]' ts [%s](R(R-R.R/tcontent((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyRasRcBs)eZdZdZdZed„ƒZRS(sBMixin for string subclasses disabling fall-through of ``'<...>'``.s?%s subclass that does not treat ``'<...>'`` as DOT HTML string.cCsId|j|jf}||f}i|j|jd6}t|||ƒS(Ns%s_%st__doc__(t__name__t_docttype(tclstothertnametbasestns((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyt_subcls}s ((R6t __module__R5t __slots__R7t classmethodR>(((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyRvsccs$|]}|tj|ƒfVqdS(N(RR>(t.0R((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pys …scCsNytt|ƒ}Wn-tk rCtd|ttƒfƒ‚nX||ƒS(s‡Return copy of ``s`` that will not treat ``'<...>'`` as DOT HTML string in quoting. Args: s: String in which leading ``'<'`` and trailing ``'>'`` should be treated as literal. Raises: TypeError: If ``s`` is not a ``str`` on Python 3, or a ``str``/``unicode`` on Python 2. >>> quote('<>-*-<>') '<>-*-<>' >>> quote(nohtml('<>-*-<>')) '"<>-*-<>"' s.%r does not have one of the required types: %r(tNOHTMLR8tKeyErrort TypeErrortlist(Rtsubcls((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pytnohtmlˆs  (R5tret collectionsR3RRt__all__tcompiletDOTALLt HTML_STRINGtIDtKEYWORDStCOMPASStmatchRRR)RRtobjectRt OrderedDicttstring_classesRCRH(((s1/tmp/pip-install-Qvdv_2/graphviz/graphviz/lang.pyts  $