ó
[c           @   s;   d  d l  m Z d  d l Z d   Z d   Z d   Z d S(   i’’’’(   t   OrderedDictNc         C   s&   |  d d p d |  d d f } | S(   sū   Returns appropriate key for sorting attribute names

    Attribute names are a tuple of ``(namespace, name)`` where namespace can be
    ``None`` or a string. These can't be compared in Python 3, so we conver the
    ``None`` to an empty string.

    i    t    i   (    (   t   attrt   key(    (    s+   lib/python2.7/site-packages/bleach/utils.pyt	   _attr_key   s    "c         C   sE   |  s
 |  St  g  t |  j   d t D] \ } } | | f ^ q&  S(   sB   Takes a dict of attributes (or None) and returns them alphabetizedR   (   R    t   sortedt   itemsR   (   t   attrst   kt   v(    (    s+   lib/python2.7/site-packages/bleach/utils.pyt   alphabetize_attributes   s    c         C   s)   t  |  t j  r |  St j |  d d  S(   s   Takes a text (Python 2: str/unicode; Python 3: unicode) and converts to unicode

    :arg str/unicode text: the text in question

    :returns: text as unicode

    :raises UnicodeDecodeError: if the text was a Python 2 str and isn't in
        utf-8

    s   utf-8t   strict(   t
   isinstancet   sixt	   text_type(   t   text(    (    s+   lib/python2.7/site-packages/bleach/utils.pyt   force_unicode   s    (   t   collectionsR    R   R   R
   R   (    (    (    s+   lib/python2.7/site-packages/bleach/utils.pyt   <module>   s   		
