• File: quoting.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/paste/util/__pycache__/quoting.cpython-37.pyc
  • Date Modified: 12/01/2019 7:09 PM
  • File size: 2.19 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

bN	@sddlZddlZddlZddlZdddddgZdZdddZed	Zej	fd
dZ
dddZd
dZddZ
edZedZddZejZejZedkrddlZedS)N
html_quotehtml_unquote	url_quoteurl_unquote
strip_htmlzUTF-8cCs`|pt}|dkrdSt|tr*t|dSt|trFt||dStt||dSdS)z
    Quote the value (turned to a string) as HTML.  This quotes <, >,
    and quotes:

    >>> html_quote(1)
    '1'
    >>> html_quote(None)
    ''
    >>> html_quote('<hey!>')
    '&lt;hey!&gt;'
    >>> html_quote(u'\u1029')
    '\xe1\x80\xa9'
    N)default_encoding
isinstancestrcgiescapeunicodeencode)vencodingrC/opt/alt/python37/lib/python3.7/site-packages/paste/util/quoting.pyrs

z
&([a-zA-Z]+);cCs*||d}|rt|S|dSdS)Nrr)getgroupunichr)matchZname2ccoderrr_entity_subber'srcCs0t|tr$|dkrdS||p t}tt|S)z
    Decode the value.

    >>> html_unquote('&lt;hey&nbsp;you&gt;')
    u'<hey\xa0you>'
    >>> html_unquote('')
    u''
    >>> html_unquote('&blahblah;')
    u'&blahblah;'
    >>> html_unquote('\xe1\x80\xa9')
    u'\u1029'
    r)r
rdecoder	_unquote_resubr)srrrrr.s

cCstdd|}t|}|S)Nz<.*?>r)rerr)rrrrrCscCs|S)z*
    Quoting that doesn't do anything
    r)rrrrno_quoteIsrz\-\s*\>z[---]cCst|}td|}|S)z;
    Quote that makes sure text can't escape a comment
    z-&gt;)r_comment_quote_rer)rcommentrrr
comment_quoteRsr"__main__)N)N)rZhtmlentitydefsurllibr__all__r	rcompilerZname2codepointrrrrr Z
_bad_chars_rer"quoterunquoter__name__ZdoctestZtestmodrrrr<module>s(