diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a19f732..6adac249 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,11 +28,11 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.19.0 + rev: v3.19.1 hooks: - id: pyupgrade - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.2 + rev: v0.9.7 hooks: - id: ruff types_or: [ python, pyi, jupyter ] diff --git a/src/pydrex/io.py b/src/pydrex/io.py index 7ccad9de..b903a0e7 100644 --- a/src/pydrex/io.py +++ b/src/pydrex/io.py @@ -102,7 +102,7 @@ def extract_h5part( strains[t] = f[f"{k}/CPO_{n_grains * 10 + 1}"][particle_id - 1] vals = np.empty(n_grains * 10) for n in range(len(vals)): - vals[n] = f[f"{k}/CPO_{n+1}"][particle_id - 1] + vals[n] = f[f"{k}/CPO_{n + 1}"][particle_id - 1] orientations[t] = np.array( [ @@ -456,7 +456,7 @@ def parse_config(path): # Use provided name or set randomized default. toml["name"] = toml.get( - "name", f"pydrex.{np.random.default_rng().integers(1,1e10)}" + "name", f"pydrex.{np.random.default_rng().integers(1, 1e10)}" ) toml["parameters"] = _parse_config_params(toml) diff --git a/src/pydrex/visualisation.py b/src/pydrex/visualisation.py index fc2cad00..70abdde4 100644 --- a/src/pydrex/visualisation.py +++ b/src/pydrex/visualisation.py @@ -32,7 +32,7 @@ def default_tick_formatter(x, pos): - return f"{x/1e3:.1f}" + return f"{x / 1e3:.1f}" def polefigures( diff --git a/tests/test_corner_flow_2d.py b/tests/test_corner_flow_2d.py index 02415e07..e3be632b 100644 --- a/tests/test_corner_flow_2d.py +++ b/tests/test_corner_flow_2d.py @@ -176,7 +176,7 @@ def test_steady4(self, outdir, seed, ncpus): _log.debug("Total walltime: %s", perf_counter() - _begin) if outdir is not None: - labels.append(rf"$z_{{f}}$ = {z_exit/1e3:.1f} km") + labels.append(rf"$z_{{f}}$ = {z_exit / 1e3:.1f} km") angles.append(misorient_angles) indices.append(misorient_indices) paths.append(positions) diff --git a/tests/test_diagnostics.py b/tests/test_diagnostics.py index 294a6a6a..5216f2b4 100644 --- a/tests/test_diagnostics.py +++ b/tests/test_diagnostics.py @@ -333,9 +333,9 @@ def test_textures_increasing_ortho(self, seed): M_vals[i] = _diagnostics.misorientation_index( orientations, _geo.LatticeSystem.orthorhombic ) - assert np.all( - np.diff(M_vals) >= 0 - ), f"M-index values {M_vals} are not increasing" + assert np.all(np.diff(M_vals) >= 0), ( + f"M-index values {M_vals} are not increasing" + ) def test_texture_girdle_ortho(self, seed): """Test M-index for girdled texture."""