'''simple docstring'''





def 			A__      (	snake_case_ :		int      ):
 SCREAMING_SNAKE_CASE__:   Optional[int]=      abs(snake_case_      )
 SCREAMING_SNAKE_CASE__:   Optional[Any]=      0
 while n > 0:
  res += n % 10
  n //= 10
 return res







def 			A__      (	snake_case_ :		int      ):
 SCREAMING_SNAKE_CASE__:   List[Any]=      abs(snake_case_      )
 return n if n < 10 else n % 10 + sum_of_digits(n // 10      )







def 			A__      (	snake_case_ :		int      ):
 return sum(int(snake_case_      ) for c in str(abs(snake_case_      )      )      )







def 			A__      (	):
 from collections.abc import Callable
 from timeit import timeit

 def benchmark_a_function(snake_case_ :		Callable       ,				snake_case_ :		int      ) -> None:
  SCREAMING_SNAKE_CASE__:   Tuple=      F'{func.__name__}({value})'
  SCREAMING_SNAKE_CASE__:   Tuple=      timeit(F'__main__.{call}'       ,				setup='''import __main__'''      )
  print(F'{call:56} = {func(snake_case_      )} -- {timing:.4f} 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 (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
   benchmark_a_function(snake_case_       ,				snake_case_      )
  print()


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      benchmark()


import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible






class 		_lowerCamelCase		(   unittest.TestCase    ):
    def 						UpperCamelCase_				(  self   )       ->					str:
     SCREAMING_SNAKE_CASE__:   List[Any]=      [
         '''safety_checker/pytorch_model.bin''',
         '''safety_checker/model.safetensors''',
         '''vae/diffusion_pytorch_model.bin''',
         '''vae/diffusion_pytorch_model.safetensors''',
         '''text_encoder/pytorch_model.bin''',
         '''text_encoder/model.safetensors''',
         '''unet/diffusion_pytorch_model.bin''',
         '''unet/diffusion_pytorch_model.safetensors''',
     ]
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					int:
     SCREAMING_SNAKE_CASE__:   List[str]=      [
         '''unet/diffusion_pytorch_model.bin''',
         '''unet/diffusion_pytorch_model.safetensors''',
     ]
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					Tuple:
     SCREAMING_SNAKE_CASE__:   Optional[int]=      [
         '''safety_checker/pytorch_model.bin''',
         '''safety_checker/model.safetensors''',
         '''vae/diffusion_pytorch_model.bin''',
         '''vae/diffusion_pytorch_model.safetensors''',
         '''text_encoder/pytorch_model.bin''',
         '''text_encoder/model.safetensors''',
         '''unet/diffusion_pytorch_model.bin''',
         # Removed: 'unet/diffusion_pytorch_model.safetensors',
     ]
     self.assertFalse(is_safetensors_compatible(lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					Dict:
     SCREAMING_SNAKE_CASE__:   str=      [
         '''text_encoder/pytorch_model.bin''',
         '''text_encoder/model.safetensors''',
     ]
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					str:
     SCREAMING_SNAKE_CASE__:   List[str]=      [
         '''safety_checker/pytorch_model.bin''',
         '''safety_checker/model.safetensors''',
         '''vae/diffusion_pytorch_model.bin''',
         '''vae/diffusion_pytorch_model.safetensors''',
         '''text_encoder/pytorch_model.bin''',
         # Removed: 'text_encoder/model.safetensors',
         '''unet/diffusion_pytorch_model.bin''',
         '''unet/diffusion_pytorch_model.safetensors''',
     ]
     self.assertFalse(is_safetensors_compatible(lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					List[str]:
     SCREAMING_SNAKE_CASE__:   Optional[int]=      [
         '''safety_checker/pytorch_model.fp16.bin''',
         '''safety_checker/model.fp16.safetensors''',
         '''vae/diffusion_pytorch_model.fp16.bin''',
         '''vae/diffusion_pytorch_model.fp16.safetensors''',
         '''text_encoder/pytorch_model.fp16.bin''',
         '''text_encoder/model.fp16.safetensors''',
         '''unet/diffusion_pytorch_model.fp16.bin''',
         '''unet/diffusion_pytorch_model.fp16.safetensors''',
     ]
     SCREAMING_SNAKE_CASE__:   Any=      '''fp16'''
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					Any:
     SCREAMING_SNAKE_CASE__:   List[str]=      [
         '''unet/diffusion_pytorch_model.fp16.bin''',
         '''unet/diffusion_pytorch_model.fp16.safetensors''',
     ]
     SCREAMING_SNAKE_CASE__:   Dict=      '''fp16'''
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					Dict:
     # pass variant but use the non-variant filenames
     SCREAMING_SNAKE_CASE__:   List[str]=      [
         '''unet/diffusion_pytorch_model.bin''',
         '''unet/diffusion_pytorch_model.safetensors''',
     ]
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      '''fp16'''
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					List[Any]:
     SCREAMING_SNAKE_CASE__:   Dict=      [
         '''safety_checker/pytorch_model.fp16.bin''',
         '''safety_checker/model.fp16.safetensors''',
         '''vae/diffusion_pytorch_model.fp16.bin''',
         '''vae/diffusion_pytorch_model.fp16.safetensors''',
         '''text_encoder/pytorch_model.fp16.bin''',
         '''text_encoder/model.fp16.safetensors''',
         '''unet/diffusion_pytorch_model.fp16.bin''',
         # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
     ]
     SCREAMING_SNAKE_CASE__:   List[Any]=      '''fp16'''
     self.assertFalse(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					List[str]:
     SCREAMING_SNAKE_CASE__:   int=      [
         '''text_encoder/pytorch_model.fp16.bin''',
         '''text_encoder/model.fp16.safetensors''',
     ]
     SCREAMING_SNAKE_CASE__:   Any=      '''fp16'''
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self   )       ->					Optional[Any]:
     # pass variant but use the non-variant filenames
     SCREAMING_SNAKE_CASE__:   Optional[int]=      [
         '''text_encoder/pytorch_model.bin''',
         '''text_encoder/model.safetensors''',
     ]
     SCREAMING_SNAKE_CASE__:   str=      '''fp16'''
     self.assertTrue(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )



    def 						UpperCamelCase_				(  self   )       ->					Union[str, Any]:
     SCREAMING_SNAKE_CASE__:   Tuple=      [
         '''safety_checker/pytorch_model.fp16.bin''',
         '''safety_checker/model.fp16.safetensors''',
         '''vae/diffusion_pytorch_model.fp16.bin''',
         '''vae/diffusion_pytorch_model.fp16.safetensors''',
         '''text_encoder/pytorch_model.fp16.bin''',
         # 'text_encoder/model.fp16.safetensors',
         '''unet/diffusion_pytorch_model.fp16.bin''',
         '''unet/diffusion_pytorch_model.fp16.safetensors''',
     ]
     SCREAMING_SNAKE_CASE__:   str=      '''fp16'''
     self.assertFalse(is_safetensors_compatible(lowerCAmelCase , variant=lowerCAmelCase   )   )

