예제 #1
0
    def is_available(self, cmd: ProjectQCommand) -> bool:
        """
        Ask the next engine whether a command is available, i.e.,
        whether it can be executed by the next engine(s).

        :raises LastEngineException: If is_last_engine is True but is_available is not
            implemented.

        :param cmd: Command for which to check availability.

        :return: True if the command can be executed.
        """
        try:
            return bool(BasicEngine.is_available(self, cmd))
        except LastEngineException:
            return True
예제 #2
0
    def is_available(self, cmd):
        """
        Specialized implementation of is_available: Returns True if the
        CircuitDrawer is the last engine (since it can print any command).

        Args:
            cmd (Command): Command for which to check availability (all
                Commands can be printed).
        Returns:
            availability (bool): True, unless the next engine cannot handle
            the Command (if there is a next engine).
        """
        try:
            return BasicEngine.is_available(self, cmd)
        except LastEngineException:
            return True
예제 #3
0
    def is_available(self, cmd):
        """
        Test whether a Command is supported by a compiler engine.

        Specialized implementation of is_available: Returns True if the ResourceCounter is the last engine (since it
        can count any command).

        Args:
            cmd (Command): Command for which to check availability (all Commands can be counted).

        Returns:
            availability (bool): True, unless the next engine cannot handle the Command (if there is a next engine).
        """
        try:
            return BasicEngine.is_available(self, cmd)
        except LastEngineException:
            return True
예제 #4
0
    def is_available(self,cmd):
        """
        Ask the next engine whether a command is available, i.e.,
        whether it can be executed by the next engine(s).

        Args:
            cmd (Command): Command for which to check availability.

        Returns:
            True if the command can be executed.

        Raises:
            LastEngineException: 
            If is_last_engine is True but is_available is not implemented.
        """
        try:
            return BasicEngine.is_available(self, cmd)
        except LastEngineException:
            return True
    def is_available(self, cmd):
        """
        Test whether a Command is supported by a compiler engine.

        Specialized implementation of is_available: Returns True if the CircuitDrawerMatplotlib is the last engine
        (since it can print any command).

        Args:
            cmd (Command): Command for which to check availability (all Commands can be printed).

        Returns:
            availability (bool): True, unless the next engine cannot handle the Command (if there is a next engine).
        """
        try:
            # Multi-qubit gates may fail at drawing time if the target qubits
            # are not right next to each other on the output graphic.
            return BasicEngine.is_available(self, cmd)
        except LastEngineException:
            return True
예제 #6
0
 def is_available(self, cmd):
     try:
         return BasicEngine.is_available(self, cmd)
     except LastEngineException:
         return True