
'''simple docstring'''



import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute
def       lowerCAmelCase_		( SCREAMING_SNAKE_CASE_ = 1			,					SCREAMING_SNAKE_CASE_ = 1  )   ->   qiskit.result.counts.Counts:




   """simple docstring"""
   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
   _SCREAMING_SNAKE_CASE          = QuantumRegister(2			,					"""qr"""  )
   _SCREAMING_SNAKE_CASE          = ClassicalRegister(2			,					"""cr"""  )

   _SCREAMING_SNAKE_CASE          = QuantumCircuit(SCREAMING_SNAKE_CASE_			,					SCREAMING_SNAKE_CASE_  )

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

   # send the information
   _SCREAMING_SNAKE_CASE          = 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_  )

   _SCREAMING_SNAKE_CASE          = Aer.get_backend("""aer_simulator"""  )
   _SCREAMING_SNAKE_CASE          = execute(SCREAMING_SNAKE_CASE_			,					SCREAMING_SNAKE_CASE_			,					shots=10_00  )

   return job.result().get_counts(SCREAMING_SNAKE_CASE_  )


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








'''simple docstring'''



import textwrap

import pyarrow as pa
import pytest

from datasets import Features, Image
from datasets.packaged_modules.text.text import Text

from ..utils import require_pil
@pytest.fixture
def       lowerCAmelCase_		( SCREAMING_SNAKE_CASE_  )   ->   Union[str, Any]:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE          = tmp_path / """text.txt"""
   _SCREAMING_SNAKE_CASE          = textwrap.dedent(
       """\
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
        Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

        Second paragraph:
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
        Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        """  )
   with open(SCREAMING_SNAKE_CASE_			,					"""w"""			,					encoding="""utf-8"""  ) as f:
      f.write(SCREAMING_SNAKE_CASE_  )
   return str(SCREAMING_SNAKE_CASE_  )
@pytest.fixture
def       lowerCAmelCase_		( SCREAMING_SNAKE_CASE_			,					SCREAMING_SNAKE_CASE_  )   ->   Optional[int]:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE          = tmp_path / """text_with_image.txt"""
   with open(SCREAMING_SNAKE_CASE_			,					"""w"""			,					encoding="""utf-8"""  ) as f:
      f.write(SCREAMING_SNAKE_CASE_  )
   return str(SCREAMING_SNAKE_CASE_  )
@pytest.mark.parametrize("""keep_linebreaks"""			,					[True, False]  )
def       lowerCAmelCase_		( SCREAMING_SNAKE_CASE_			,					SCREAMING_SNAKE_CASE_  )   ->   int:




   """simple docstring"""
   with open(SCREAMING_SNAKE_CASE_			,					encoding="""utf-8"""  ) as f:
      _SCREAMING_SNAKE_CASE          = f.read().splitlines(keepends=SCREAMING_SNAKE_CASE_  )
   _SCREAMING_SNAKE_CASE          = Text(keep_linebreaks=SCREAMING_SNAKE_CASE_			,					encoding="""utf-8"""  )
   _SCREAMING_SNAKE_CASE          = text._generate_tables([[text_file]]  )
   _SCREAMING_SNAKE_CASE          = pa.concat_tables([table for _, table in generator]  ).to_pydict()["""text"""]
   assert generated_content == expected_content
@require_pil
def       lowerCAmelCase_		( SCREAMING_SNAKE_CASE_  )   ->   List[str]:




   """simple docstring"""
   with open(SCREAMING_SNAKE_CASE_			,					encoding="""utf-8"""  ) as f:
      _SCREAMING_SNAKE_CASE          = f.read().splitlines()[0]
   _SCREAMING_SNAKE_CASE          = Text(encoding="""utf-8"""			,					features=Features({"""image""": Image()}  )  )
   _SCREAMING_SNAKE_CASE          = text._generate_tables([[text_file_with_image]]  )
   _SCREAMING_SNAKE_CASE          = pa.concat_tables([table for _, table in generator]  )
   assert pa_table.schema.field("""image"""  ).type == Image()()
   _SCREAMING_SNAKE_CASE          = pa_table.to_pydict()["""image"""]
   assert generated_content == [{"path": image_file, "bytes": None}]







@pytest.mark.parametrize("""sample_by"""			,					["""line""", """paragraph""", """document"""]  )
def       lowerCAmelCase_		( SCREAMING_SNAKE_CASE_			,					SCREAMING_SNAKE_CASE_  )   ->   List[Any]:




   """simple docstring"""
   with open(SCREAMING_SNAKE_CASE_			,					encoding="""utf-8"""  ) as f:
      _SCREAMING_SNAKE_CASE          = f.read()
   if sample_by == "line":
      _SCREAMING_SNAKE_CASE          = expected_content.splitlines()
   elif sample_by == "paragraph":
      _SCREAMING_SNAKE_CASE          = expected_content.split("""\n\n"""  )
   elif sample_by == "document":
      _SCREAMING_SNAKE_CASE          = [expected_content]
   _SCREAMING_SNAKE_CASE          = Text(sample_by=SCREAMING_SNAKE_CASE_			,					encoding="""utf-8"""			,					chunksize=1_00  )
   _SCREAMING_SNAKE_CASE          = text._generate_tables([[text_file]]  )
   _SCREAMING_SNAKE_CASE          = pa.concat_tables([table for _, table in generator]  ).to_pydict()["""text"""]
   assert generated_content == expected_content






