docstr: Add a key to _index (MinHashLSH)
  the min_hash is used to query closest matches based on the jaccard_threshold.
  The new key is either added to a existing cluster of one close match,
  or a new cluster is created. The clusters created in this way, depend on the order of add.
  
  Args:
      code_key (Tuple of (index, repo_name, path)):
          Theoritically any hasbale key. Here we use a tuple to retrieve the information later.
      min_hash: MinHash of the code_key.
docstr_tok: ["Add","a","key","to","_index","(","MinHashLSH",")","the","min_hash","is","used","to","query","closest","matches","based","on","the","jaccard_threshold",".","The","new","key","is","either","added","to","a","existing","cluster","of","one","close","match",",","or","a","new","cluster","is","created",".","The","clusters","created","in","this","way",",","depend","on","the","order","of","add",".","Args",":","code_key","(","Tuple","of","(","index",",","repo_name",",","path",")",")",":","Theoritically","any","hasbale","key",".","Here","we","use","a","tuple","to","retrieve","the","information","later",".","min_hash",":","MinHash","of","the","code_key","."]
code: def add(self, code_key: Tuple, min_hash: MinHash) -> None:
      """Add a key to _index (MinHashLSH)
      the min_hash is used to query closest matches based on the jaccard_threshold.
      The new key is either added to a existing cluster of one close match,
      or a new cluster is created. The clusters created in this way, depend on the order of add.
  
      Args:
          code_key (Tuple of (index, repo_name, path)):
              Theoritically any hasbale key. Here we use a tuple to retrieve the information later.
          min_hash: MinHash of the code_key.
      """
      close_duplicates = self._index.query(min_hash)
      if code_key in self._index.keys:
          print(f"Duplicate key {code_key}")
          return
  
      self._index.insert(code_key, min_hash)
      if len(close_duplicates) > 0:
          for base_duplicate in close_duplicates:
              if base_duplicate in self._duplicate_clusters:
                  self._duplicate_clusters[base_duplicate].add(code_key)
                  break
          else:
              self._duplicate_clusters[close_duplicates[0]].add(
                  code_key
              )
  
imports: import json
  import multiprocessing
  import re
  from collections import defaultdict
  from functools import partial
  from typing import Dict, List, Optional, Set, Tuple, Type
  from datasets import Dataset
  from tqdm import tqdm
  from datasketch import MinHash, MinHashLSH
  from dpu_utils.utils.iterators import ThreadedIterator
label_desc: Use image node_id 2 for calling the DuplicationIndex obj's underlying member method code with example usage: obj.add(code_key, min_hash) without return types