# Copyright Quantinuum## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""This module defines an extension for the PyQir SimpleModulefor the needs of generating QIR from Pytket circuits."""frompyqirimportBasicQisBuilder,SimpleModulefrompytket.wasmimportWasmFileHandlerfrom.gatesetsimportPYQIR_GATES
[docs]classtketqirModule:""" PyQir module extension to account for custom defined input gate set and calls to WASM files. """def__init__(self,name:str,num_qubits:int,num_results:int,wasm_handler:WasmFileHandler|None=None,)->None:self.module=SimpleModule(name,num_qubits,num_results)self.builder=self.module.builderself.context=self.module.contextself.qis=BasicQisBuilder(self.builder)self.gateset=PYQIR_GATESself.wasm_handler=wasm_handler