




import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def      UpperCAmelCase  (						UpperCamelCase__ = np.pi / 2						,			UpperCamelCase__ = np.pi / 2						,			UpperCamelCase__ = np.pi / 2   )     ->     qiskit.result.counts.Counts:







				'''simple docstring'''


				__lowerCAmelCase					=  QuantumRegister(3						,			"""qr"""   )  # Define the number of quantum bits
				__lowerCAmelCase					=  ClassicalRegister(1						,			"""cr"""   )  # Define the number of classical bits

				__lowerCAmelCase					=  QuantumCircuit(__UpperCamelCase						,			__UpperCamelCase   )  # Define the quantum circuit.

				# Build the circuit
				quantum_circuit.u(__UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase						,			0   )  # Quantum State to teleport
				quantum_circuit.h(1   )  # add hadamard gate
				quantum_circuit.cx(
				    1						,			2   )  # add control gate with qubit 1 as control and 2 as target.
				quantum_circuit.cx(0						,			1   )
				quantum_circuit.h(0   )
				quantum_circuit.cz(0						,			2   )  # add control z gate.
				quantum_circuit.cx(1						,			2   )

				quantum_circuit.measure([2]						,			[0]   )  # measure the qubit.

				# Simulate the circuit using qasm simulator
				__lowerCAmelCase					=  Aer.get_backend("""aer_simulator"""   )
				__lowerCAmelCase					=  execute(__UpperCamelCase						,			__UpperCamelCase						,			shots=10_00   )

				return job.result().get_counts(__UpperCamelCase   )


if __name__ == "__main__":
	print(
	    "Total count for teleported state is: "
	    f"""{quantum_teleportation(np.pi/2, np.pi/2, np.pi/2)}"""
	)







"""simple docstring"""


import os
import warnings
from pathlib import Path
from typing import Optional, Union

from .dynamic_module_utils import custom_object_save
from .tokenization_utils_base import PreTrainedTokenizerBase
from .utils import PushToHubMixin, copy_func, direct_transformers_import, logging


__A					=			logging.get_logger(__name__)

# Dynamically import the Transformers module to grab the attribute classes of the processor form their names.
__A					=			direct_transformers_import(Path(__file__).parent)


__A					=			{
    'AutoTokenizer': 'PreTrainedTokenizerBase',
    'AutoFeatureExtractor': 'FeatureExtractionMixin',
    'AutoImageProcessor': 'ImageProcessingMixin',
}







