o
    hq	                     @   s   d Z dgZG dd deZdS )zMisc dict tools.hashdictc                   @   sh   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )r   a<  
    hashable dict implementation, suitable for use as a key into
    other dicts.

        >>> h1 = hashdict({"apples": 1, "bananas":2})
        >>> h2 = hashdict({"bananas": 3, "mangoes": 5})
        >>> h1+h2
        hashdict(apples=1, bananas=3, mangoes=5)
        >>> d1 = {}
        >>> d1[h1] = "salad"
        >>> d1[h1]
        'salad'
        >>> d1[h2]
        Traceback (most recent call last):
        ...
        KeyError: hashdict(bananas=3, mangoes=5)

    based on answers from
       http://stackoverflow.com/questions/1151658/python-hashable-dicts

    c                 C   s   t t|  S N)tuplesorteditemsself r   l/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/fontTools/misc/dictTools.py__key   s   zhashdict.__keyc                 C   s$   d | jjddd |  D S )Nz{0}({1})z, c                 s   s,    | ]}d  t|d t|d V  qdS )z{0}={1}       N)formatstrrepr).0ir   r   r	   	<genexpr>$   s   * z$hashdict.__repr__.<locals>.<genexpr>)r   	__class____name__join_hashdict__keyr   r   r   r	   __repr__!   s   zhashdict.__repr__c                 C   s   t |  S r   )hashr   r   r   r   r	   __hash__'   s   zhashdict.__hash__c                 C      t d| jjNz${0} does not support item assignment	TypeErrorr   r   r   )r   keyvaluer   r   r	   __setitem__*      zhashdict.__setitem__c                 C   r   r   r   )r   r   r   r   r	   __delitem__/   r!   zhashdict.__delitem__c                 C   r   r   r   r   r   r   r	   clear4   r!   zhashdict.clearc                 O   r   r   r   r   argskwargsr   r   r	   pop9   r!   zhashdict.popc                 O   r   r   r   r$   r   r   r	   popitem>   r!   zhashdict.popitemc                 O   r   r   r   r$   r   r   r	   
setdefaultC   r!   zhashdict.setdefaultc                 O   r   r   r   r$   r   r   r	   updateH   r!   zhashdict.updatec                 C   s   t | }t|| |S r   )r   dictr*   )r   rightresultr   r   r	   __add__P   s   zhashdict.__add__N)r   
__module____qualname____doc__r   r   r   r    r"   r#   r'   r(   r)   r*   r.   r   r   r   r	   r      s    N)r1   __all__r+   r   r   r   r   r	   <module>   s    