"""simple docstring"""


import textwrap

import pyarrow as pa
import pytest

from datasets import Features, Value
from datasets.packaged_modules.json.json import Json







@pytest.fixture
def        __a (		A   ):






     '''simple docstring'''



     lowercase__								=				tmp_path / "file.jsonl"
     lowercase__								=				textwrap.dedent(
         "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "   )
     with open(A     ,					"w"   ) as f:
          f.write(A   )
     return str(A   )







@pytest.fixture
def        __a (		A   ):






     '''simple docstring'''



     lowercase__								=				tmp_path / "file_utf16_encoded.jsonl"
     lowercase__								=				textwrap.dedent(
         "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "   )
     with open(A     ,					"w"     ,					encoding="utf-16"   ) as f:
          f.write(A   )
     return str(A   )







@pytest.fixture
def        __a (		A   ):






     '''simple docstring'''



     lowercase__								=				tmp_path / "file_with_list_of_dicts.json"
     lowercase__								=				textwrap.dedent(
         "\\n        [\n            {\"col_1\": -1},\n            {\"col_1\": 1, \"col_2\": 2},\n            {\"col_1\": 10, \"col_2\": 20}\n        ]\n        "   )
     with open(A     ,					"w"   ) as f:
          f.write(A   )
     return str(A   )







@pytest.fixture
def        __a (		A   ):






     '''simple docstring'''



     lowercase__								=				tmp_path / "file_with_list_of_dicts_field.json"
     lowercase__								=				textwrap.dedent(
         "\\n        {\n            \"field1\": 1,\n            \"field2\": \"aabb\",\n            \"field3\": [\n                {\"col_1\": -1},\n                {\"col_1\": 1, \"col_2\": 2},\n                {\"col_1\": 10, \"col_2\": 20}\n            ]\n        }\n        "   )
     with open(A     ,					"w"   ) as f:
          f.write(A   )
     return str(A   )







@pytest.mark.parametrize(
    "file_fixture, config_kwargs"     ,					[
        ("jsonl_file", {}),
        ("jsonl_file_utf16_encoded", {"encoding": "utf-16"}),
        ("json_file_with_list_of_dicts", {}),
        ("json_file_with_list_of_dicts_field", {"field": "field3"}),
    ]     ,					)
def        __a (		A     ,					A     ,					A   ):






     '''simple docstring'''



     lowercase__								=				Json(**A   )
     lowercase__								=				json._generate_tables([[request.getfixturevalue(A   )]]   )
     lowercase__								=				pa.concat_tables([table for _, table in generator]   )
     assert pa_table.to_pydict() == {"col_1": [-1, 1, 10], "col_2": [None, 2, 20]}







@pytest.mark.parametrize(
    "file_fixture, config_kwargs"     ,					[
        (
            "jsonl_file",
            {"features": Features({"col_1": Value("int64"   ), "col_2": Value("int64"   ), "missing_col": Value("string"   )}   )},
        ),
        (
            "json_file_with_list_of_dicts",
            {"features": Features({"col_1": Value("int64"   ), "col_2": Value("int64"   ), "missing_col": Value("string"   )}   )},
        ),
        (
            "json_file_with_list_of_dicts_field",
            {
                "field": "field3",
                "features": Features(
                    {"col_1": Value("int64"   ), "col_2": Value("int64"   ), "missing_col": Value("string"   )}   ),
            },
        ),
    ]     ,					)
def        __a (		A     ,					A     ,					A   ):






     '''simple docstring'''



     lowercase__								=				Json(**A   )
     lowercase__								=				json._generate_tables([[request.getfixturevalue(A   )]]   )
     lowercase__								=				pa.concat_tables([table for _, table in generator]   )
     assert pa_table.to_pydict() == {"col_1": [-1, 1, 10], "col_2": [None, 2, 20], "missing_col": [None, None, None]}





"""simple docstring"""


import qiskit
from qiskit.providers import Backend







def        __a (		A     ,					A   ):






     '''simple docstring'''



     lowercase__			,    lowercase__								=				bin(A   )[2:], bin(A   )[2:]  # Remove leading '0b'

     # Ensure that both strings are of the same length
     if len(A   ) > len(A   ):
          lowercase__								=				y.zfill(len(A   )   )
     else:
          lowercase__								=				x.zfill(len(A   )   )

     # We need (3 * number of bits in the larger number)+1 qBits
     # The second parameter is the number of classical registers, to measure the result
     lowercase__								=				qiskit.QuantumCircuit((len(A   ) * 3) + 1     ,					len(A   ) + 1   )

     # We are essentially "not-ing" the bits that are 1
     # Reversed because it's easier to perform ops on more significant bits
     for i in range(len(A   )   ):
          if x[::-1][i] == "1":
               circuit.x(A   )
     for j in range(len(A   )   ):
          if y[::-1][j] == "1":
               circuit.x(len(A   ) + j   )

     return circuit, x, y







def        __a (		A     ,					A     ,					A     ,					A     ,					A     ,					):






     '''simple docstring'''



     circuit.ccx(A     ,					A     ,					A   )
     circuit.cx(A     ,					A   )
     circuit.ccx(A     ,					A     ,					A   )
     circuit.cx(A     ,					A   )
     circuit.cx(A     ,					A   )







def        __a (		A     ,					A     ,					A = qiskit.Aer.get_backend("aer_simulator"   )     ,					):






     '''simple docstring'''



     if vala < 0 or vala < 0:
          raise ValueError("Both Integers must be positive!"   )

     # Store the Integers
     lowercase__			,    lowercase__			,    lowercase__								=				store_two_classics(A     ,					A   )
     for i in range(len(A   )   ):
          full_adder(A     ,					A     ,					len(A   ) + i     ,					len(A   ) + len(A   ) + i     ,					len(A   ) + len(A   ) + i + 1   )
          circuit.barrier()  # Optional, just for aesthetics

     # Measure the resultant qBits
     for i in range(len(A   ) + 1   ):
          circuit.measure([(len(A   ) * 2) + i]     ,					[i]   )

     lowercase__								=				qiskit.execute(A     ,					A     ,					shots=1   ).result()

     # The result is in binary. Convert it back to int
     return int(list(res.get_counts()   )[0]     ,					2   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()




