Skip to content

Commit

Permalink
fix: backport mypy updates to legacy code locations
Browse files Browse the repository at this point in the history
  • Loading branch information
mrossinek committed Jun 8, 2023
1 parent 22f9c16 commit c51eaa4
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -111,7 +111,7 @@ def __init__(

self._boundary_condition = boundary_condition

graph = PyGraph(multigraph=False)
graph: PyGraph = PyGraph(multigraph=False)
graph.add_nodes_from(range(np.prod(size)))

# add edges excluding the boundary edges
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -19,7 +19,8 @@

import numpy as np

from rustworkx import NodeIndices, PyGraph, WeightedEdgeList, adjacency_matrix, networkx_converter
from rustworkx import NodeIndices, PyGraph, WeightedEdgeList
from rustworkx import adjacency_matrix, networkx_converter # type: ignore[attr-defined]
from rustworkx.visualization import mpl_draw

from qiskit.utils import optionals as _optionals
Expand Down Expand Up @@ -183,7 +184,7 @@ def from_nodes_and_edges(
Returns:
Lattice generated from lists of nodes and edges.
"""
graph = PyGraph(multigraph=False)
graph: PyGraph = PyGraph(multigraph=False)
graph.add_nodes_from(range(num_nodes))
graph.add_edges_from(weighted_edges)
return cls(graph)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -209,7 +209,7 @@ def __init__(
self.edge_parameter = edge_parameter
self.onsite_parameter = onsite_parameter

graph = PyGraph(multigraph=False)
graph: PyGraph = PyGraph(multigraph=False)
graph.add_nodes_from(range(np.prod(self.size)))

# add edges excluding the boundary edges
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -75,7 +75,7 @@ def _generate_lattice_from_parameters(interaction_matrix: np.ndarray):
"It must be a square matrix."
)

graph = PyGraph(multigraph=False)
graph: PyGraph = PyGraph(multigraph=False)
graph.add_nodes_from(range(shape[0]))
for source_index in range(shape[0]):
for target_index in range(source_index, shape[0]):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -14,7 +14,7 @@
from test import QiskitNatureTestCase
import numpy as np
from numpy.testing import assert_array_equal
from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]
from qiskit_nature.problems.second_quantization.lattice import (
BoundaryCondition,
HyperCubicLattice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -17,7 +17,7 @@
import numpy as np
from numpy.testing import assert_array_equal

from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]

from qiskit.utils import optionals as _optionals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -14,7 +14,7 @@
from test import QiskitNatureTestCase
from numpy.testing import assert_array_equal
import numpy as np
from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]
from qiskit_nature.problems.second_quantization.lattice import (
BoundaryCondition,
LineLattice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -14,7 +14,7 @@
from test import QiskitNatureTestCase
from numpy.testing import assert_array_equal
import numpy as np
from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]
from qiskit_nature.problems.second_quantization.lattice import (
BoundaryCondition,
SquareLattice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -14,7 +14,7 @@
from test import QiskitNatureTestCase
from numpy.testing import assert_array_equal
import numpy as np
from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]
from qiskit_nature.problems.second_quantization.lattice import (
BoundaryCondition,
TriangularLattice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -15,7 +15,7 @@

import numpy as np
from numpy.testing import assert_array_equal
from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]

from qiskit_nature.problems.second_quantization.lattice import FermiHubbardModel, Lattice

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -17,7 +17,7 @@

import numpy as np
from numpy.testing import assert_array_equal
from rustworkx import PyGraph, is_isomorphic
from rustworkx import PyGraph, is_isomorphic # type: ignore[attr-defined]

from qiskit_nature.problems.second_quantization.lattice import IsingModel, Lattice

Expand Down

0 comments on commit c51eaa4

Please sign in to comment.