




"""simple docstring"""

import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute




def    snake_case__						(							lowerCAmelCase :		int = 1					,       lowerCAmelCase :		int = 1		):
					if isinstance(snake_case__					,       snake_case__		) or isinstance(snake_case__					,       snake_case__		):
										raise TypeError("""inputs must be integers."""		)
					if (bit_a < 0) or (bit_a < 0):
										raise ValueError("""inputs must be positive."""		)
					if (math.floor(snake_case__		) != bit_a) or (math.floor(snake_case__		) != bit_a):
										raise ValueError("""inputs must be exact integers."""		)
					if (bit_a > 1) or (bit_a > 1):
										raise ValueError("""inputs must be less or equal to 1."""		)

					# build registers
					__snake_case        =						QuantumRegister(2					,       """qr"""		)
					__snake_case        =						ClassicalRegister(2					,       """cr"""		)

					__snake_case        =						QuantumCircuit(snake_case__					,       snake_case__		)

					# entanglement the qubits
					quantum_circuit.h(1		)
					quantum_circuit.cx(1					,       0		)

					# send the information
					__snake_case        =						str(snake_case__		) + str(snake_case__		)

					if c_information == "11":
										quantum_circuit.x(1		)
										quantum_circuit.z(1		)
					elif c_information == "10":
										quantum_circuit.z(1		)
					elif c_information == "01":
										quantum_circuit.x(1		)
					else:
										quantum_circuit.i(1		)

					# unentangled the circuit
					quantum_circuit.cx(1					,       0		)
					quantum_circuit.h(1		)

					# measure the circuit
					quantum_circuit.measure(snake_case__					,       snake_case__		)

					__snake_case        =						Aer.get_backend("""aer_simulator"""		)
					__snake_case        =						execute(snake_case__					,       snake_case__					,       shots=1_000		)

					return job.result().get_counts(snake_case__		)


if __name__ == "__main__":
		print(f'Counts for classical state send: {superdense_coding(1,1)}')




import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
     from PIL import Image


class 							lowerCamelCase       (		unittest.TestCase			,  __snake_case					):



  """simple docstring"""





  def 					lowercase_						(					self					):
      A_								=					load_tool("image-question-answering"					)
      self.tool.setup()
      A_								=					load_tool("image-question-answering"						,    remote=__UpperCamelCase					)

  def 					lowercase_						(					self					):
      A_								=					Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
      A_								=					self.tool(__UpperCamelCase						,    "How many cats are sleeping on the couch?"					)
      self.assertEqual(__UpperCamelCase						,    "2"					)

  def 					lowercase_						(					self					):
      A_								=					Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
      A_								=					self.remote_tool(__UpperCamelCase						,    "How many cats are sleeping on the couch?"					)
      self.assertEqual(__UpperCamelCase						,    "2"					)

  def 					lowercase_						(					self					):
      A_								=					Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
      A_								=					self.tool(image=__UpperCamelCase						,    question="How many cats are sleeping on the couch?"					)
      self.assertEqual(__UpperCamelCase						,    "2"					)

  def 					lowercase_						(					self					):
      A_								=					Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
      A_								=					self.remote_tool(image=__UpperCamelCase						,    question="How many cats are sleeping on the couch?"					)
      self.assertEqual(__UpperCamelCase						,    "2"					)






