






"""simple docstring"""



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        __lowercase(       unittest.TestCase						,							_UpperCamelCase  ):






						def 		lowerCAmelCase   (					self)			->  Any:




											"""simple docstring"""





											lowerCamelCase__				=load_tool('image-segmentation')
											self.tool.setup()
											lowerCamelCase__				=load_tool('image-segmentation'    ,						remote=_SCREAMING_SNAKE_CASE)






						def 		lowerCAmelCase   (					self)			->  List[Any]:




											"""simple docstring"""





											lowerCamelCase__				=Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO')) / '000000039769.png')
											lowerCamelCase__				=self.tool(_SCREAMING_SNAKE_CASE    ,						'cat')
											self.assertTrue(isinstance(_SCREAMING_SNAKE_CASE    ,						Image.Image))






						def 		lowerCAmelCase   (					self)			->  str:




											"""simple docstring"""





											lowerCamelCase__				=Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO')) / '000000039769.png')
											lowerCamelCase__				=self.remote_tool(_SCREAMING_SNAKE_CASE    ,						'cat')
											self.assertTrue(isinstance(_SCREAMING_SNAKE_CASE    ,						Image.Image))






						def 		lowerCAmelCase   (					self)			->  int:




											"""simple docstring"""





											lowerCamelCase__				=Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO')) / '000000039769.png')
											lowerCamelCase__				=self.tool(image=_SCREAMING_SNAKE_CASE    ,						label='cat')
											self.assertTrue(isinstance(_SCREAMING_SNAKE_CASE    ,						Image.Image))






						def 		lowerCAmelCase   (					self)			->  List[Any]:




											"""simple docstring"""





											lowerCamelCase__				=Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO')) / '000000039769.png')
											lowerCamelCase__				=self.remote_tool(image=_SCREAMING_SNAKE_CASE    ,						label='cat')
											self.assertTrue(isinstance(_SCREAMING_SNAKE_CASE    ,						Image.Image))







"""simple docstring"""



import math

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




def 						lowerCamelCase_				(  __A  :		int = 1			,	__A  :		int = 1			):
					if isinstance(__A			,	__A			) or isinstance(__A			,	__A			):
										raise TypeError('inputs must be integers.'			)
					if (bit_a < 0) or (bit_a < 0):
										raise ValueError('inputs must be positive.'			)
					if (math.floor(__A			) != bit_a) or (math.floor(__A			) != 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
					lowerCamelCase__				=QuantumRegister(2			,	'qr'			)
					lowerCamelCase__				=ClassicalRegister(2			,	'cr'			)

					lowerCamelCase__				=QuantumCircuit(__A			,	__A			)

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

					# send the information
					lowerCamelCase__				=str(__A			) + str(__A			)

					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(__A			,	__A			)

					lowerCamelCase__				=Aer.get_backend('aer_simulator'			)
					lowerCamelCase__				=execute(__A			,	__A			,	shots=1000			)

					return job.result().get_counts(__A			)


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