






from unittest import TestCase

from datasets import Dataset
from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters

def   _lowerCamelCase						(    )   ->       List[Any]:
    _UpperCAmelCase					:   str      	=					{
        '''repo_name''': ['''test_repo1''', '''test_repo2''', '''test_repo3'''],
        '''path''': ['''test_1.py''', '''test_2.py''', '''unit_test.py'''],
        '''content''': ['''a ''' * 20, '''a ''' * 30, '''b ''' * 7],
    }
    _UpperCAmelCase					:   str      	=					Dataset.from_dict(_UpperCamelCase			)
    return dataset


class 				A_     (    SCREAMING_SNAKE_CASE__      ):






 '''simple docstring'''




 def 			snake_case__					(						self)			->		Optional[Any]:

     """simple docstring"""



     _UpperCAmelCase					:   List[str]      	=					get_dataset()
     _UpperCAmelCase					:   str      	=					make_duplicate_clusters(A_				,	0.85)
     self.assertEqual(len(duplicate_clusters[0])				,	2)


 def 			snake_case__					(						self)			->		List[str]:

     """simple docstring"""



     _UpperCAmelCase					:   Optional[int]      	=					get_dataset()
     _UpperCAmelCase					:   str      	=					deduplicate_dataset(A_)
     self.assertEqual(len(A_)				,	2)
     print(A_)
     self.assertEqual(duplicate_clusters[0][0]['''copies''']				,	2)
     self.assertEqual(duplicate_clusters[0][0]['''is_extreme''']				,	A_)






"""simple docstring"""




from collections.abc import Callable




def 			_lowerCAmelCase		(		_UpperCamelCase			,					_UpperCamelCase			,					_UpperCamelCase    ):






  """simple docstring"""



  _lowercase:      float   			=  a
  _lowercase:      float   			=  b
  if function(_UpperCamelCase    ) == 0:  # one of the a or b is a root for the function
    return a
  elif function(_UpperCamelCase    ) == 0:
    return b
  elif (
      function(_UpperCamelCase    ) * function(_UpperCamelCase    ) > 0
  ):  # if none of these are root and they are both positive or negative,
    # then this algorithm can't find the root
    raise ValueError('''could not find root in given interval.'''    )
  else:
    _lowercase:      float   			=  start + (end - start) / 2.0
    while abs(start - mid    ) > 10**-7:  # until precisely equals to 10^-7
      if function(_UpperCamelCase    ) == 0:
        return mid
      elif function(_UpperCamelCase    ) * function(_UpperCamelCase    ) < 0:
        _lowercase:      Union[str, Any]   			=  mid
      else:
        _lowercase:      Any   			=  mid
      _lowercase:      List[Any]   			=  start + (end - start) / 2.0
    return mid




def 			_lowerCAmelCase		(		_UpperCamelCase    ):






  """simple docstring"""



  return x**3 - 2 * x - 5


if __name__ == "__main__":
  print(bisection(f, 1, 1_0_0_0))

  import doctest

  doctest.testmod()
