diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34799a4..cab6a90 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/oommfc/scripts/driver.py b/oommfc/scripts/driver.py index a85a12b..7410b99 100644 --- a/oommfc/scripts/driver.py +++ b/oommfc/scripts/driver.py @@ -23,7 +23,7 @@ def driver_script( # Fixed spins if fixed_subregions is not None: - resstr = f'{{main_atlas {" ".join(fixed_subregions)}}}' + resstr = f"{{main_atlas {' '.join(fixed_subregions)}}}" driver.evolver.fixed_spins = resstr mif += oc.scripts.evolver_script(driver.evolver) @@ -70,7 +70,7 @@ def driver_script( # Fixed spins if fixed_subregions is not None: - resstr = f'{{main_atlas {" ".join(fixed_subregions)}}}' + resstr = f"{{main_atlas {' '.join(fixed_subregions)}}}" driver.evolver.fixed_spins = resstr # What is saved in output? @@ -177,7 +177,7 @@ def driver_script( # Fixed spins if fixed_subregions is not None: - resstr = f'{{main_atlas {" ".join(fixed_subregions)}}}' + resstr = f"{{main_atlas {' '.join(fixed_subregions)}}}" driver.evolver.fixed_spins = resstr mif += oc.scripts.evolver_script(driver.evolver, **kwargs) @@ -192,7 +192,7 @@ def driver_script( mif += " mesh :mesh\n" mif += " Ms :m0_norm\n" mif += " m0 :m0\n" - mif += f" stopping_time {t/n}\n" + mif += f" stopping_time {t / n}\n" mif += f" stage_count {n}\n" for attr, value in driver: if attr != "evolver": diff --git a/oommfc/scripts/energy.py b/oommfc/scripts/energy.py index dbf0950..113124c 100644 --- a/oommfc/scripts/energy.py +++ b/oommfc/scripts/energy.py @@ -196,8 +196,8 @@ def zeeman_script(term, system): mif += f"proc TimeFunction:{term.name} {{ total_time }} {{\n" mif += f" set tstep {term.dt}\n" mif += " set index [expr round($total_time/$tstep)]\n" - mif += f' set H_t_fac {{ {" ".join(map(str, term.tlist))} }}\n' - mif += f' set dH_t_fac {{ {" ".join(map(str, term.dtlist))} }}\n' + mif += f" set H_t_fac {{ {' '.join(map(str, term.tlist))} }}\n" + mif += f" set dH_t_fac {{ {' '.join(map(str, term.dtlist))} }}\n" mif += " set H_fac [lindex $H_t_fac $index]\n" mif += " set dH_fac [lindex $dH_t_fac $index]\n" mif += f" set Hx [expr {{ {term.H[0]}*$H_fac }}]\n" @@ -216,9 +216,9 @@ def zeeman_script(term, system): mif += "}\n\n" elif isinstance(term.tcl_strings, dict): mif += term.tcl_strings["script"] - mif += f'\n# {term.tcl_strings["energy"][4:]}\n' # 3.9 removeprefix - mif += f'Specify {term.tcl_strings["energy"]}:{term.name} {{\n' - mif += f' script {term.tcl_strings["script_name"]}\n' + mif += f"\n# {term.tcl_strings['energy'][4:]}\n" # 3.9 removeprefix + mif += f"Specify {term.tcl_strings['energy']}:{term.name} {{\n" + mif += f" script {term.tcl_strings['script_name']}\n" for key in ["type", "script_args"]: with contextlib.suppress(KeyError): mif += f" {key} {term.tcl_strings[key]}\n" diff --git a/oommfc/scripts/evolver.py b/oommfc/scripts/evolver.py index 2890b40..cc8237a 100644 --- a/oommfc/scripts/evolver.py +++ b/oommfc/scripts/evolver.py @@ -77,7 +77,7 @@ def evolver_script(evolver, **kwargs): mif += "proc TimeFunction { total_time } {\n" mif += f" set tstep {evolver.dt}\n" mif += " set index [expr round($total_time/$tstep)]\n" - mif += f' set profile {{ {" ".join(map(str, tlist))} }}\n' + mif += f" set profile {{ {' '.join(map(str, tlist))} }}\n" mif += " set factor [lindex $profile $index]\n" mif += " return $factor\n" mif += "}\n\n"