
"""simple docstring"""





import os
import sys
import unittest


__magic_name__       =			os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, "utils"))

import check_dummies  # noqa: E402
from check_dummies import create_dummy_files, create_dummy_object, find_backend, read_init  # noqa: E402


# Align TRANSFORMERS_PATH in check_dummies with the current path
__magic_name__       =			os.path.join(git_repo_path, "src", "diffusers")
class 						SCREAMING_SNAKE_CASE_ (						unittest.TestCase ):




		"""simple docstring"""





		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = find_backend("""    if not is_torch_available():""")
				self.assertEqual(lowerCAmelCase__							,  """torch""")

				# backend_with_underscore = find_backend("    if not is_tensorflow_text_available():")
				# self.assertEqual(backend_with_underscore, "tensorflow_text")

				__SCREAMING_SNAKE_CASE            = find_backend("""    if not (is_torch_available() and is_transformers_available()):""")
				self.assertEqual(lowerCAmelCase__							,  """torch_and_transformers""")

				# double_backend_with_underscore = find_backend(
				#    "    if not (is_sentencepiece_available() and is_tensorflow_text_available()):"
				# )
				# self.assertEqual(double_backend_with_underscore, "sentencepiece_and_tensorflow_text")

				__SCREAMING_SNAKE_CASE            = find_backend(
				    """    if not (is_torch_available() and is_transformers_available() and is_onnx_available()):""")
				self.assertEqual(lowerCAmelCase__							,  """torch_and_transformers_and_onnx""")




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = read_init()
				# We don't assert on the exact list of keys to allow for smooth grow of backend-specific objects
				self.assertIn("""torch"""							,  lowerCAmelCase__)
				self.assertIn("""torch_and_transformers"""							,  lowerCAmelCase__)
				self.assertIn("""flax_and_transformers"""							,  lowerCAmelCase__)
				self.assertIn("""torch_and_transformers_and_onnx"""							,  lowerCAmelCase__)

				# Likewise, we can't assert on the exact content of a key
				self.assertIn("""UNet2DModel"""							,  objects["""torch"""])
				self.assertIn("""FlaxUNet2DConditionModel"""							,  objects["""flax"""])
				self.assertIn("""StableDiffusionPipeline"""							,  objects["""torch_and_transformers"""])
				self.assertIn("""FlaxStableDiffusionPipeline"""							,  objects["""flax_and_transformers"""])
				self.assertIn("""LMSDiscreteScheduler"""							,  objects["""torch_and_scipy"""])
				self.assertIn("""OnnxStableDiffusionPipeline"""							,  objects["""torch_and_transformers_and_onnx"""])




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = create_dummy_object("""CONSTANT"""							,  """'torch'""")
				self.assertEqual(lowerCAmelCase__							,  """\nCONSTANT = None\n""")

				__SCREAMING_SNAKE_CASE            = create_dummy_object("""function"""							,  """'torch'""")
				self.assertEqual(
				    lowerCAmelCase__							,  """\ndef function(*args, **kwargs):\n    requires_backends(function, 'torch')\n""")

				__SCREAMING_SNAKE_CASE            = """
class FakeClass(metaclass=DummyObject):
    _backends = 'torch'

    def __init__(self, *args, **kwargs):
        requires_backends(self, 'torch')

    @classmethod
    def from_config(cls, *args, **kwargs):
        requires_backends(cls, 'torch')

    @classmethod
    def from_pretrained(cls, *args, **kwargs):
        requires_backends(cls, 'torch')
"""
				__SCREAMING_SNAKE_CASE            = create_dummy_object("""FakeClass"""							,  """'torch'""")
				self.assertEqual(lowerCAmelCase__							,  lowerCAmelCase__)




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = """# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends


CONSTANT = None


def function(*args, **kwargs):
    requires_backends(function, [\"torch\"])


class FakeClass(metaclass=DummyObject):
    _backends = [\"torch\"]

    def __init__(self, *args, **kwargs):
        requires_backends(self, [\"torch\"])

    @classmethod
    def from_config(cls, *args, **kwargs):
        requires_backends(cls, [\"torch\"])

    @classmethod
    def from_pretrained(cls, *args, **kwargs):
        requires_backends(cls, [\"torch\"])
"""
				__SCREAMING_SNAKE_CASE            = create_dummy_files({"""torch""": ["""CONSTANT""", """function""", """FakeClass"""]})
				self.assertEqual(dummy_files["""torch"""]							,  lowerCAmelCase__)






"""simple docstring"""





from collections import defaultdict



def 						_lowerCAmelCase				(				UpperCamelCase_  ,				UpperCamelCase_				):
		__SCREAMING_SNAKE_CASE            = first_str.lower().strip()
		__SCREAMING_SNAKE_CASE            = second_str.lower().strip()

		# Remove whitespace
		__SCREAMING_SNAKE_CASE            = first_str.replace(""" """  ,				""""""				)
		__SCREAMING_SNAKE_CASE            = second_str.replace(""" """  ,				""""""				)

		# Strings of different lengths are not anagrams
		if len(UpperCamelCase_				) != len(UpperCamelCase_				):
				return False

		# Default values for count should be 0
		__SCREAMING_SNAKE_CASE            = defaultdict(UpperCamelCase_				)

		# For each character in input strings,
		# increment count in the corresponding
		for i in range(len(UpperCamelCase_				)				):
				count[first_str[i]] += 1
				count[second_str[i]] -= 1

		return all(_count == 0 for _count in count.values()				)


if __name__ == "__main__":
							from doctest import testmod

							testmod()
							__magic_name__       =			input("Enter the first string ").strip()
							__magic_name__       =			input("Enter the second string ").strip()

							__magic_name__       =			check_anagrams(input_a, input_b)
							print(F"""{input_a} and {input_b} are {"" if status else "not "}anagrams.""")




