Skip to content

Commit 571c7d5

Browse files
committed
Merge branch 'master' into ku/test
2 parents fcea971 + 4b1c43b commit 571c7d5

9 files changed

Lines changed: 16 additions & 19 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 24.10.0
3+
rev: 26.3.1
44
hooks:
55
- id: black-jupyter
66
log_file: devtools/pre-commit.log

desc/basis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,8 +2012,8 @@ def _jacobi_body_fun(kk, d_p_a_b_x):
20122012

20132013
@_jacobi.defjvp
20142014
def _jacobi_jvp(dx, x, xdot):
2015-
(n, alpha, beta, x) = x
2016-
(*_, xdot) = xdot
2015+
n, alpha, beta, x = x
2016+
*_, xdot = xdot
20172017
f = _jacobi(n, alpha, beta, x, dx)
20182018
df = _jacobi(n, alpha, beta, x, dx + 1)
20192019
# in theory n, alpha, beta, dx aren't differentiable (they're integers)

desc/examples/regenerate_all_equilibria.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
python3 regenerate_all_equilibria.py
66
77
"""
8+
89
import argparse
910
import glob
1011
import os

desc/optimize/_constraint_wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def _set_eq_state_vector(self):
639639
for arg in ["R_lmn", "Z_lmn", "L_lmn", "Ra_n", "Za_n"]:
640640
self._args.remove(arg)
641641

642-
(self._eq_Z, self._eq_D, self._eq_unfixed_idx) = (
642+
self._eq_Z, self._eq_D, self._eq_unfixed_idx = (
643643
self._eq_solve_objective._Z,
644644
self._eq_solve_objective._D,
645645
self._eq_solve_objective._unfixed_idx,

desc/optimize/optimizer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,17 +586,13 @@ def _maybe_wrap_nonlinear_constraints(
586586
)
587587
return objective, nonlinear_constraints
588588
if wrapper is None and not optimizers[method]["equality_constraints"]:
589-
warnings.warn(
590-
FutureWarning(
591-
f"""
589+
warnings.warn(FutureWarning(f"""
592590
Nonlinear constraints detected but method {method} does not support
593591
nonlinear constraints. Defaulting to method "proximal-{method}"
594592
In the future this will raise an error. To ignore this warning, specify
595593
a wrapper "proximal-" to convert the nonlinearly constrained problem
596594
into an unconstrained one.
597-
"""
598-
)
599-
)
595+
"""))
600596
wrapper = "proximal"
601597
if wrapper is not None and wrapper.lower() in ["prox", "proximal"]:
602598
perturb_options = options.pop("perturb_options", {})

desc/vmec.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ def save( # noqa: C901
790790
idx = np.where(eq.R_basis.modes[:, 1] == 0)[0]
791791
R0_n = np.zeros((2 * N + 1,))
792792
for k in idx:
793-
(l, m, n) = eq.R_basis.modes[k, :]
793+
l, m, n = eq.R_basis.modes[k, :]
794794
R0_n[n + N] += (-2 * (l // 2 % 2) + 1) * eq.R_lmn[k]
795795
raxis_cc = file.createVariable("raxis_cc", np.float64, ("n_tor",))
796796
raxis_cc.long_name = "cos(n*p) component of magnetic axis R coordinate"
@@ -807,7 +807,7 @@ def save( # noqa: C901
807807
idx = np.where(eq.Z_basis.modes[:, 1] == 0)[0]
808808
Z0_n = np.zeros((2 * N + 1,))
809809
for k in idx:
810-
(l, m, n) = eq.Z_basis.modes[k, :]
810+
l, m, n = eq.Z_basis.modes[k, :]
811811
Z0_n[n + N] += (-2 * (l // 2 % 2) + 1) * eq.Z_lmn[k]
812812
zaxis_cs = file.createVariable("zaxis_cs", np.float64, ("n_tor",))
813813
zaxis_cs.long_name = "sin(n*p) component of magnetic axis Z coordinate"
@@ -1600,13 +1600,13 @@ def write_vmec_input(cls, eq, fname, header=None, **kwargs): # noqa: C901
16001600
idx = np.where(eq.R_basis.modes[:, 1] == 0)[0]
16011601
R0_n = np.zeros((2 * eq.N + 1,))
16021602
for k in idx:
1603-
(l, m, n) = eq.R_basis.modes[k, :]
1603+
l, m, n = eq.R_basis.modes[k, :]
16041604
R0_n[n + eq.N] += (-2 * (l // 2 % 2) + 1) * eq.R_lmn[k]
16051605
# Z axis
16061606
idx = np.where(eq.Z_basis.modes[:, 1] == 0)[0]
16071607
Z0_n = np.zeros((2 * eq.N + 1,))
16081608
for k in idx:
1609-
(l, m, n) = eq.Z_basis.modes[k, :]
1609+
l, m, n = eq.Z_basis.modes[k, :]
16101610
Z0_n[n + eq.N] += (-2 * (l // 2 % 2) + 1) * eq.Z_lmn[k]
16111611
# R axis cosine coefficients
16121612
f.write(" RAXIS_CC = ")

devtools/dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sphinx-design
1919

2020

2121
# linting
22-
black[jupyter] == 24.10.0
22+
black[jupyter] == 26.3.1
2323
flake8 ~= 7.3
2424
flake8-docstrings >= 1.0.0, <= 1.7.0
2525
flake8-eradicate >= 1.0.0, <= 1.5.0

tests/test_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ def test_regcoil_windowpane_check_B(regcoil_windowpane_coils):
16051605
@pytest.mark.slow
16061606
def test_regcoil_PF_check_B(regcoil_PF_coils):
16071607
"""Test precise QA PF (helicity=(0,2)) regcoil solution."""
1608-
(data, surface_current_field, eq) = regcoil_PF_coils
1608+
data, surface_current_field, eq = regcoil_PF_coils
16091609
assert surface_current_field.G == 0
16101610
assert abs(surface_current_field.I) > 0
16111611
chi_B = data["chi^2_B"][0]
@@ -1629,7 +1629,7 @@ def test_regcoil_helical_coils_check_objective_method(
16291629
regcoil_helical_coils_scan,
16301630
):
16311631
"""Test precise QA helical coil regcoil solution."""
1632-
(data, initial_surface_current_field, eq) = regcoil_helical_coils_scan
1632+
data, initial_surface_current_field, eq = regcoil_helical_coils_scan
16331633
lam_index = 1
16341634
lam = data["lambda_regularization"][lam_index]
16351635
initial_surface_current_field.Phi_mn = data["Phi_mn"][lam_index]

tests/test_surfaces.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_constant_offset_surface_circle(self):
151151
s = FourierRZToroidalSurface()
152152
grid = LinearGrid(M=3, N=2)
153153
offset = 1
154-
(s_offset, data, _) = s.constant_offset_surface(
154+
s_offset, data, _ = s.constant_offset_surface(
155155
offset, grid, M=1, N=1, full_output=True
156156
)
157157
r_offset_surf = data["x_offset_surface"]
@@ -260,7 +260,7 @@ def test_constant_offset_surface_rot_ellipse(self):
260260
s = eq.surface
261261
s.change_resolution(M=2, N=2)
262262
offset = 0.1
263-
(s_offset, data, _) = s.constant_offset_surface(
263+
s_offset, data, _ = s.constant_offset_surface(
264264
offset, grid=None, M=2, N=2, full_output=True
265265
)
266266
r_offset_surf = data["x_offset_surface"]

0 commit comments

Comments
 (0)