diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34799a4f..cab6a900 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,14 @@ exclude: 'dev' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-merge-conflict # checks for files that contain merge conflict strings - id: check-toml # checks toml files for parseable syntax - id: debug-statements # checks for debugger imports and py37+ `breakpoint()` calls in python source - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 + rev: v0.9.3 hooks: # Run the linter. - id: ruff diff --git a/discretisedfield/io/ovf.py b/discretisedfield/io/ovf.py index 846802a4..c53600e8 100644 --- a/discretisedfield/io/ovf.py +++ b/discretisedfield/io/ovf.py @@ -61,9 +61,9 @@ def _to_ovf( # Desc: File generated by Field class # meshunit: {self.mesh.region.units[0]} # meshtype: rectangular - # xbase: {self.mesh.region.pmin[0] + self.mesh.cell[0]/2} - # ybase: {self.mesh.region.pmin[1] + self.mesh.cell[1]/2} - # zbase: {self.mesh.region.pmin[2] + self.mesh.cell[2]/2} + # xbase: {self.mesh.region.pmin[0] + self.mesh.cell[0] / 2} + # ybase: {self.mesh.region.pmin[1] + self.mesh.cell[1] / 2} + # zbase: {self.mesh.region.pmin[2] + self.mesh.cell[2] / 2} # xnodes: {self.mesh.n[0]} # ynodes: {self.mesh.n[1]} # znodes: {self.mesh.n[2]} @@ -172,7 +172,7 @@ def _from_ovf(cls, filename): # >>> READ DATA <<< if mode == "binary": # OVF2 uses little-endian and OVF1 uses big-endian - format = f'{"<" if ovf_v2 else ">"}{"d" if nbytes == 8 else "f"}' + format = f"{'<' if ovf_v2 else '>'}{'d' if nbytes == 8 else 'f'}" test_value = struct.unpack(format, f.read(nbytes))[0] check = {4: 1234567.0, 8: 123456789012345.0} diff --git a/discretisedfield/plotting/util.py b/discretisedfield/plotting/util.py index 62997ccd..365c3c3a 100644 --- a/discretisedfield/plotting/util.py +++ b/discretisedfield/plotting/util.py @@ -143,5 +143,5 @@ def _pyvista_save_to_file(filename, plotter): else: raise ValueError( f"{extension} extension is not supported. The supported formats are" - f" {', '.join(screenshot+graphic)}." + f" {', '.join(screenshot + graphic)}." ) diff --git a/discretisedfield/tests/test_plotting.py b/discretisedfield/tests/test_plotting.py index f36a1693..d6c1990f 100644 --- a/discretisedfield/tests/test_plotting.py +++ b/discretisedfield/tests/test_plotting.py @@ -34,9 +34,9 @@ def test_pyvista_valid_filename_extensions_screenshot(extension): try: plot_util._pyvista_save_to_file(filename, plotter) - assert os.path.exists( - filename - ), f"File with extension {extension} was not created." + assert os.path.exists(filename), ( + f"File with extension {extension} was not created." + ) finally: os.remove(filename) @@ -56,8 +56,8 @@ def test_pyvista_valid_filename_extensions_save_graphic(extension): try: plot_util._pyvista_save_to_file(filename, plotter) - assert os.path.exists( - filename - ), f"File with extension {extension} was not created." + assert os.path.exists(filename), ( + f"File with extension {extension} was not created." + ) finally: os.remove(filename)