



from __future__ import annotations
def 	_lowercase	(     UpperCAmelCase_						,   UpperCAmelCase_):




 """simple docstring"""




 snake_case__				:							str      							= set(__lowerCamelCase), [start]

 while stack:
  snake_case__				:							str      							= stack.pop()
  explored.add(__lowerCamelCase)
  # Differences from BFS:
  # 1) pop last element instead of first one
  # 2) add adjacent elements to stack without exploring them
  for adj in reversed(graph[v]):
   if adj not in explored:
    stack.append(__lowerCamelCase)
 return explored


lowercase_:  Optional[int]     						=					{
    'A': ['B', 'C', 'D'],
    'B': ['A', 'D', 'E'],
    'C': ['A', 'F'],
    'D': ['B', 'D'],
    'E': ['B', 'F'],
    'F': ['C', 'E', 'G'],
    'G': ['F'],
}

if __name__ == "__main__":
 import doctest

 doctest.testmod()
 print(depth_first_search(G, 'A'))








'''simple docstring'''






import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible






class    __magic_name__				(						unittest.TestCase							):






       def      lowerCAmelCase						(     self)		->    Union[str, Any]:




          '''simple docstring'''
          _UpperCAmelCase  :  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(snake_case))






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




          '''simple docstring'''
          _UpperCAmelCase  :  Optional[int]				       =[
              'unet/diffusion_pytorch_model.bin',
              'unet/diffusion_pytorch_model.safetensors',
          ]
          self.assertTrue(is_safetensors_compatible(snake_case))






       def      lowerCAmelCase						(     self)		->    Any:




          '''simple docstring'''
          _UpperCAmelCase  :  Union[str, 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',
              # Removed: 'unet/diffusion_pytorch_model.safetensors',
          ]
          self.assertFalse(is_safetensors_compatible(snake_case))






       def      lowerCAmelCase						(     self)		->    Dict:




          '''simple docstring'''
          _UpperCAmelCase  :  int				       =[
              'text_encoder/pytorch_model.bin',
              'text_encoder/model.safetensors',
          ]
          self.assertTrue(is_safetensors_compatible(snake_case))






       def      lowerCAmelCase						(     self)		->    Any:




          '''simple docstring'''
          _UpperCAmelCase  :  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',
              # Removed: 'text_encoder/model.safetensors',
              'unet/diffusion_pytorch_model.bin',
              'unet/diffusion_pytorch_model.safetensors',
          ]
          self.assertFalse(is_safetensors_compatible(snake_case))






       def      lowerCAmelCase						(     self)		->    List[Any]:




          '''simple docstring'''
          _UpperCAmelCase  :  Union[str, Any]				       =[
              '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',
          ]
          _UpperCAmelCase  :  str				       ='fp16'
          self.assertTrue(is_safetensors_compatible(snake_case    ,				variant=snake_case))






       def      lowerCAmelCase						(     self)		->    Union[str, Any]:




          '''simple docstring'''
          _UpperCAmelCase  :  Tuple				       =[
              'unet/diffusion_pytorch_model.fp16.bin',
              'unet/diffusion_pytorch_model.fp16.safetensors',
          ]
          _UpperCAmelCase  :  int				       ='fp16'
          self.assertTrue(is_safetensors_compatible(snake_case    ,				variant=snake_case))






       def      lowerCAmelCase						(     self)		->    Optional[int]:




          '''simple docstring'''
          # pass variant but use the non-variant filenames
          _UpperCAmelCase  :  Optional[int]				       =[
              'unet/diffusion_pytorch_model.bin',
              'unet/diffusion_pytorch_model.safetensors',
          ]
          _UpperCAmelCase  :  Optional[Any]				       ='fp16'
          self.assertTrue(is_safetensors_compatible(snake_case    ,				variant=snake_case))






       def      lowerCAmelCase						(     self)		->    int:




          '''simple docstring'''
          _UpperCAmelCase  :  str				       =[
              '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',
          ]
          _UpperCAmelCase  :  List[str]				       ='fp16'
          self.assertFalse(is_safetensors_compatible(snake_case    ,				variant=snake_case))






       def      lowerCAmelCase						(     self)		->    Union[str, Any]:




          '''simple docstring'''
          _UpperCAmelCase  :  Dict				       =[
              'text_encoder/pytorch_model.fp16.bin',
              'text_encoder/model.fp16.safetensors',
          ]
          _UpperCAmelCase  :  Optional[Any]				       ='fp16'
          self.assertTrue(is_safetensors_compatible(snake_case    ,				variant=snake_case))






       def      lowerCAmelCase						(     self)		->    Any:




          '''simple docstring'''
          # pass variant but use the non-variant filenames
          _UpperCAmelCase  :  Optional[int]				       =[
              'text_encoder/pytorch_model.bin',
              'text_encoder/model.safetensors',
          ]
          _UpperCAmelCase  :  List[Any]				       ='fp16'
          self.assertTrue(is_safetensors_compatible(snake_case    ,				variant=snake_case))






       def      lowerCAmelCase						(     self)		->    Union[str, Any]:




          '''simple docstring'''
          _UpperCAmelCase  :  str				       =[
              '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',
          ]
          _UpperCAmelCase  :  Tuple				       ='fp16'
          self.assertFalse(is_safetensors_compatible(snake_case    ,				variant=snake_case))

