跳转至

BasicInterface

QuICT.tools.interface.basic_interface.BasicInterface

BasicInterface()

Bases: object

the basic interface of general processor

these interface is devoted to make out circuit more general, for example, mutual conversion with qiskit code or OpenQASM 2.0 code.

the function "load_circuit" and "load_file" should be overloaded

Attributes:

  • circuit(Circuit)

    the circuit in our framework

  • text_content

    another form content

Source code in QuICT/tools/interface/basic_interface.py
def __init__(self):
    self.circuit = None
    self.text_content = None

load_circuit staticmethod

load_circuit(circuit: Circuit)

load the circuit from our framework

Parameters:

  • circuit(Circuit)

    the circuit to be loaded

Source code in QuICT/tools/interface/basic_interface.py
@staticmethod
def load_circuit(circuit: Circuit):
    """ load the circuit from our framework

    Args:
        circuit(Circuit): the circuit to be loaded

    """
    instance = BasicInterface()
    instance.circuit = circuit
    return instance

load_file staticmethod

load_file(filename: str)

load the content from our file

Parameters:

  • filename(str)

    filename

Source code in QuICT/tools/interface/basic_interface.py
@staticmethod
def load_file(filename: str):
    """ load the content from our file

    Args:
        filename(str): filename

    """
    instance = BasicInterface()
    with open(filename) as file:
        instance.text_content = file.read()
    return instance