






"""simple docstring"""


import pytest

from datasets import Dataset, DatasetDict, Features, NamedSplit, Value
from datasets.io.text import TextDatasetReader

from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases


def        UpperCAmelCase      (					a__     ,      a__ ):





						'''simple docstring'''






						assert isinstance(a__     ,      a__ )
						assert dataset.num_rows == 4
						assert dataset.num_columns == 1
						assert dataset.column_names == ["text"]
						for feature, expected_dtype in expected_features.items():
												assert dataset.features[feature].dtype == expected_dtype


@pytest.mark.parametrize('keep_in_memory'     ,      [False, True] )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :List[Any]						=			tmp_path / 'cache'
						lowerCAmelCase   :Tuple						=			{'text': 'string'}
						with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
												lowerCAmelCase   :Optional[int]						=			TextDatasetReader(a__     ,      cache_dir=a__     ,      keep_in_memory=a__ ).read()
						_check_text_dataset(a__     ,      a__ )


@pytest.mark.parametrize(
    'features'     ,      [
        None,
        {'text': 'string'},
        {'text': 'int32'},
        {'text': 'float32'},
    ]     ,      )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :Any						=			tmp_path / 'cache'
						lowerCAmelCase   :Optional[Any]						=			{'text': 'string'}
						lowerCAmelCase   :List[str]						=			features.copy() if features else default_expected_features
						lowerCAmelCase   :int						=			(
						    Features({feature: Value(a__ ) for feature, dtype in features.items()} ) if features is not None else None
						)
						lowerCAmelCase   :Union[str, Any]						=			TextDatasetReader(a__     ,      features=a__     ,      cache_dir=a__ ).read()
						_check_text_dataset(a__     ,      a__ )


@pytest.mark.parametrize('split'     ,      [None, NamedSplit('train' ), 'train', 'test'] )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :Union[str, Any]						=			tmp_path / 'cache'
						lowerCAmelCase   :Tuple						=			{'text': 'string'}
						lowerCAmelCase   :Optional[Any]						=			TextDatasetReader(a__     ,      cache_dir=a__     ,      split=a__ ).read()
						_check_text_dataset(a__     ,      a__ )
						assert dataset.split == split if split else "train"


@pytest.mark.parametrize('path_type'     ,      [str, list] )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						if issubclass(a__     ,      a__ ):
												lowerCAmelCase   :int						=			text_path
						elif issubclass(a__     ,      a__ ):
												lowerCAmelCase   :Tuple						=			[text_path]
						lowerCAmelCase   :List[Any]						=			tmp_path / 'cache'
						lowerCAmelCase   :Union[str, Any]						=			{'text': 'string'}
						lowerCAmelCase   :List[str]						=			TextDatasetReader(a__     ,      cache_dir=a__ ).read()
						_check_text_dataset(a__     ,      a__ )


def        UpperCAmelCase      (					a__     ,      a__     ,      a__=("train",) ):





						'''simple docstring'''






						assert isinstance(a__     ,      a__ )
						for split in splits:
												lowerCAmelCase   :Tuple						=			dataset_dict[split]
												assert dataset.num_rows == 4
												assert dataset.num_columns == 1
												assert dataset.column_names == ["text"]
												for feature, expected_dtype in expected_features.items():
																		assert dataset.features[feature].dtype == expected_dtype


@pytest.mark.parametrize('keep_in_memory'     ,      [False, True] )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :int						=			tmp_path / 'cache'
						lowerCAmelCase   :List[Any]						=			{'text': 'string'}
						with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
												lowerCAmelCase   :List[str]						=			TextDatasetReader({'train': text_path}     ,      cache_dir=a__     ,      keep_in_memory=a__ ).read()
						_check_text_datasetdict(a__     ,      a__ )


@pytest.mark.parametrize(
    'features'     ,      [
        None,
        {'text': 'string'},
        {'text': 'int32'},
        {'text': 'float32'},
    ]     ,      )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :List[Any]						=			tmp_path / 'cache'
						# CSV file loses col_1 string dtype information: default now is "int64" instead of "string"
						lowerCAmelCase   :str						=			{'text': 'string'}
						lowerCAmelCase   :int						=			features.copy() if features else default_expected_features
						lowerCAmelCase   :int						=			(
						    Features({feature: Value(a__ ) for feature, dtype in features.items()} ) if features is not None else None
						)
						lowerCAmelCase   :Dict						=			TextDatasetReader({'train': text_path}     ,      features=a__     ,      cache_dir=a__ ).read()
						_check_text_datasetdict(a__     ,      a__ )







@pytest.mark.parametrize('split'     ,      [None, NamedSplit('train' ), 'train', 'test'] )
def        UpperCAmelCase      (					a__     ,      a__     ,      a__ ):





						'''simple docstring'''






						if split:
												lowerCAmelCase   :List[Any]						=			{split: text_path}
						else:
												lowerCAmelCase   :Dict						=			'train'
												lowerCAmelCase   :Union[str, Any]						=			{'train': text_path, 'test': text_path}
						lowerCAmelCase   :Union[str, Any]						=			tmp_path / 'cache'
						lowerCAmelCase   :Any						=			{'text': 'string'}
						lowerCAmelCase   :str						=			TextDatasetReader(a__     ,      cache_dir=a__ ).read()
						_check_text_datasetdict(a__     ,      a__     ,      splits=list(path.keys() ) )
						assert all(dataset[split].split == split for split in path.keys() )







"""simple docstring"""


import qiskit


def        UpperCAmelCase      (					a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :List[Any]						=			qiskit.Aer.get_backend('aer_simulator' )

						# Create a Quantum Circuit acting on the q register
						lowerCAmelCase   :Optional[int]						=			qiskit.QuantumCircuit(a__     ,      a__ )

						# Apply X (NOT) Gate to Qubits 0 & 1
						circuit.x(0 )
						circuit.x(1 )

						# Map the quantum measurement to the classical bits
						circuit.measure([0, 1]     ,      [0, 1] )

						# Execute the circuit on the qasm simulator
						lowerCAmelCase   :Dict						=			qiskit.execute(a__     ,      a__     ,      shots=10_00 )

						# Return the histogram data of the results of the experiment.
						return job.result().get_counts(a__ )


if __name__ == "__main__":
		__SCREAMING_SNAKE_CASE   =   single_qubit_measure(2, 2)
		print(F"""Total count for various states are: {counts}""")