qiskit/converters/ast_to_dag.py
def _process_bit_id(self, node):
        """Process an Id or IndexedId node as a bit or register type.

        Return a list of tuples (Register,index).
        """
        # pylint: disable=inconsistent-return-statements
        reg = None
        if node.name in self.dag.qregs:
            reg = self.dag.qregs[node.name]
        elif node.name in self.dag.cregs:
            reg = self.dag.cregs[node.name]
        else:
            raise QiskitError("expected qreg or creg name:",
                              "line=%s" % node.line,
                              "file=%s" % node.file)

        if node.type == "indexed_id":
            # An indexed bit or qubit
            return [(reg, node.index)]
        elif node.type == "id":
            # A qubit or qreg or creg
            if not self.bit_stack[-1]:
                # Global scope
                return [(reg, j) for j in range(reg.size)]
            else:
                # local scope
                if node.name in self.bit_stack[-1]:
                    return [self.bit_stack[-1][node.name]]
                raise QiskitError("expected local bit name:",
                                  "line=%s" % node.line,
                                  "file=%s" % node.file)
        return None
def _process_bit_id(self, node):
        # pylint: disable=inconsistent-return-statements
        reg = None
        if node.name in self.dag.qregs:
            reg = self.dag.qregs[node.name]
        elif node.name in self.dag.cregs:
            reg = self.dag.cregs[node.name]
        else:
            raise QiskitError("expected qreg or creg name:",
                              "line=%s" % node.line,
                              "file=%s" % node.file)

        if node.type == "indexed_id":
            # An indexed bit or qubit
            return [(reg, node.index)]
        elif node.type == "id":
            # A qubit or qreg or creg
            if not self.bit_stack[-1]:
                # Global scope
                return [(reg, j) for j in range(reg.size)]
            else:
                # local scope
                if node.name in self.bit_stack[-1]:
                    return [self.bit_stack[-1][node.name]]
                raise QiskitError("expected local bit name:",
                                  "line=%s" % node.line,
                                  "file=%s" % node.file)
        return None
def _process_bit_id ( self , node ) : # pylint: disable=inconsistent-return-statements reg = None if node . name in self . dag . qregs : reg = self . dag . qregs [ node . name ] elif node . name in self . dag . cregs : reg = self . dag . cregs [ node . name ] else : raise QiskitError ( "expected qreg or creg name:" , "line=%s" % node . line , "file=%s" % node . file ) if node . type == "indexed_id" : # An indexed bit or qubit return [ ( reg , node . index ) ] elif node . type == "id" : # A qubit or qreg or creg if not self . bit_stack [ - 1 ] : # Global scope return [ ( reg , j ) for j in range ( reg . size ) ] else : # local scope if node . name in self . bit_stack [ - 1 ] : return [ self . bit_stack [ - 1 ] [ node . name ] ] raise QiskitError ( "expected local bit name:" , "line=%s" % node . line , "file=%s" % node . file ) return None
Process an Id or IndexedId node as a bit or register type.

        Return a list of tuples (Register,index).
Process an Id or IndexedId node as a bit or register type .