






"""simple docstring"""
import time
from contextlib import contextmanager
from pathlib import Path

import pytest
import requests
from huggingface_hub.hf_api import HfApi, HfFolder


lowerCamelCase_							      = '''__DUMMY_TRANSFORMERS_USER__'''
lowerCamelCase_							      = '''Dummy User'''
lowerCamelCase_							      = '''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'''

lowerCamelCase_							      = '''https://hub-ci.huggingface.co'''
lowerCamelCase_							      = CI_HUB_ENDPOINT + '''/datasets/{repo_id}/resolve/{revision}/{path}'''
lowerCamelCase_							      = CI_HUB_ENDPOINT + '''/{repo_id}/resolve/{revision}/{filename}'''
lowerCamelCase_							      = Path('''~/.huggingface/hub_ci_token''').expanduser()

@pytest.fixture
def 							snake_case (  A__		):
			monkeypatch.setattr(
			    "huggingface_hub.file_download.HUGGINGFACE_CO_URL_TEMPLATE"      ,A__		)

@pytest.fixture
def 							snake_case (  A__		):
			monkeypatch.setattr("datasets.config.HF_ENDPOINT"      ,A__		)
			monkeypatch.setattr("datasets.config.HUB_DATASETS_URL"      ,A__		)

@pytest.fixture
def 							snake_case (  A__		):
			monkeypatch.setattr("huggingface_hub.hf_api.HfFolder.path_token"      ,A__		)

@pytest.fixture
def 							snake_case (  A__      ,A__		):
			HfFolder.save_token(A__		)
			yield
			HfFolder.delete_token()

@pytest.fixture(scope="session"		)
def 							snake_case (  ):
			return HfApi(endpoint=A__		)

@pytest.fixture(scope="session"		)
def 							snake_case (  A__		):
			UpperCAmelCase_	:					Optional[Any]     	=   HfFolder.get_token()
			HfFolder.save_token(A__		)
			yield CI_HUB_USER_TOKEN
			if previous_token is not None:
						HfFolder.save_token(A__		)

@pytest.fixture
def 							snake_case (  A__		):
			def _cleanup_repo(A__		):
						hf_api.delete_repo(A__      ,token=A__      ,repo_type="dataset"		)

			return _cleanup_repo

@pytest.fixture
def 							snake_case (  A__		):
			@contextmanager
			def _temporary_repo(A__		):
						try:
									yield repo_id
						finally:
									cleanup_repo(A__		)

			return _temporary_repo

@pytest.fixture(scope="session"		)
def 							snake_case (  A__      ,A__      ,A__		):
			UpperCAmelCase_	:					Tuple     	=   F"""repo_txt_data-{int(time.time() * 10e3		)}"""
			UpperCAmelCase_	:					List[Any]     	=   F"""{CI_HUB_USER}/{repo_name}"""
			hf_api.create_repo(A__      ,token=A__      ,repo_type="dataset"      ,private=A__		)
			hf_api.upload_file(
			    token=A__      ,path_or_fileobj=str(A__		)      ,path_in_repo="data/text_data.txt"      ,repo_id=A__      ,repo_type="dataset"      ,)
			yield repo_id
			try:
						hf_api.delete_repo(A__      ,token=A__      ,repo_type="dataset"		)
			except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
						pass

@pytest.fixture()
def 							snake_case (  A__      ,A__      ,A__		):
			return hf_private_dataset_repo_txt_data_

@pytest.fixture(scope="session"		)
def 							snake_case (  A__      ,A__      ,A__		):
			UpperCAmelCase_	:					List[Any]     	=   F"""repo_zipped_txt_data-{int(time.time() * 10e3		)}"""
			UpperCAmelCase_	:					int     	=   F"""{CI_HUB_USER}/{repo_name}"""
			hf_api.create_repo(A__      ,token=A__      ,repo_type="dataset"      ,private=A__		)
			hf_api.upload_file(
			    token=A__      ,path_or_fileobj=str(A__		)      ,path_in_repo="data.zip"      ,repo_id=A__      ,repo_type="dataset"      ,)
			yield repo_id
			try:
						hf_api.delete_repo(A__      ,token=A__      ,repo_type="dataset"		)
			except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
						pass

@pytest.fixture()
def 							snake_case (  A__      ,A__      ,A__		):
			return hf_private_dataset_repo_zipped_txt_data_

@pytest.fixture(scope="session"		)
def 							snake_case (  A__      ,A__      ,A__		):
			UpperCAmelCase_	:					Any     	=   F"""repo_zipped_img_data-{int(time.time() * 10e3		)}"""
			UpperCAmelCase_	:					Tuple     	=   F"""{CI_HUB_USER}/{repo_name}"""
			hf_api.create_repo(A__      ,token=A__      ,repo_type="dataset"      ,private=A__		)
			hf_api.upload_file(
			    token=A__      ,path_or_fileobj=str(A__		)      ,path_in_repo="data.zip"      ,repo_id=A__      ,repo_type="dataset"      ,)
			yield repo_id
			try:
						hf_api.delete_repo(A__      ,token=A__      ,repo_type="dataset"		)
			except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
						pass




@pytest.fixture()
def 							snake_case (  A__      ,A__      ,A__		):
			return hf_private_dataset_repo_zipped_img_data_





import qiskit


def      UpperCamelCase   (       __lowerCamelCase	:					int							,   __lowerCamelCase	:					int       ):
       snake_case			:  int     							= qiskit.Aer.get_backend("aer_simulator"       )

       # Create a Quantum Circuit acting on the q register
       snake_case			:  Dict     							= qiskit.QuantumCircuit(__lowerCamelCase							,   __lowerCamelCase       )

       # 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
       snake_case			:  Dict     							= qiskit.execute(__lowerCamelCase							,   __lowerCamelCase							,   shots=1000       )

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


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





