# Les portes natives de trois fake backends
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit_ibm_runtime.fake_provider import FakeFez, FakeSherbrooke

# Instructions qui ne sont pas des portes : mesure, remise à zéro, attente, contrôle de flux
NOT_GATES = {"measure", "reset", "delay", "if_else", "for_loop", "switch_case", "while_loop"}


def gates(backend):
    return ", ".join(sorted(set(backend.operation_names) - NOT_GATES))


generic = GenericBackendV2(num_qubits=5, seed=42)
print(f"{generic.name} (machine générique) : {gates(generic)}")

for backend in (FakeFez(), FakeSherbrooke()):
    family = backend.configuration().processor_type["family"]
    print(f"{backend.name} ({family}, {backend.num_qubits} qubits) : {gates(backend)}")

others = sorted(set(FakeFez().operation_names) & NOT_GATES)
print("Autres instructions de fake_fez :", ", ".join(others))
