





'''simple docstring'''

import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible






class    UpperCAmelCase	(       unittest.TestCase				):
 def      UpperCAmelCase_							(				self      :List[Any]							)->							Optional[int]:
     A__				=			[
         "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(lowercase_							)							)
 def      UpperCAmelCase_							(				self      :Tuple							)->							Optional[int]:
     A__				=			[
         "unet/diffusion_pytorch_model.bin",
         "unet/diffusion_pytorch_model.safetensors",
     ]
     self.assertTrue(is_safetensors_compatible(lowercase_							)							)
 def      UpperCAmelCase_							(				self      :Optional[Any]							)->							Any:
     A__				=			[
         "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(lowercase_							)							)
 def      UpperCAmelCase_							(				self      :Dict							)->							Dict:
     A__				=			[
         "text_encoder/pytorch_model.bin",
         "text_encoder/model.safetensors",
     ]
     self.assertTrue(is_safetensors_compatible(lowercase_							)							)
 def      UpperCAmelCase_							(				self      :List[str]							)->							Optional[int]:
     A__				=			[
         "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(lowercase_							)							)
 def      UpperCAmelCase_							(				self      :int							)->							Dict:
     A__				=			[
         "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",
     ]
     A__				=			"fp16"
     self.assertTrue(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)
 def      UpperCAmelCase_							(				self      :Tuple							)->							Any:
     A__				=			[
         "unet/diffusion_pytorch_model.fp16.bin",
         "unet/diffusion_pytorch_model.fp16.safetensors",
     ]
     A__				=			"fp16"
     self.assertTrue(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)
 def      UpperCAmelCase_							(				self      :str							)->							str:
     # pass variant but use the non-variant filenames
     A__				=			[
         "unet/diffusion_pytorch_model.bin",
         "unet/diffusion_pytorch_model.safetensors",
     ]
     A__				=			"fp16"
     self.assertTrue(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)
 def      UpperCAmelCase_							(				self      :List[str]							)->							List[str]:
     A__				=			[
         "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',
     ]
     A__				=			"fp16"
     self.assertFalse(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)
 def      UpperCAmelCase_							(				self      :int							)->							List[str]:
     A__				=			[
         "text_encoder/pytorch_model.fp16.bin",
         "text_encoder/model.fp16.safetensors",
     ]
     A__				=			"fp16"
     self.assertTrue(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)
 def      UpperCAmelCase_							(				self      :str							)->							Any:
     # pass variant but use the non-variant filenames
     A__				=			[
         "text_encoder/pytorch_model.bin",
         "text_encoder/model.safetensors",
     ]
     A__				=			"fp16"
     self.assertTrue(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)



 def      UpperCAmelCase_							(				self      :Dict							)->							List[Any]:
     A__				=			[
         "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",
     ]
     A__				=			"fp16"
     self.assertFalse(is_safetensors_compatible(lowercase_						,       variant=lowercase_							)							)










'''simple docstring'''

import functools





def 						UpperCamelCase				(							_lowerCamelCase					:					str						,       _lowerCamelCase					:					str       ):
    A__				=			len(_lowerCamelCase       )
    A__				=			len(_lowerCamelCase       )

    @functools.cache
    def min_distance(_lowerCamelCase					:					int						,       _lowerCamelCase					:					int       ) -> int:
        # if first word index is overflow - delete all from the second word
        if indexa >= len_worda:
            return len_worda - indexa
        # if second word index is overflow - delete all from the first word
        if indexa >= len_worda:
            return len_worda - indexa
        A__				=			int(worda[indexa] != worda[indexa]       )  # current letters not identical
        return min(
            1 + min_distance(indexa + 1						,       _lowerCamelCase       )						,       1 + min_distance(_lowerCamelCase						,       indexa + 1       )						,       diff + min_distance(indexa + 1						,       indexa + 1       )						,       )

    return min_distance(0						,       0       )


if __name__ == "__main__":
  import doctest

  doctest.testmod()



