


import json
import os
import unittest

from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin



@require_tokenizers
class 						_UpperCAmelCase      (     lowercase		,		unittest.TestCase							):
		lowerCamelCase_	:			Union[str, Any]       			=  OpenAIGPTTokenizer
		lowerCamelCase_	:			str       			=  OpenAIGPTTokenizerFast
		lowerCamelCase_	:			Dict       			=  True
		lowerCamelCase_	:			Dict       			=  False






		def _snake_case		(						self				:     Optional[Any]):
				super().setUp()

				# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						[
				    "l",
				    "o",
				    "w",
				    "e",
				    "r",
				    "s",
				    "t",
				    "i",
				    "d",
				    "n",
				    "w</w>",
				    "r</w>",
				    "t</w>",
				    "lo",
				    "low",
				    "er</w>",
				    "low</w>",
				    "lowest</w>",
				    "newer</w>",
				    "wider</w>",
				    "<unk>",
				]
				SCREAMING_SNAKE_CASE_				:str				     =						dict(zip(UpperCAmelCase   ,  range(len(UpperCAmelCase))))
				SCREAMING_SNAKE_CASE_				:Any				     =						["#version: 0.2", "l o", "lo w", "e r</w>", ""]

				SCREAMING_SNAKE_CASE_				:Tuple				     =						os.path.join(self.tmpdirname   ,  VOCAB_FILES_NAMES["vocab_file"])
				SCREAMING_SNAKE_CASE_				:Optional[int]				     =						os.path.join(self.tmpdirname   ,  VOCAB_FILES_NAMES["merges_file"])
				with open(self.vocab_file   ,  "w") as fp:
						fp.write(json.dumps(UpperCAmelCase))
				with open(self.merges_file   ,  "w") as fp:
						fp.write("\n".join(UpperCAmelCase))






		def _snake_case		(						self				:     Tuple   ,  UpperCAmelCase				:     int):
				return "lower newer", "lower newer"






		def _snake_case		(						self				:     str):
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						OpenAIGPTTokenizer(self.vocab_file   ,  self.merges_file)

				SCREAMING_SNAKE_CASE_				:List[Any]				     =						"lower"
				SCREAMING_SNAKE_CASE_				:List[str]				     =						["low", "er</w>"]
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						tokenizer.tokenize(UpperCAmelCase)
				self.assertListEqual(UpperCAmelCase   ,  UpperCAmelCase)

				SCREAMING_SNAKE_CASE_				:List[str]				     =						tokens + ["<unk>"]
				SCREAMING_SNAKE_CASE_				:Any				     =						[14, 15, 20]
				self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase)   ,  UpperCAmelCase)






		def _snake_case		(						self				:     Tuple   ,  UpperCAmelCase				:     Any=15):
				for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
						with self.subTest(F"{tokenizer.__class__.__name__} ({pretrained_name})"):
								SCREAMING_SNAKE_CASE_				:int				     =						self.rust_tokenizer_class.from_pretrained(UpperCAmelCase   ,  **UpperCAmelCase)

								# Simple input
								SCREAMING_SNAKE_CASE_				:List[Any]				     =						"This is a simple input"
								SCREAMING_SNAKE_CASE_				:Optional[Any]				     =						["This is a simple input 1", "This is a simple input 2"]
								SCREAMING_SNAKE_CASE_				:str				     =						("This is a simple input", "This is a pair")
								SCREAMING_SNAKE_CASE_				:Optional[Any]				     =						[
								    ("This is a simple input 1", "This is a simple input 2"),
								    ("This is a simple pair 1", "This is a simple pair 2"),
								]

								# Simple input tests
								self.assertRaises(UpperCAmelCase   ,  tokenizer_r.encode   ,  UpperCAmelCase   ,  max_length=UpperCAmelCase   ,  padding="max_length")

								# Simple input
								self.assertRaises(UpperCAmelCase   ,  tokenizer_r.encode_plus   ,  UpperCAmelCase   ,  max_length=UpperCAmelCase   ,  padding="max_length")

								# Simple input
								self.assertRaises(
								    UpperCAmelCase   ,  tokenizer_r.batch_encode_plus   ,  UpperCAmelCase   ,  max_length=UpperCAmelCase   ,  padding="max_length"   ,  )

								# Pair input
								self.assertRaises(UpperCAmelCase   ,  tokenizer_r.encode   ,  UpperCAmelCase   ,  max_length=UpperCAmelCase   ,  padding="max_length")

								# Pair input
								self.assertRaises(UpperCAmelCase   ,  tokenizer_r.encode_plus   ,  UpperCAmelCase   ,  max_length=UpperCAmelCase   ,  padding="max_length")

								# Pair input
								self.assertRaises(
								    UpperCAmelCase   ,  tokenizer_r.batch_encode_plus   ,  UpperCAmelCase   ,  max_length=UpperCAmelCase   ,  padding="max_length"   ,  )







		def _snake_case		(						self				:     Tuple):
				pass




@require_ftfy
@require_spacy
@require_tokenizers
class 						_UpperCAmelCase      (     lowercase							):
		pass










import qiskit


def     lowercase	(    a     , a ):



		'''simple docstring'''




		SCREAMING_SNAKE_CASE_				:int				     =						qiskit.Aer.get_backend("aer_simulator" )

		# Create a Quantum Circuit acting on the q register
		SCREAMING_SNAKE_CASE_				:Union[str, Any]				     =						qiskit.QuantumCircuit(a     , a )

		# Apply X (NOT) Gate to Qubits 0 & 1
		circuit.x(0 )
		circuit.x(1 )

		# Map the quantum measurement to the classical bits
		circuit.measure([0, 1]     , [0, 1] )

		# Execute the circuit on the qasm simulator
		SCREAMING_SNAKE_CASE_				:Any				     =						qiskit.execute(a     , a     , shots=1000 )

		# Return the histogram data of the results of the experiment.
		return job.result().get_counts(a )


if __name__ == "__main__":
		SCREAMING_SNAKE_CASE__     					=			single_qubit_measure(2, 2)
		print(F'''Total count for various states are: {counts}''')






