관리-도구
편집 파일: py.cpython-38.pyc
U ��.e� � @ sL d dl mZmZmZ d dlmZ d dlmZ ddlm Z G dd� de �Z dS ) � )�absolute_import�division�unicode_literals)� text_type)�bisect_left� )�Triec @ sF e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zddd �Zdd� Z dS )r c C sJ t dd� |�� D ��std��|| _t|�� �| _d| _dt|�f| _d S )Nc s s | ]}t |t�V qd S �N)� isinstancer )�.0�x� r �A/usr/lib/python3.8/site-packages/pip/_vendor/html5lib/_trie/py.py� <genexpr> s z Trie.__init__.<locals>.<genexpr>zAll keys must be strings� r ) �all�keys� TypeError�_data�sorted�_keys� _cachestr�len�_cachepoints)�self�datar r r �__init__ s z Trie.__init__c C s || j kS r �r �r �keyr r r �__contains__ s zTrie.__contains__c C s t | j�S r )r r �r r r r �__len__ s zTrie.__len__c C s t | j�S r )�iterr r! r r r �__iter__ s z Trie.__iter__c C s | j | S r r r r r r �__getitem__ s zTrie.__getitem__Nc C s� |d ks|dks| j s t| j �S |�| j�rL| j\}}t| j |||� }}nt| j |� }}t� }|t| j �krt|S | j | �|�r�|�| j | � |d7 }qt|| _||f| _|S )Nr r )r �set� startswithr r r r �add)r �prefix�lo�hi�start�ir r r r r s z Trie.keysc C sd || j krdS |�| j�r6| j\}}t| j|||�}nt| j|�}|t| j�krTdS | j| �|�S )NTF)r r'