class 						lowerCamelCase__   (   __magic_name__							):





			'''simple docstring'''
			lowerCamelCase       =						['''feature_extractor''', '''tokenizer''']
			# Names need to be attr_class for attr in attributes
			lowerCamelCase       =						None
			lowerCamelCase       =						None
			lowerCamelCase       =						None



			def __init__(				self	,	*__UpperCAmelCase	,	**__UpperCAmelCase    )					->	Dict:
				# Sanitize args and kwargs
				for key in kwargs:
					if key not in self.attributes:
						raise TypeError(f'''Unexpected keyword argument {key}.'''    )
				for arg, attribute_name in zip(__UpperCAmelCase	,	self.attributes    ):
					if attribute_name in kwargs:
						raise TypeError(f'''Got multiple values for argument {attribute_name}.'''    )
					else:
						_lowerCAmelCase								=arg

				if len(__UpperCAmelCase    ) != len(self.attributes    ):
					raise ValueError(
					    f'''This processor requires {len(self.attributes    )} arguments: {', '.join(self.attributes    )}. Got '''
					    f'''{len(__UpperCAmelCase    )} arguments instead.'''    )

				# Check each arg is of the proper class (this will also catch a user initializing in the wrong order)
				for attribute_name, arg in kwargs.items():
					_lowerCAmelCase								=getattr(self	,	f'''{attribute_name}_class'''    )
					# Nothing is ever going to be an instance of "AutoXxx", in that case we check the base class.
					_lowerCAmelCase								=AUTO_TO_BASE_CLASS_MAPPING.get(__UpperCAmelCase	,	__UpperCAmelCase    )
					if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						_lowerCAmelCase								=tuple(getattr(__UpperCAmelCase	,	__UpperCAmelCase    ) for n in class_name if n is not None    )
					else:
						_lowerCAmelCase								=getattr(__UpperCAmelCase	,	__UpperCAmelCase    )

					if not isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						raise ValueError(
						    f'''Received a {type(__UpperCAmelCase    ).__name__} for argument {attribute_name}, but a {class_name} was expected.'''    )

					setattr(self	,	__UpperCAmelCase	,	__UpperCAmelCase    )



			def __repr__(				self    )					->	Optional[int]:
				_lowerCAmelCase								=[f'''- {name}: {repr(getattr(self	,	__UpperCAmelCase    )    )}''' for name in self.attributes]
				_lowerCAmelCase								="""\n""".join(__UpperCAmelCase    )
				return f'''{self.__class__.__name__}:\n{attributes_repr}'''



			def    _lowerCAmelCase						(				self	,	__UpperCAmelCase	,	__UpperCAmelCase = False	,	**__UpperCAmelCase    )					->	Union[str, Any]:
				os.makedirs(__UpperCAmelCase	,	exist_ok=__UpperCAmelCase    )

				if push_to_hub:
					_lowerCAmelCase								=kwargs.pop("""commit_message"""	,	__UpperCAmelCase    )
					_lowerCAmelCase								=kwargs.pop("""repo_id"""	,	save_directory.split(os.path.sep    )[-1]    )
					_lowerCAmelCase								=self._create_repo(__UpperCAmelCase	,	**__UpperCAmelCase    )
					_lowerCAmelCase								=self._get_files_timestamps(__UpperCAmelCase    )
				# If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be
				# loaded from the Hub.
				if self._auto_class is not None:
					_lowerCAmelCase								=[getattr(self	,	__UpperCAmelCase    ) for attribute_name in self.attributes]
					_lowerCAmelCase								=[(a.init_kwargs if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ) else a) for a in attrs]
					custom_object_save(self	,	__UpperCAmelCase	,	config=__UpperCAmelCase    )

				for attribute_name in self.attributes:
					_lowerCAmelCase								=getattr(self	,	__UpperCAmelCase    )
					# Include the processor class in the attribute config so this processor can then be reloaded with the
					# `AutoProcessor` API.
					if hasattr(__UpperCAmelCase	,	"""_set_processor_class"""    ):
						attribute._set_processor_class(self.__class__.__name__    )
					attribute.save_pretrained(__UpperCAmelCase    )

				if self._auto_class is not None:
					# We added an attribute to the init_kwargs of the tokenizers, which needs to be cleaned up.
					for attribute_name in self.attributes:
						_lowerCAmelCase								=getattr(self	,	__UpperCAmelCase    )
						if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
							del attribute.init_kwargs["auto_map"]

				if push_to_hub:
					self._upload_modified_files(
					    __UpperCAmelCase	,	__UpperCAmelCase	,	__UpperCAmelCase	,	commit_message=__UpperCAmelCase	,	token=kwargs.get("""use_auth_token"""    )	,	)



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase	,	__UpperCAmelCase = None	,	__UpperCAmelCase = False	,	__UpperCAmelCase = False	,	__UpperCAmelCase = None	,	__UpperCAmelCase = "main"	,	**__UpperCAmelCase	,	)					->	Any:
				_lowerCAmelCase								=cache_dir
				_lowerCAmelCase								=force_download
				_lowerCAmelCase								=local_files_only
				_lowerCAmelCase								=revision

				_lowerCAmelCase								=kwargs.pop("""use_auth_token"""	,	__UpperCAmelCase    )
				if use_auth_token is not None:
					warnings.warn(
					    """The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers."""	,	__UpperCAmelCase    )
					if token is not None:
						raise ValueError(
						    """`token` and `use_auth_token` are both specified. Please set only the argument `token`."""    )
					_lowerCAmelCase								=use_auth_token

				if token is not None:
					# change to `token` in a follow-up PR
					_lowerCAmelCase								=token

				_lowerCAmelCase								=cls._get_arguments_from_pretrained(__UpperCAmelCase	,	**__UpperCAmelCase    )
				return cls(*__UpperCAmelCase    )



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase="AutoProcessor"    )					->	Optional[int]:
				if not isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
					_lowerCAmelCase								=auto_class.__name__

				import transformers.models.auto as auto_module

				if not hasattr(__UpperCAmelCase	,	__UpperCAmelCase    ):
					raise ValueError(f'''{auto_class} is not a valid auto class.'''    )

				_lowerCAmelCase								=auto_class



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase	,	**__UpperCAmelCase    )					->	Optional[Any]:
				_lowerCAmelCase								=[]
				for attribute_name in cls.attributes:
					_lowerCAmelCase								=getattr(cls	,	f'''{attribute_name}_class'''    )
					if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						_lowerCAmelCase								=tuple(getattr(__UpperCAmelCase	,	__UpperCAmelCase    ) if n is not None else None for n in class_name    )
						_lowerCAmelCase								=kwargs.get("""use_fast"""	,	__UpperCAmelCase    )
						if use_fast and classes[1] is not None:
							_lowerCAmelCase								=classes[1]
						else:
							_lowerCAmelCase								=classes[0]
					else:
						_lowerCAmelCase								=getattr(__UpperCAmelCase	,	__UpperCAmelCase    )

					args.append(attribute_class.from_pretrained(__UpperCAmelCase	,	**__UpperCAmelCase    )    )
				return args



			@property
			def    _lowerCAmelCase						(				self    )					->	Optional[int]:
				_lowerCAmelCase								=getattr(self	,	self.attributes[0]    )
				return getattr(__UpperCAmelCase	,	"""model_input_names"""	,	__UpperCAmelCase    )







__A					=			copy_func(ProcessorMixin.push_to_hub)
if ProcessorMixin.push_to_hub.__doc__ is not None:
			__A					=			ProcessorMixin.push_to_hub.__doc__.format(
			    object='processor', object_class='AutoProcessor', object_files='processor files'
			)



