Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAGCircuit Documentation types outdated #2820

Closed
eddieschoute opened this issue Jul 19, 2019 · 4 comments · Fixed by #2978
Closed

DAGCircuit Documentation types outdated #2820

eddieschoute opened this issue Jul 19, 2019 · 4 comments · Fixed by #2978
Assignees
Labels
documentation Something is not clear or an error documentation good first issue Good for newcomers
Milestone

Comments

@eddieschoute
Copy link
Contributor

Information

The documentation of DAGCircuit still references tuples instead of the QuantumRegisters as input type for wires and qargs. This does not work any more.

  • Qiskit Terra version: 0.8.2
  • Python version: 3.7.4
  • Operating system: macOS 10.14

What is the current behavior?

An excerpt from the current documentation:

    def apply_operation_back(self, op, qargs=None, cargs=None, condition=None):
        """Apply an operation to the output of the circuit.

        Args:
            op (Instruction): the operation associated with the DAG node
            qargs (list[tuple]): qubits that op will be applied to
            cargs (list[tuple]): cbits that op will be applied to
            condition (tuple or None): optional condition (ClassicalRegister, int)

        Returns:
            DAGNode: the current max node

        Raises:
            DAGCircuitError: if a leaf node is connected to multiple outputs

        """

which lists tuples as expected type.

@kdk kdk added the documentation Something is not clear or an error documentation label Jul 19, 2019
@kdk kdk added this to the 0.9 milestone Jul 19, 2019
@1ucian0 1ucian0 added the good first issue Good for newcomers label Jul 19, 2019
@mtreinish
Copy link
Member

I just took a look at the current master docstring for apply_operation_back() and it is correctly listing the input type as a list of Qubit objects and Clbit objects: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/dagcircuit/dagcircuit.py#L239-L254 @eddieschoute what do you think we need here? We can update the docstring to include more exposition on the docstring to try and make it clearer (it's a bit terse now). But nothing there looks wrong to me.

If it's just a matter of the hosted documentation and pip release not being up to date, that will get corrected automatically after we release 0.9 with the bit classes. They didn't exist in 0.8.x so the published documentation is correct for the released version.

@eddieschoute
Copy link
Contributor Author

I checked out the latest version and you're right about apply_operation_back, however, apply_operation_front still has the old description, see https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/dagcircuit/dagcircuit.py#L285.

@eddieschoute
Copy link
Contributor Author

It also looks like compose_back still uses the old language, see https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/dagcircuit/dagcircuit.py#L437. I suspect this should be qubits or quantum registers that are being connected by edge_map.

@mtreinish
Copy link
Member

mtreinish commented Aug 13, 2019

Sorry for the slow response. On taking another look at this the edge_map case is actually a bit weird. Looking at the code which actually consumes the argument _check_edgemap_registers() and _check_wiremap_validity() in It looks like the key is still a tuple of (register, index) (although they can be bit classes too because the access patterns from tuples were preserved with deprecated functions on the new classes) but the values are the bit classes (either Qubit or Clbit). I'll update the docs for both compose_back() and apply_operation_front() shortly.

mtreinish added a commit to mtreinish/qiskit-core that referenced this issue Aug 13, 2019
With the introduction of the Bit classes in Qiskit#2414 the arguments for
many of the methods in the DAGCircuit class, which often deal with
individual bits, were changed to deal with these new classes instead of
tuples. However, in that process a couple of docstrings were missed and
not updated to reflect the expected types. This commit corrects the
oversight and updates the docstrings for those cases.

Fixes Qiskit#2820
ajavadia pushed a commit that referenced this issue Aug 14, 2019
* Update dagcircuit docstrings for bit class arguments

With the introduction of the Bit classes in #2414 the arguments for
many of the methods in the DAGCircuit class, which often deal with
individual bits, were changed to deal with these new classes instead of
tuples. However, in that process a couple of docstrings were missed and
not updated to reflect the expected types. This commit corrects the
oversight and updates the docstrings for those cases.

Fixes #2820

* Update one more docstring and error message access
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this issue Aug 5, 2020
* Update dagcircuit docstrings for bit class arguments

With the introduction of the Bit classes in Qiskit#2414 the arguments for
many of the methods in the DAGCircuit class, which often deal with
individual bits, were changed to deal with these new classes instead of
tuples. However, in that process a couple of docstrings were missed and
not updated to reflect the expected types. This commit corrects the
oversight and updates the docstrings for those cases.

Fixes Qiskit#2820

* Update one more docstring and error message access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Something is not clear or an error documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants