ó
k4Vdc           @` 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(    (    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/html5lib/utils.pyR   1   s    c         C` s   t  j |  | |  j ƒ S(   N(   R   t   getR   (   R   t   key(    (    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/html5lib/utils.pyt   __getitem__?   s    (    (   t   __name__t
   __module__t   __doc__R   R   (    (    (    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/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(    (    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/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(    (    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/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(    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/html5lib/utils.pyt   moduleFactoryX   s    
(    (   R*   R,   (    (   R*   R+   s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/html5lib/utils.pyt   moduleFactoryFactoryU   s    (   t
   __future__R    R   R   t   typesR   t   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-   (    (    (    s\   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/html5lib/utils.pyt   <module>   s*   			
"			