

import qiskit

def 						UpperCamelCase					(lowercase_: int    ,      lowercase_: int					)     ->      qiskit.result.counts.Counts:
	A__							:    List[Any]        =		qiskit.Aer.get_backend("""aer_simulator"""					)

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

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

	# Execute the circuit on the simulator
	A__							:    List[Any]        =		qiskit.execute(lowercase_    ,      lowercase_    ,      shots=1000					)

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


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






import argparse
from collections import defaultdict

import yaml


A_       : List[str]         =			'docs/source/en/_toctree.yml'

def 						UpperCamelCase					(lowercase_: Optional[int]					)     ->      List[str]:
	A__							:    Dict        =		defaultdict(lowercase_					)
	A__							:    Optional[int]        =		[]
	A__							:    Union[str, Any]        =		[]
	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(lowercase_					)

	A__							:    Optional[int]        =		new_doc_list
	A__							:    Optional[int]        =		[key for key, value in counts.items() if value > 1]

	A__							:    Optional[Any]        =		[]
	for duplicate_key in duplicates:
		A__							:    List[Any]        =		list({doc["""title"""] for doc in doc_list if doc["""local"""] == duplicate_key}					)
		if len(lowercase_					) > 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]					)
	A__							:    Dict        =		sorted(lowercase_    ,      key=lambda lowercase_					: s["title"].lower()					)

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

	overview_doc.extend(lowercase_					)

	# Sort
	return overview_doc

def 						UpperCamelCase					(lowercase_: Tuple=False					)     ->      List[Any]:
	with open(lowercase_    ,      encoding="""utf-8"""					) as f:
		A__							:    Dict        =		yaml.safe_load(f.read()					)

	# Get to the API doc
	A__							:    List[Any]        =		0
	while content[api_idx]["title"] != "API":
		api_idx += 1
	A__							:    Union[str, Any]        =		content[api_idx]["""sections"""]

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

	A__							:    List[Any]        =		api_doc[scheduler_idx]["""sections"""]
	A__							:    Union[str, Any]        =		clean_doc_toc(lowercase_					)

	A__							:    Optional[int]        =		False
	if new_scheduler_doc != scheduler_doc:
		A__							:    List[Any]        =		True
		if overwrite:
			A__							:    Optional[int]        =		new_scheduler_doc

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

def 						UpperCamelCase					(lowercase_: Dict=False					)     ->      Optional[Any]:
	with open(lowercase_    ,      encoding="""utf-8"""					) as f:
		A__							:    int        =		yaml.safe_load(f.read()					)

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

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

	A__							:    Dict        =		False
	A__							:    Tuple        =		api_doc[pipeline_idx]["""sections"""]
	A__							:    Tuple        =		[]

	# sort sub pipeline docs
	for pipeline_doc in pipeline_docs:
		if "section" in pipeline_doc:
			A__							:    List[Any]        =		pipeline_doc["""section"""]
			A__							:    Dict        =		clean_doc_toc(lowercase_					)
			if overwrite:
				A__							:    Optional[Any]        =		new_sub_pipeline_doc
		new_pipeline_docs.append(lowercase_					)

	# sort overall pipeline doc
	A__							:    Optional[int]        =		clean_doc_toc(lowercase_					)

	if new_pipeline_docs != pipeline_docs:
		A__							:    int        =		True
		if overwrite:
			A__							:    List[Any]        =		new_pipeline_docs

	if diff:
		if overwrite:
			A__							:    Union[str, Any]        =		api_doc
			with open(lowercase_    ,      """w"""    ,      encoding="""utf-8"""					) as f:
				f.write(yaml.dump(lowercase_    ,      allow_unicode=lowercase_					)					)
		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__":
	A_       : str         =			argparse.ArgumentParser()
	parser.add_argument('--fix_and_overwrite', action='store_true', help='Whether to fix inconsistencies.')
	A_       : str         =			parser.parse_args()

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



