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

Fix types / docstrings on DeviceMetadata #4962

Closed
tanujkhattar opened this issue Feb 7, 2022 · 0 comments · Fixed by #4963
Closed

Fix types / docstrings on DeviceMetadata #4962

tanujkhattar opened this issue Feb 7, 2022 · 0 comments · Fixed by #4963
Assignees
Labels
area/devices kind/bug-report Something doesn't seem to work.

Comments

@tanujkhattar
Copy link
Collaborator

Description of the issue

  1. Args say qubits and nx_graph are optional, but their type is not Optional[].

    qubits: Iterable['cirq.Qid'],
    nx_graph: 'nx.graph',
    ):
    """Construct a DeviceMetadata object.
    Args:
    qubits: Optional iterable of `cirq.Qid`s that exist on the device.
    nx_graph: Optional `nx.Graph` describing qubit connectivity

  2. Args say the returned qubit set can be None but return type is not Optional[FrozenSet['cirq.Qid']].

    def qubit_set(self) -> FrozenSet['cirq.Qid']:
    """Returns a set of qubits on the device, if possible.
    Returns:
    Frozenset of qubits on device if specified, otherwise None.
    """

  3. Args say the returned graph can be None but return type is not Optional[nx.Graph].

    def nx_graph(self) -> 'nx.Graph':
    """Returns a nx.Graph where nodes are qubits and edges are couple-able qubits.
    Returns:
    `nx.Graph` of device connectivity if specified, otherwise None.

  4. nx.graph is used as a type instead of nx.Graph -- the former is a module and latter is a type.

    nx_graph: 'nx.graph',

Cirq version

0.14dev

cc @MichaelBroughton

@tanujkhattar tanujkhattar added kind/bug-report Something doesn't seem to work. area/devices labels Feb 7, 2022
@tanujkhattar tanujkhattar changed the title Fix types / docstrings on Devices, DeviceMetadata etc. Fix types / docstrings on DeviceMetadata Feb 7, 2022
CirqBot pushed a commit that referenced this issue Feb 8, 2022
95-martin-orion pushed a commit to 95-martin-orion/Cirq that referenced this issue Mar 2, 2022
rht pushed a commit to rht/Cirq that referenced this issue May 1, 2023
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this issue Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devices kind/bug-report Something doesn't seem to work.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants