ó
^ęWc           @` s  d  d l  m Z m Z m Z d  d l m Z d  d l m Z y d  d l j	 j
 Z Wn# e k
 rw d  d l j	 j Z n Xd d d d d	 d
 g Z yC e d  Z e e e  sŇ e d  Z e e e  sŇ t  n  Wn e Z n Xe Z d e f d     YZ d   Z d   Z d   Z d S(   i    (   t   absolute_importt   divisiont   unicode_literals(   t
   ModuleType(   t	   text_typeNu   default_etreeu   MethodDispatcheru   isSurrogatePairu   surrogatePairToCodepointu   moduleFactoryFactoryu   supports_lone_surrogatesu   "\uD800"u	   u"\uD800"t   MethodDispatcherc           B` s#   e  Z d  Z d d  Z d   Z RS(   up  Dict with 2 special properties:

    On initiation, keys that are lists, sets or tuples are converted to
    multiple keys so accessing any one of the items in the original
    list-like object returns the matching value

    md = MethodDispatcher({("foo", "bar"):"baz"})
    md["foo"] == "baz"

    A default value which can be set through the default attribute.
    c         C` s   g  } xl | D]d \ } } t  |  t t t t f k r^ x7 | D] } | j | | f  q> Wq | j | | f  q Wt j |  |  d  |  _	 d  S(   N(
   t   typet   listt   tuplet	   frozensett   sett   appendt   dictt   __init__t   Nonet   default(   t   selft   itemst   _dictEntriest   namet   valuet   item(    (    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyR   1   s    c         C` s   t  j |  | |  j  S(   N(   R   t   getR   (   R   t   key(    (    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyt   __getitem__?   s    (    (   t   __name__t
   __module__t   __doc__R   R   (    (    (    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyR   $   s   c         C` sh   t  |   d k og t |  d  d k og t |  d  d k og t |  d  d k og t |  d  d k S(   Ni   i    i Ř  i˙Ű  i   i Ü  i˙ß  (   t   lent   ord(   t   data(    (    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyt   isSurrogatePairF   s    ,c         C` s2   d t  |  d  d d t  |  d  d } | S(   Ni   i    i Ř  i   i   i Ü  (   R   (   R   t   char_val(    (    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyt   surrogatePairToCodepointL   s    c         ` s   i      f d   } | S(   Nc         ` s   t  t j t d   r( d |  j } n d |  j } |  k rI  | St |  }   |  | |  } | j j |  |  | <| Sd  S(   Nu    u   _%s_factorys   _%s_factory(   t
   isinstanceR   R   R   t   __dict__t   update(   t
   baseModulet   argst   kwargsR   t   modt   objs(   t   factoryt   moduleCache(    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyt   moduleFactoryX   s    
(    (   R*   R,   (    (   R*   R+   sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyt   moduleFactoryFactoryU   s    (   t
   __future__R    R   R   t   typesR   t   pip._vendor.sixR   t   xml.etree.cElementTreet   etreet   cElementTreet   default_etreet   ImportErrort   xml.etree.ElementTreet   ElementTreet   __all__t   evalt   _xR"   t   AssertionErrort   Falset   supports_lone_surrogatest   TrueR   R   R   R!   R-   (    (    (    sk   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/html5lib/utils.pyt   <module>   s*   			
"			