a
    ΝGd                     @   s&   d dl Z e e fddZdd ZdS )    Nc                 C   s   | du r|S | du r|S | S )zH
    A hack to make True and 1 and False and 0 unique for ``uniq``.
    TF )elementtruefalser   r   L/var/www/html/django/DPS/env/lib/python3.9/site-packages/coreschema/utils.pyunbool   s
    r   c                 C   s   z t tdd | D t | kW S  ty   zJtdd | D }t|dd}t||D ]\}}||krZ W Y dS qZW nH ttfy   g }| D ](}t|}||v r Y Y dS |	| qY n0 Y n0 dS )z
    Check if all of a container's elements are unique.
    Successively tries first to rely that the elements are hashable, then
    falls back on them being sortable, and finally falls back on brute
    force.
    c                 s   s   | ]}t |V  qd S Nr   .0ir   r   r   	<genexpr>0       zuniq.<locals>.<genexpr>c                 s   s   | ]}t |V  qd S r   r	   r
   r   r   r   r   3   r      NFT)
lenset	TypeErrorsorted	itertoolsislicezipNotImplementedErrorr   append)	containersortZslicedr   jseener   r   r   uniq'   s"     
r   )r   objectr   r   r   r   r   r   <module>   s   