

"""simple docstring"""


import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils_fast import AddedToken, PreTrainedTokenizerFast
from ...utils import logging


__A		     =    logging.get_logger(__name__)

__A		     =    {"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}

__A		     =    {
    "vocab_file": {
        "TsinghuaAI/CPM-Generate": "https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/spiece.model",
    },
    "tokenizer_file": {
        "TsinghuaAI/CPM-Generate": "https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/tokenizer.json",
    },
}





class 					snake_case			(       __snake_case						):

    def __init__(			self							:       Tuple  ,						UpperCamelCase__							:       Dict=None  ,						UpperCamelCase__							:       Union[str, Any]=None  ,						UpperCamelCase__							:       Tuple=False  ,						UpperCamelCase__							:       Tuple=True  ,						UpperCamelCase__							:       Optional[int]=False  ,						UpperCamelCase__							:       Dict="<s>"  ,						UpperCamelCase__							:       List[str]="</s>"  ,						UpperCamelCase__							:       Dict="<unk>"  ,						UpperCamelCase__							:       Dict="<sep>"  ,						UpperCamelCase__							:       Tuple="<pad>"  ,						UpperCamelCase__							:       str="<cls>"  ,						UpperCamelCase__							:       Optional[Any]="<mask>"  ,						UpperCamelCase__							:       Tuple=["<eop>", "<eod>"]  ,						**UpperCamelCase__							:       Optional[int]  ,						)->     Optional[Any]:



      '''simple docstring'''


      __lowerCAmelCase: int					   =    AddedToken(UpperCamelCase__  ,						lstrip=UpperCamelCase__  ,						rstrip=UpperCamelCase__) if isinstance(UpperCamelCase__  ,						UpperCamelCase__) else mask_token

      super().__init__(
          vocab_file=UpperCamelCase__  ,						tokenizer_file=UpperCamelCase__  ,						do_lower_case=UpperCamelCase__  ,						remove_space=UpperCamelCase__  ,						keep_accents=UpperCamelCase__  ,						bos_token=UpperCamelCase__  ,						eos_token=UpperCamelCase__  ,						unk_token=UpperCamelCase__  ,						sep_token=UpperCamelCase__  ,						pad_token=UpperCamelCase__  ,						cls_token=UpperCamelCase__  ,						mask_token=UpperCamelCase__  ,						additional_special_tokens=UpperCamelCase__  ,						**UpperCamelCase__  ,						)

      __lowerCAmelCase: Optional[Any]					   =    3
      __lowerCAmelCase: Optional[Any]					   =    do_lower_case
      __lowerCAmelCase: List[str]					   =    remove_space
      __lowerCAmelCase: Any					   =    keep_accents
      __lowerCAmelCase: List[Any]					   =    vocab_file
      __lowerCAmelCase: Union[str, Any]					   =    False if not self.vocab_file else True

      try:
        import jieba
      except ModuleNotFoundError as error:
        raise error.__class__(
            "You need to install jieba to use CpmTokenizer or CpmTokenizerFast. "
            "See https://pypi.org/project/jieba/ for installation.")
      __lowerCAmelCase: Tuple					   =    jieba
      __lowerCAmelCase: str					   =    str.maketrans(" \n"  ,						"\u2582\u2583")

    def 							lowercase_  (			self							:       Union[str, Any]  ,						UpperCamelCase__							:       List[int]  ,						UpperCamelCase__							:       Optional[List[int]] = None)->     List[int]:



      '''simple docstring'''


      __lowerCAmelCase: List[str]					   =    [self.sep_token_id]
      __lowerCAmelCase: Optional[int]					   =    [self.cls_token_id]
      if token_ids_a is None:
        return token_ids_a + sep + cls
      return token_ids_a + sep + token_ids_a + sep + cls

    def 							lowercase_  (			self							:       List[Any]  ,						UpperCamelCase__							:       List[int]  ,						UpperCamelCase__							:       Optional[List[int]] = None)->     List[int]:



      '''simple docstring'''


      __lowerCAmelCase: str					   =    [self.sep_token_id]
      __lowerCAmelCase: Optional[int]					   =    [2]

      if token_ids_a is None:
        return len(token_ids_a + sep) * [0] + cls_segment_id
      return len(token_ids_a + sep) * [0] + len(token_ids_a + sep) * [1] + cls_segment_id

    def 							lowercase_  (			self							:       str  ,						UpperCamelCase__							:       str  ,						UpperCamelCase__							:       Optional[str] = None)->     Tuple[str]:



      '''simple docstring'''


      if not self.can_save_slow_tokenizer:
        raise ValueError(
            "Your fast tokenizer does not have the necessary information to save the vocabulary for a slow "
            "tokenizer.")

      if not os.path.isdir(UpperCamelCase__):
        logger.error(f"Vocabulary path ({save_directory}) should be a directory")
        return
      __lowerCAmelCase: Optional[Any]					   =    os.path.join(
          UpperCamelCase__  ,						(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"])

      if os.path.abspath(self.vocab_file) != os.path.abspath(UpperCamelCase__):
        copyfile(self.vocab_file  ,						UpperCamelCase__)

      return (out_vocab_file,)

    def 							lowercase_  (			self							:       Tuple  ,						UpperCamelCase__							:       Any  ,						*UpperCamelCase__							:       Optional[Any]  ,						**UpperCamelCase__							:       str)->     Optional[Any]:



      '''simple docstring'''


      __lowerCAmelCase: Optional[int]					   =    [
          " ".join([x.translate(self.translator) for x in self.jieba.cut(UpperCamelCase__  ,						cut_all=UpperCamelCase__)])
          for text in batch_text_or_text_pairs
      ]
      return super()._batch_encode_plus(UpperCamelCase__  ,						*UpperCamelCase__  ,						**UpperCamelCase__)




    def 							lowercase_  (			self							:       List[str]  ,						*UpperCamelCase__							:       Dict  ,						**UpperCamelCase__							:       str)->     Any:



      '''simple docstring'''


      __lowerCAmelCase: Dict					   =    super()._decode(*UpperCamelCase__  ,						**UpperCamelCase__)
      __lowerCAmelCase: Any					   =    text.replace(" "  ,						"").replace("\u2582"  ,						" ").replace("\u2583"  ,						"\n")
      return text





"""simple docstring"""


import math

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






def 					a__					(					__SCREAMING_SNAKE_CASE = 1      ,				__SCREAMING_SNAKE_CASE = 1				)			->			qiskit.result.counts.Counts:
		if isinstance(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				) or isinstance(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_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(__SCREAMING_SNAKE_CASE				) != bit_a) or (math.floor(__SCREAMING_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
		__lowerCAmelCase: str					   =    QuantumRegister(2      ,				"qr"				)
		__lowerCAmelCase: Optional[Any]					   =    ClassicalRegister(2      ,				"cr"				)

		__lowerCAmelCase: Dict					   =    QuantumCircuit(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)

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

		# send the information
		__lowerCAmelCase: Dict					   =    str(__SCREAMING_SNAKE_CASE				) + str(__SCREAMING_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(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)

		__lowerCAmelCase: List[str]					   =    Aer.get_backend("aer_simulator"				)
		__lowerCAmelCase: Dict					   =    execute(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				shots=1_0_0_0				)

		return job.result().get_counts(__SCREAMING_SNAKE_CASE				)


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


