Ñò PhEc @s ddkZddkZddkZddkZddkZddklZhdd6dd6dd6d d 6d d 6Zd „Zd„Zd„Z d„Z ei dƒZ d„Z defd„ƒYZeeieiƒZeiZeiZd„ZeideƒdS(iÿÿÿÿN(tStringIOs&t&s>t>s<t])cSst|iƒS((t xml_escapestgroup(tm((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyts(tretsub(R ((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt xml_escapescCs|idƒ}ti|ƒS(Ntutf8(tencodeturllibt quote_plus(R ((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt url_escapescCs3ti|ƒ}t|ƒp|idƒ}n|S(NR(Rt unquote_plust is_ascii_strtdecode(R ttext((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt url_unescape#s s\A[\x00-\x7f]*\ZcCst|tƒo ti|ƒS(N(t isinstancetstrt _ASCII_retmatch(R((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyR+stXMLEntityEscapercBsieZd„Zd„Zd„ZeidƒZd„Zeidei ei BƒZ d„Z d„Z RS(cCsMtg}|iƒD]\}}||d|fq~ƒ|_||_dS(Nu&%s;(tdictt iteritemstcodepoint2entitytname2codepoint(tselftcodepoint2nameR$t_[1]tctn((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt__init__1s 6cCst|ƒi|iƒS(sŠReplace characters with their character entity references. Only characters corresponding to a named entity are replaced. (tunicodet translateR#(R%R((s2/usr/lib/python2.6/site-packages/myghty/escapes.pytescape_entities6scCsFt|iƒƒ}y|i|SWnttfj o d|SXdS(Ns&#x%X;(tordR R#tKeyErrort IndexError(R%R t codepoint((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt__escape=s s["&<>]|[^\x00-\x7f]cCs%|ii|it|ƒƒidƒS(s3Replace characters with their character references. Replace characters by their named entity references. Non-ASCII characters, if they do not have a named entity reference, are replaced by numerical character references. The return value is guaranteed to be ASCII. tascii(t_XMLEntityEscaper__escapableRt_XMLEntityEscaper__escapeR+R(R%R((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyRGs så& (?: \#(\d+) | \#x([\da-f]+) | ( (?!\d) [:\w] [-.:\w]+ ) ) ;cCs}|iƒ\}}}|ot|ƒ}n0|ot|dƒ}n|ii|dƒ}|djo t|ƒSt|ƒS(Niiýÿi€(tgroupstintR$tgettchrtunichr(R%R tdvalthvaltnameR1((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt __unescape^s  cCs|ii|i|ƒS(sœUnescape character references. All character references (both entity references and numerical character references) are unescaped. (t _XMLEntityEscaper__characterrefsRt_XMLEntityEscaper__unescape(R%R((s2/usr/lib/python2.6/site-packages/myghty/escapes.pytunescapeks(t__name__t __module__R*R-R5RtcompileR4RtXtUNICODER?R@RA(((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyR 0s     cCsSt|tƒo9|i|i|i!}ti|ƒ}t|ƒ|ifS|‚dS(s4An encoding error handler. This python `codecs`_ error handler replaces unencodable characters with HTML entities, or, if no HTML entity exists for the character, XML character references. >>> u'The cost was \u20ac12.'.encode('latin1', 'htmlentityreplace') 'The cost was €12.' N(RtUnicodeEncodeErrortobjecttstarttendt_html_entities_escaperRR+(textbad_textR((s2/usr/lib/python2.6/site-packages/myghty/escapes.pythtmlentityreplace_errors{s thtmlentityreplace(RRRthtmlentitydefstcodecsRR R RRRRDRRRHR R&R$RKR-thtml_entities_escapeRAthtml_entities_unescapeRNtregister_error(((s2/usr/lib/python2.6/site-packages/myghty/escapes.pyt s(<      D