def _num_qubits_(self) -> int | NotImplementedType:
        """The number of qubits, qudits, or qids this object operates on.

        This method is used by the global `cirq.num_qubits` method (and by
        `cirq.qid_shape` if `_qid_shape_` is not defined.  If this
        method is not present, or returns NotImplemented, it will fallback
        to using the length of `_qid_shape_`.

        Returns:
            An integer specifying the number of qubits, qudits or qids.
        """
The number of qubits, qudits, or qids this object operates on.

        This method is used by the global `cirq.num_qubits` method (and by
        `cirq.qid_shape` if `_qid_shape_` is not defined.  If this
        method is not present, or returns NotImplemented, it will fallback
        to using the length of `_qid_shape_`.

        Returns:
            An integer specifying the number of qubits, qudits or qids.
        
cirq-core/cirq/protocols/qid_shape_protocol.py