Skip to content

Commit

Permalink
refactor: remove "include" option for global ruff format/check (#2065)
Browse files Browse the repository at this point in the history
- Remove Ruff's "include" option to check all the files in the repo
- Apply the changes from ruff format / check for the new files that were previously not included
- Upgrade the Python version from py37 to py39, which applies a few minor changes, e.g. autotest/test_gwf_multimvr.py
- Ignore long lines (E501) in "doc/**.ipynb" files, and module import not at top of file (E402) for .build_rtd_docs/conf.py
  • Loading branch information
mwtoews authored Nov 19, 2024
1 parent 68f7f87 commit c29763a
Show file tree
Hide file tree
Showing 11 changed files with 351 additions and 289 deletions.
4 changes: 3 additions & 1 deletion .build_rtd_docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: E402
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
Expand All @@ -14,7 +15,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import sys
from subprocess import Popen, PIPE
from subprocess import PIPE, Popen

sys.path.insert(0, os.path.abspath(os.path.join("..", "doc")))
sys.path.insert(0, os.path.abspath(os.path.join("..", "distribution")))
Expand All @@ -37,6 +38,7 @@
# -- Update the modflow 6 version -------------------------------------------
print("Update the modflow6 version")
from update_version import update_version

update_version()

# -- import version from doc/version.py -------------------------------------
Expand Down
10 changes: 4 additions & 6 deletions .github/common/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import sys
import timeit
from itertools import repeat
from queue import Empty
from multiprocessing import Manager, Pool, cpu_count
from pathlib import Path
from queue import Empty
from subprocess import run
from multiprocessing import cpu_count, Pool, Manager

PROJ_ROOT = Path(__file__).parents[2]

Expand All @@ -20,13 +20,11 @@
PROJ_ROOT / "src" / "Utilities" / "Libraries" / "sparskit2",
PROJ_ROOT / "utils" / "mf5to6",
PROJ_ROOT / "utils" / "zonebudget" / "msvs",
PROJ_ROOT / "msvs"
PROJ_ROOT / "msvs",
]

# exclude these files from checks
excludefiles = [
PROJ_ROOT / "src" / "Idm" / "gwf-stoidm.f90"
]
excludefiles = [PROJ_ROOT / "src" / "Idm" / "gwf-stoidm.f90"]

# commands
fprettify = "fprettify -c .fprettify.yaml"
Expand Down
1 change: 0 additions & 1 deletion .github/common/check_vfproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path
from pprint import pformat


PROJ_ROOT = Path(__file__).parents[2]


Expand Down
4 changes: 1 addition & 3 deletions .hpc/sstat_poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ def _run_command(
)
is None
):
raise ValueError(
f"SLURM command '{slurm_args.command}' does not exist"
)
raise ValueError(f"SLURM command '{slurm_args.command}' does not exist")

end_tag = f"sstat:,error:,no,steps,running,for,job,{slurm_args.jobid}"
# open file
Expand Down
7 changes: 4 additions & 3 deletions autotest/test_gwf_multimvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,10 @@ def check_output(idx, test):
# cur_ws, gwfparent = ex[idx], gwf_names[idx]
cur_ws = test.workspace
gwfparent = "gwf_" + cases[idx] + "_p"
with open(os.path.join(cur_ws, gwfparent + ".lst"), "r") as gwf_lst, open(
os.path.join(cur_ws, "mfsim.lst"), "r"
) as sim_lst:
with (
open(os.path.join(cur_ws, gwfparent + ".lst"), "r") as gwf_lst,
open(os.path.join(cur_ws, "mfsim.lst"), "r") as sim_lst,
):
gwf_lst_lines = gwf_lst.readlines()
sim_lst_lines = sim_lst.readlines()

Expand Down
Loading

0 comments on commit c29763a

Please sign in to comment.