�
��abc @` s\ d d l m Z m Z m Z d d l Z d d l m Z d d l m Z y d d l j
j Z Wn# e
k
r� d d l j
j Z n Xd d d d d d
d g Z e j d d k o� e j d
d k Z yC e d � Z e e e � se d � Z e e e � st � n Wn
e Z n Xe Z d e f d � � YZ d � Z d � Z d � Z d � Z d S( i ( t absolute_importt divisiont unicode_literalsN( t
ModuleType( t text_typeu
default_etreeu MethodDispatcheru isSurrogatePairu surrogatePairToCodepointu moduleFactoryFactoryu supports_lone_surrogatesu PY27i i i u "\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 } xi | D]a \ } } t | t t t t f � r[ x7 | D] } | j | | f � q; Wq
| j | | f � q
Wt j | | � t | � t | � k s� t � d | _ d S( N( t
isinstancet listt tuplet frozensett sett appendt dictt __init__t lent AssertionErrort Nonet default( t selft itemst _dictEntriest namet valuet item( ( s? /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyR
4 s
c C` s t j | | | j � S( N( R t getR ( R t key( ( s? /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyt __getitem__C s ( ( t __name__t
__module__t __doc__R
R ( ( ( s? /usr/lib/python2.7/site-packages/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�� ( R t ord( t data( ( s? /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyt isSurrogatePairJ 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? /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_utils.pyt surrogatePairToCodepointP s c ` s i � � � f d � } | S( Nc ` s t t j t d � � r( d | j } n
d | j } t | j � � } y � | | | SWn� t k
rt | � } � | | | � } | j j | � d � k r� i � |