ó
Ð²Ebc           @` sn   d  d l  m Z m Z m Z y d  d l m Z Wn! e k
 rS d  d l m Z n Xd e f d „  ƒ  YZ d S(   i    (   t   absolute_importt   divisiont   unicode_literals(   t   Mappingt   Triec           B` s5   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z RS(   u   Abstract base class for triesc         ` s?   t  t |  ƒ j ƒ  } ˆ  d  k r+ t | ƒ S‡  f d †  | Dƒ S(   Nc         ` s%   h  |  ] } | j  ˆ  ƒ r | ’ q S(    (   t
   startswith(   t   .0t   x(   t   prefix(    s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pys	   <setcomp>   s   	 (   t   superR   t   keyst   Nonet   set(   t   selfR   R
   (    (   R   s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pyR
      s    
c         C` s.   x' |  j  ƒ  D] } | j | ƒ r t Sq Wt S(   N(   R
   R   t   Truet   False(   R   R   t   key(    (    s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pyt   has_keys_with_prefix   s    c         C` s^   | |  k r | Sx; t  d t | ƒ d ƒ D]  } | |  |  k r* | |  Sq* Wt | ƒ ‚ d  S(   Ni   (   t   ranget   lent   KeyError(   R   R   t   i(    (    s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pyt   longest_prefix   s     c         C` s   |  j  | ƒ } | |  | f S(   N(   R   (   R   R   t   lprefix(    (    s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pyt   longest_prefix_item&   s    N(   t   __name__t
   __module__t   __doc__R   R
   R   R   R   (    (    (    s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pyR   	   s
   			
N(	   t
   __future__R    R   R   t   collections.abcR   t   ImportErrort   collectionsR   (    (    (    s=   /tmp/pip-build-UPPWic/pip/pip/_vendor/html5lib/_trie/_base.pyt   <module>   s
   