





"""simple docstring"""


import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible



class      __SCREAMING_SNAKE_CASE    (						unittest.TestCase   ):







  '''simple docstring'''


  def    __SCREAMING_SNAKE_CASE				(		self   :       Any	)		->				Optional[int]:
        _UpperCamelCase      :	Optional[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(__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Tuple	)		->				str:
        _UpperCamelCase      :	Any						=       [
            "unet/diffusion_pytorch_model.bin",
            "unet/diffusion_pytorch_model.safetensors",
        ]
        self.assertTrue(is_safetensors_compatible(__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				int:
        _UpperCamelCase      :	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(__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				List[str]:
        _UpperCamelCase      :	Any						=       [
            "text_encoder/pytorch_model.bin",
            "text_encoder/model.safetensors",
        ]
        self.assertTrue(is_safetensors_compatible(__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				int:
        _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(__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Any	)		->				Union[str, Any]:
        _UpperCamelCase      :	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      :	Optional[int]						=       "fp16"
        self.assertTrue(is_safetensors_compatible(__a					,   variant=__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Any	)		->				Any:
        _UpperCamelCase      :	Optional[Any]						=       [
            "unet/diffusion_pytorch_model.fp16.bin",
            "unet/diffusion_pytorch_model.fp16.safetensors",
        ]
        _UpperCamelCase      :	List[Any]						=       "fp16"
        self.assertTrue(is_safetensors_compatible(__a					,   variant=__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Union[str, Any]:
        # pass variant but use the non-variant filenames
        _UpperCamelCase      :	int						=       [
            "unet/diffusion_pytorch_model.bin",
            "unet/diffusion_pytorch_model.safetensors",
        ]
        _UpperCamelCase      :	int						=       "fp16"
        self.assertTrue(is_safetensors_compatible(__a					,   variant=__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]	)		->				Union[str, Any]:
        _UpperCamelCase      :	Optional[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",
            # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
        ]
        _UpperCamelCase      :	Tuple						=       "fp16"
        self.assertFalse(is_safetensors_compatible(__a					,   variant=__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]	)		->				Union[str, Any]:
        _UpperCamelCase      :	int						=       [
            "text_encoder/pytorch_model.fp16.bin",
            "text_encoder/model.fp16.safetensors",
        ]
        _UpperCamelCase      :	int						=       "fp16"
        self.assertTrue(is_safetensors_compatible(__a					,   variant=__a	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				int:
        # pass variant but use the non-variant filenames
        _UpperCamelCase      :	Optional[int]						=       [
            "text_encoder/pytorch_model.bin",
            "text_encoder/model.safetensors",
        ]
        _UpperCamelCase      :	Tuple						=       "fp16"
        self.assertTrue(is_safetensors_compatible(__a					,   variant=__a	)	)


  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]	)		->				Optional[Any]:
        _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      :	Optional[int]						=       "fp16"
        self.assertFalse(is_safetensors_compatible(__a					,   variant=__a	)	)







"""simple docstring"""


def 					lowercase__    (					lowercase_			)					->		set:




      """simple docstring"""

      _UpperCamelCase      :	Union[str, Any]						=       set()
      # edges = list of graph's edges
      _UpperCamelCase      :	Union[str, Any]						=       get_edges(lowercase_			)

      # While there are still elements in edges list, take an arbitrary edge
      # (from_node, to_node) and add his extremity to chosen_vertices and then
      # remove all arcs adjacent to the from_node and to_node
      while edges:
            _UpperCamelCase,  _UpperCamelCase      :	str						=       edges.pop()
            chosen_vertices.add(lowercase_			)
            chosen_vertices.add(lowercase_			)
            for edge in edges.copy():
                  if from_node in edge or to_node in edge:
                        edges.discard(lowercase_			)
      return chosen_vertices




def 					lowercase__    (					lowercase_			)					->		set:




      """simple docstring"""

      _UpperCamelCase      :	List[str]						=       set()
      for from_node, to_nodes in graph.items():
            for to_node in to_nodes:
                  edges.add((from_node, to_node)			)
      return edges


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  # graph = {0: [1, 3], 1: [0, 3], 2: [0, 3, 4], 3: [0, 1, 2], 4: [2, 3]}
  # print(f"Matching vertex cover:\n{matching_min_vertex_cover(graph)}")
