U
    “öhŸ  ã                   @  s<   d Z ddlmZ ddlmZ ddlmZ dddœdd	„Zd
S )zFunction for de-duping results.é    )Úannotations)ÚSequence)Úllmfn_output_rowz-Sequence[llmfn_output_row.LLMFnOutputRowView]zSequence[int])ÚrowsÚreturnc                 C  sF   g }t ƒ }t| ƒD ].\}}| ¡ }||kr,q| |¡ | |¡ q|S )aW  Returns a list of indices with duplicates removed.

  E.g. if rows has results ["hello", "hello", "world"], the return value would
  be [0, 2], indicating that the results at index 1 is a duplicate and should be
  removed.

  Args:
    rows: The input rows

  Returns:
    A sequence of indices indicating which entries have unique results.
  )ÚsetÚ	enumerateZresult_valueÚaddÚappend)r   ÚindicesZseen_entriesÚidxÚrowÚvalue© r   úN/tmp/pip-unpacked-wheel-doshhd5e/google/generativeai/notebook/lib/unique_fn.pyÚ	unique_fn   s    
r   N)Ú__doc__Ú
__future__r   Útypingr   Z google.generativeai.notebook.libr   r   r   r   r   r   Ú<module>   s   