ó
³Ebc           @   sE   d  Z  d d l m Z d d l m Z d „  Z d „  Z d „  Z d S(   sž   
markupsafe._native
~~~~~~~~~~~~~~~~~~

Native Python implementation used when the C module is not compiled.

:copyright: 2010 Pallets
:license: BSD-3-Clause
i   (   t   Markup(   t	   text_typec         C   sk   t  |  d ƒ r t |  j ƒ  ƒ St t |  ƒ j d d ƒ j d d ƒ j d d ƒ j d d	 ƒ j d
 d ƒ ƒ S(   s¾  Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
    the string with HTML-safe sequences. Use this if you need to display
    text that might contain such characters in HTML.

    If the object has an ``__html__`` method, it is called and the
    return value is assumed to already be safe for HTML.

    :param s: An object to be converted to a string and escaped.
    :return: A :class:`Markup` string with the escaped text.
    t   __html__t   &s   &amp;t   >s   &gt;t   <s   &lt;t   's   &#39;t   "s   &#34;(   t   hasattrR    R   R   t   replace(   t   s(    (    sj   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/markupsafe/_native.pyt   escape   s    c         C   s   |  d k r t ƒ  St |  ƒ S(   s  Like :func:`escape` but treats ``None`` as the empty string.
    Useful with optional values, as otherwise you get the string
    ``'None'`` when the value is ``None``.

    >>> escape(None)
    Markup('None')
    >>> escape_silent(None)
    Markup('')
    N(   t   NoneR    R   (   R
   (    (    sj   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/markupsafe/_native.pyt   escape_silent&   s    
c         C   s"   t  |  t ƒ s t |  ƒ }  n  |  S(   s¬  Convert an object to a string if it isn't already. This preserves
    a :class:`Markup` string rather than converting it back to a basic
    string, so it will still be marked as safe and won't be escaped
    again.

    >>> value = escape('<User 1>')
    >>> value
    Markup('&lt;User 1&gt;')
    >>> escape(str(value))
    Markup('&amp;lt;User 1&amp;gt;')
    >>> escape(soft_unicode(value))
    Markup('&lt;User 1&gt;')
    (   t
   isinstanceR   (   R
   (    (    sj   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/markupsafe/_native.pyt   soft_unicode5   s    N(   t   __doc__t    R    t   _compatR   R   R   R   (    (    (    sj   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/markupsafe/_native.pyt   <module>
   s
   		