





import math
from timeit import timeit





def     lowerCamelCase__  (  UpperCamelCase__      :							int    )      ->			int:



					'''simple docstring'''




					_snake_case						=					0
					_snake_case						=					abs(UpperCamelCase__    )
					while True:
										_snake_case						=					n // 10
										digits += 1
										if n == 0:
															break
					return digits





def     lowerCamelCase__  (  UpperCamelCase__      :							int    )      ->			int:



					'''simple docstring'''




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





def     lowerCamelCase__  (  UpperCamelCase__      :							int    )      ->			int:



					'''simple docstring'''




					return len(str(abs(UpperCamelCase__    )    )    )





def     lowerCamelCase__  (  )      ->			None:



					'''simple docstring'''




					from collections.abc import Callable

					def benchmark_a_function(UpperCamelCase__      :							Callable							,     UpperCamelCase__      :							int    ) -> None:
										_snake_case						=					F'''{func.__name__}({value})'''
										_snake_case						=					timeit(F'''__main__.{call}'''							,     setup='import __main__'    )
										print(F'''{call}: {func(UpperCamelCase__    )} -- {timing} seconds'''    )

					for value in (262_144, 1_125_899_906_842_624, 1_267_650_600_228_229_401_496_703_205_376):
										for func in (num_digits, num_digits_fast, num_digits_faster):
															benchmark_a_function(UpperCamelCase__							,     UpperCamelCase__    )
										print()


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					benchmark()










import unittest

from transformers import is_torch_available, load_tool

from .test_tools_common import ToolTesterMixin


if is_torch_available():
					import torch
class       UpperCamelCase_		(	unittest.TestCase				,	_lowerCamelCase       ):




					def 						lowerCAmelCase      (		self	)		->				str:
										_snake_case						=					load_tool('speech-to-text'	)
										self.tool.setup()




					def 						lowerCAmelCase      (		self	)		->				Optional[Any]:
										_snake_case						=					self.tool(torch.ones(3000	)	)
										self.assertEqual(lowerCAmelCase_					,    ' you'	)






					def 						lowerCAmelCase      (		self	)		->				Optional[int]:
										_snake_case						=					self.tool(audio=torch.ones(3000	)	)
										self.assertEqual(lowerCAmelCase_					,    ' you'	)



