
"""simple docstring"""







import argparse
from collections import defaultdict

import yaml


lowerCamelCase__        =		"""docs/source/en/_toctree.yml"""
def    __lowerCAmelCase    (_UpperCamelCase		):
	__lowerCAmelCase      :						Dict						      =				defaultdict(_UpperCamelCase		)
	__lowerCAmelCase      :						Dict						      =				[]
	__lowerCAmelCase      :						Tuple						      =				[]
	for doc in doc_list:
		if "local" in doc:
			counts[doc["local"]] += 1

		if doc["title"].lower() == "overview":
			overview_doc.append({'local': doc['local'], 'title': doc['title']}		)
		else:
			new_doc_list.append(_UpperCamelCase		)

	__lowerCAmelCase      :						str						      =				new_doc_list
	__lowerCAmelCase      :						List[str]						      =				[key for key, value in counts.items() if value > 1]

	__lowerCAmelCase      :						int						      =				[]
	for duplicate_key in duplicates:
		__lowerCAmelCase      :						List[str]						      =				list({doc['title'] for doc in doc_list if doc['local'] == duplicate_key}		)
		if len(_UpperCamelCase		) > 1:
			raise ValueError(
			    F"{duplicate_key} is present several times in the documentation table of content at "
			    '`docs/source/en/_toctree.yml` with different *Title* values. Choose one of those and remove the '
			    'others.'		)
		# Only add this once
		new_doc.append({'local': duplicate_key, 'title': titles[0]}		)

	# Add none duplicate-keys
	new_doc.extend([doc for doc in doc_list if 'local' not in counts or counts[doc['local']] == 1]		)
	__lowerCAmelCase      :						Optional[int]						      =				sorted(_UpperCamelCase	,  key=lambda _UpperCamelCase		: s["title"].lower()		)

	# "overview" gets special treatment and is always first
	if len(_UpperCamelCase		) > 1:
		raise ValueError('{doc_list} has two \'overview\' docs which is not allowed.'		)

	overview_doc.extend(_UpperCamelCase		)

	# Sort
	return overview_doc
def    __lowerCAmelCase    (_UpperCamelCase=False		):
	with open(_UpperCamelCase	,  encoding='utf-8'		) as f:
		__lowerCAmelCase      :						Union[str, Any]						      =				yaml.safe_load(f.read()		)

	# Get to the API doc
	__lowerCAmelCase      :						List[Any]						      =				0
	while content[api_idx]["title"] != "API":
		api_idx += 1
	__lowerCAmelCase      :						Any						      =				content[api_idx]['sections']

	# Then to the model doc
	__lowerCAmelCase      :						Any						      =				0
	while api_doc[scheduler_idx]["title"] != "Schedulers":
		scheduler_idx += 1

	__lowerCAmelCase      :						Any						      =				api_doc[scheduler_idx]['sections']
	__lowerCAmelCase      :						Dict						      =				clean_doc_toc(_UpperCamelCase		)

	__lowerCAmelCase      :						Tuple						      =				False
	if new_scheduler_doc != scheduler_doc:
		__lowerCAmelCase      :						Dict						      =				True
		if overwrite:
			__lowerCAmelCase      :						int						      =				new_scheduler_doc

	if diff:
		if overwrite:
			__lowerCAmelCase      :						Optional[Any]						      =				api_doc
			with open(_UpperCamelCase	,  'w'	,  encoding='utf-8'		) as f:
				f.write(yaml.dump(_UpperCamelCase	,  allow_unicode=_UpperCamelCase		)		)
		else:
			raise ValueError(
			    'The model doc part of the table of content is not properly sorted, run `make style` to fix this.'		)
def    __lowerCAmelCase    (_UpperCamelCase=False		):
	with open(_UpperCamelCase	,  encoding='utf-8'		) as f:
		__lowerCAmelCase      :						Dict						      =				yaml.safe_load(f.read()		)

	# Get to the API doc
	__lowerCAmelCase      :						Any						      =				0
	while content[api_idx]["title"] != "API":
		api_idx += 1
	__lowerCAmelCase      :						Dict						      =				content[api_idx]['sections']

	# Then to the model doc
	__lowerCAmelCase      :						List[Any]						      =				0
	while api_doc[pipeline_idx]["title"] != "Pipelines":
		pipeline_idx += 1

	__lowerCAmelCase      :						int						      =				False
	__lowerCAmelCase      :						Union[str, Any]						      =				api_doc[pipeline_idx]['sections']
	__lowerCAmelCase      :						Tuple						      =				[]

	# sort sub pipeline docs
	for pipeline_doc in pipeline_docs:
		if "section" in pipeline_doc:
			__lowerCAmelCase      :						Optional[Any]						      =				pipeline_doc['section']
			__lowerCAmelCase      :						Tuple						      =				clean_doc_toc(_UpperCamelCase		)
			if overwrite:
				__lowerCAmelCase      :						str						      =				new_sub_pipeline_doc
		new_pipeline_docs.append(_UpperCamelCase		)

	# sort overall pipeline doc
	__lowerCAmelCase      :						List[Any]						      =				clean_doc_toc(_UpperCamelCase		)

	if new_pipeline_docs != pipeline_docs:
		__lowerCAmelCase      :						str						      =				True
		if overwrite:
			__lowerCAmelCase      :						Optional[Any]						      =				new_pipeline_docs

	if diff:
		if overwrite:
			__lowerCAmelCase      :						int						      =				api_doc
			with open(_UpperCamelCase	,  'w'	,  encoding='utf-8'		) as f:
				f.write(yaml.dump(_UpperCamelCase	,  allow_unicode=_UpperCamelCase		)		)
		else:
			raise ValueError(
			    'The model doc part of the table of content is not properly sorted, run `make style` to fix this.'		)


if __name__ == "__main__":
							lowerCamelCase__        =		argparse.ArgumentParser()
							parser.add_argument("""--fix_and_overwrite""", action="""store_true""", help="""Whether to fix inconsistencies.""")
							lowerCamelCase__        =		parser.parse_args()

							check_scheduler_doc(args.fix_and_overwrite)
							check_pipeline_doc(args.fix_and_overwrite)

"""simple docstring"""







import qiskit
def    __lowerCAmelCase    (_UpperCamelCase	,  _UpperCamelCase		):
	__lowerCAmelCase      :						Union[str, Any]						      =				qiskit.Aer.get_backend('aer_simulator'		)

	# Create a Quantum Circuit acting on the q register
	__lowerCAmelCase      :						str						      =				qiskit.QuantumCircuit(_UpperCamelCase	,  _UpperCamelCase		)

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

	# Execute the circuit on the simulator
	__lowerCAmelCase      :						Optional[int]						      =				qiskit.execute(_UpperCamelCase	,  _UpperCamelCase	,  shots=1000		)

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


if __name__ == "__main__":
							print(f'Total count for various states are: {single_qubit_measure(1, 1)}')