

import subprocess
import sys

from transformers import BertConfig, BertModel, BertTokenizer, pipeline
from transformers.testing_utils import TestCasePlus, require_torch


class SCREAMING_SNAKE_CASE  (		__snake_case							):






			"""simple docstring"""




			@require_torch
			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				snake_case_      		= '\nfrom transformers import BertConfig, BertModel, BertTokenizer, pipeline\n        '

				snake_case_      		= '\nmname = "hf-internal-testing/tiny-random-bert"\nBertConfig.from_pretrained(mname)\nBertModel.from_pretrained(mname)\nBertTokenizer.from_pretrained(mname)\npipe = pipeline(task="fill-mask", model=mname)\nprint("success")\n        '

				snake_case_      		= '\nimport socket\ndef offline_socket(*args, **kwargs): raise RuntimeError("Offline mode is enabled, we shouldn\'t access internet")\nsocket.socket = offline_socket\n        '

				# Force fetching the files so that we can use the cache
				snake_case_      		= 'hf-internal-testing/tiny-random-bert'
				BertConfig.from_pretrained(__UpperCamelCase							)
				BertModel.from_pretrained(__UpperCamelCase							)
				BertTokenizer.from_pretrained(__UpperCamelCase							)
				pipeline(task='fill-mask' ,				model=__UpperCamelCase							)

				# baseline - just load from_pretrained with normal network
				snake_case_      		= [sys.executable, '-c', '\n'.join([load, run, mock]							)]

				# should succeed
				snake_case_      		= self.get_env()
				# should succeed as TRANSFORMERS_OFFLINE=1 tells it to use local files
				snake_case_      		= '1'
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				0 ,				result.stderr							)
				self.assertIn('success' ,				result.stdout.decode()							)


			@require_torch
			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				snake_case_      		= '\nfrom transformers import BertConfig, BertModel, BertTokenizer, pipeline\n        '

				snake_case_      		= '\nmname = "hf-internal-testing/tiny-random-bert"\nBertConfig.from_pretrained(mname)\nBertModel.from_pretrained(mname)\nBertTokenizer.from_pretrained(mname)\npipe = pipeline(task="fill-mask", model=mname)\nprint("success")\n        '

				snake_case_      		= '\nimport socket\ndef offline_socket(*args, **kwargs): raise socket.error("Faking flaky internet")\nsocket.socket = offline_socket\n        '

				# Force fetching the files so that we can use the cache
				snake_case_      		= 'hf-internal-testing/tiny-random-bert'
				BertConfig.from_pretrained(__UpperCamelCase							)
				BertModel.from_pretrained(__UpperCamelCase							)
				BertTokenizer.from_pretrained(__UpperCamelCase							)
				pipeline(task='fill-mask' ,				model=__UpperCamelCase							)

				# baseline - just load from_pretrained with normal network
				snake_case_      		= [sys.executable, '-c', '\n'.join([load, run, mock]							)]

				# should succeed
				snake_case_      		= self.get_env()
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				0 ,				result.stderr							)
				self.assertIn('success' ,				result.stdout.decode()							)


			@require_torch
			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				snake_case_      		= '\nfrom transformers import BertConfig, BertModel, BertTokenizer\n        '

				snake_case_      		= '\nmname = "hf-internal-testing/tiny-random-bert-sharded"\nBertConfig.from_pretrained(mname)\nBertModel.from_pretrained(mname)\nprint("success")\n        '

				snake_case_      		= '\nimport socket\ndef offline_socket(*args, **kwargs): raise ValueError("Offline mode is enabled")\nsocket.socket = offline_socket\n        '

				# baseline - just load from_pretrained with normal network
				snake_case_      		= [sys.executable, '-c', '\n'.join([load, run]							)]

				# should succeed
				snake_case_      		= self.get_env()
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				0 ,				result.stderr							)
				self.assertIn('success' ,				result.stdout.decode()							)

				# next emulate no network
				snake_case_      		= [sys.executable, '-c', '\n'.join([load, mock, run]							)]

				# Doesn't fail anymore since the model is in the cache due to other tests, so commenting this.
				# env["TRANSFORMERS_OFFLINE"] = "0"
				# result = subprocess.run(cmd, env=env, check=False, capture_output=True)
				# self.assertEqual(result.returncode, 1, result.stderr)

				# should succeed as TRANSFORMERS_OFFLINE=1 tells it to use local files
				snake_case_      		= '1'
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				0 ,				result.stderr							)
				self.assertIn('success' ,				result.stdout.decode()							)


			@require_torch
			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				snake_case_      		= '\nfrom transformers import pipeline\n        '
				snake_case_      		= '\nmname = "hf-internal-testing/tiny-random-bert"\npipe = pipeline(model=mname)\n        '

				snake_case_      		= '\nimport socket\ndef offline_socket(*args, **kwargs): raise socket.error("Offline mode is enabled")\nsocket.socket = offline_socket\n        '
				snake_case_      		= self.get_env()
				snake_case_      		= '1'
				snake_case_      		= [sys.executable, '-c', '\n'.join([load, mock, run]							)]
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				1 ,				result.stderr							)
				self.assertIn(
				    'You cannot infer task automatically within `pipeline` when using offline mode' ,				result.stderr.decode().replace('\n' ,				''							) ,				)







			@require_torch
			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				snake_case_      		= '\nfrom transformers import AutoModel\n        '
				snake_case_      		= '\nmname = "hf-internal-testing/test_dynamic_model"\nAutoModel.from_pretrained(mname, trust_remote_code=True)\nprint("success")\n        '

				# baseline - just load from_pretrained with normal network
				snake_case_      		= [sys.executable, '-c', '\n'.join([load, run]							)]

				# should succeed
				snake_case_      		= self.get_env()
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				0 ,				result.stderr							)
				self.assertIn('success' ,				result.stdout.decode()							)

				# should succeed as TRANSFORMERS_OFFLINE=1 tells it to use local files
				snake_case_      		= '1'
				snake_case_      		= subprocess.run(__UpperCamelCase ,				env=__UpperCamelCase ,				check=__UpperCamelCase ,				capture_output=__UpperCamelCase							)
				self.assertEqual(result.returncode ,				0 ,				result.stderr							)
				self.assertIn('success' ,				result.stdout.decode()							)



from collections import defaultdict





def a(lowercase__			, lowercase__	):





	'''simple docstring'''
	snake_case_      		= first_str.lower().strip()
	snake_case_      		= second_str.lower().strip()

	# Remove whitespace
	snake_case_      		= first_str.replace(' '			, ''	)
	snake_case_      		= second_str.replace(' '			, ''	)

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

	# Default values for count should be 0
	snake_case_      		= defaultdict(lowercase__	)

	# For each character in input strings,
	# increment count in the corresponding
	for i in range(len(lowercase__	)	):
		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()
		A											=     input('Enter the first string ').strip()
		A											=     input('Enter the second string ').strip()

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