




'''simple docstring'''






import pytest

from datasets.utils.version import Version




@pytest.mark.parametrize(
    '''other, expected_equality'''   ,				[
        (Version('''1.0.0'''      ), True),
        ('''1.0.0''', True),
        (Version('''2.0.0'''      ), False),
        ('''2.0.0''', False),
        ('''1''', False),
        ('''a''', False),
        (1, False),
        (None, False),
    ]   ,				)
def 		a_( lowerCamelCase   ,				lowerCamelCase      )				->Tuple:






       '''simple docstring'''




       lowercase  :		str						=      Version('''1.0.0'''      )
       assert (version == other) is expected_equality
       assert (version != other) is not expected_equality
       assert (hash(lowerCamelCase      ) == hash(lowerCamelCase      )) is expected_equality










'''simple docstring'''






import math
from timeit import timeit




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       lowercase  :		Dict						=      0
       lowercase  :		Union[str, Any]						=      abs(lowerCamelCase      )
       while True:
              lowercase  :		List[Any]						=      n // 10
              digits += 1
              if n == 0:
                     break
       return digits




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       return 1 if n == 0 else math.floor(math.log(abs(lowerCamelCase      )   ,				10      ) + 1      )




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       return len(str(abs(lowerCamelCase      )      )      )




def 		a_( )				->None:






       '''simple docstring'''




       from collections.abc import Callable

       def benchmark_a_function(lowerCamelCase   ,				lowerCamelCase      ) -> None:
              lowercase  :		str						=      f"""{func.__name__}({value})"""
              lowercase  :		Optional[Any]						=      timeit(f"""__main__.{call}"""   ,				setup='''import __main__'''      )
              print(f"""{call}: {func(lowerCamelCase      )} -- {timing} seconds"""      )

       for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
              for func in (num_digits, num_digits_fast, num_digits_faster):
                     benchmark_a_function(lowerCamelCase   ,				lowerCamelCase      )
              print()


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      benchmark()




