Skip to content

Commit

Permalink
numpy v2 updates from ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Jun 17, 2024
1 parent f3dc6c0 commit 2997aa3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ max_line_length = 79
[tool.ruff]
line-length = 79
target-version = "py38"
ignore = ["E741"]
lint.ignore = ["E741"]

[tool.black]
line-length = 79
Expand Down
4 changes: 2 additions & 2 deletions quimb/gen/rand.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ def rand_rademacher(shape, scale=1, loc=0.0, dtype=float):
""" """
if np.issubdtype(dtype, np.floating):
entries = loc + np.array([1.0, -1.0]) * scale
need2convert = dtype not in (float, np.float_)
need2convert = dtype not in (float, np.float64)

elif np.issubdtype(dtype, np.complexfloating):
entries = loc + np.array([1.0, -1.0, 1.0j, -1.0j]) * scale
need2convert = dtype not in (complex, np.complex_)
need2convert = dtype not in (complex, np.complex128)

else:
raise TypeError(
Expand Down
2 changes: 1 addition & 1 deletion quimb/linalg/slepc_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_slepc(comm=None):
class PetscLinearOperatorContext:
def __init__(self, lo):
self.lo = lo
self.real = lo.dtype in (float, np.float_)
self.real = lo.dtype in (float, np.float64)

def mult(self, _, x, y):
y[:] = self.lo.matvec(x)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_sparse_convert_to_dop(self):
)
@mark.parametrize("format_in", stypes)
@mark.parametrize("format_out", (None,) + stypes)
@mark.parametrize("dtype", [float, complex, np.float_, np.complex_])
@mark.parametrize("dtype", [float, complex, np.float64, np.complex128])
def test_reshape_sparse(
self, qtype, shape, out, format_in, format_out, dtype
):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tensor/test_tensor_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def test_direct_product_triple(self):

@pytest.mark.parametrize(
"dtype",
[float, complex, np.complex128, np.float_, np.float32, "raise"],
[float, complex, np.complex128, np.float64, np.float32, "raise"],
)
def test_rand_tensor(self, dtype):
if dtype == "raise":
Expand Down

0 comments on commit 2997aa3

Please sign in to comment.