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

Remove unneeded casts #1144

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/operators/fermionic_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import re
from collections import defaultdict
from collections.abc import Collection, Mapping
from typing import cast, Iterator
from typing import Iterator

import numpy as np
from scipy.sparse import csc_matrix
Expand Down Expand Up @@ -244,8 +244,7 @@ def from_polynomial_tensor(cls, tensor: PolynomialTensor) -> FermionicOp:

for key in tensor:
if key == "":
# TODO: deal with complexity
data[""] = cast(float, tensor[key])
data[""] = tensor[key]
continue

mat = tensor[key]
Expand Down
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/operators/spin_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import re
from collections.abc import Collection, Mapping
from collections import defaultdict
from typing import cast, Iterator
from typing import Iterator
from fractions import Fraction
from functools import partial, reduce

Expand Down Expand Up @@ -300,8 +300,7 @@ def from_polynomial_tensor(cls, tensor: PolynomialTensor) -> SpinOp:

for key in tensor:
if key == "":
# TODO: deal with complexity
data[""] = cast(float, tensor[key])
data[""] = tensor[key]
continue

mat = tensor[key]
Expand Down
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/operators/vibrational_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import re
from collections import defaultdict
from collections.abc import Collection, Mapping
from typing import Iterator, Sequence, Tuple, cast
from typing import Iterator, Sequence, Tuple
import logging
import operator
import itertools
Expand Down Expand Up @@ -284,8 +284,7 @@ def _reshape_index(index):

for key in tensor:
if key == "":
# TODO: deal with complexity
data[""] = cast(float, tensor[key])
data[""] = tensor[key]
continue

mat = tensor[key]
Expand Down