Skip to content

Commit 2954151

Browse files
authored
chore: increase line length, apply ruff formatting (#76)
1 parent ed0b6a5 commit 2954151

12 files changed

Lines changed: 166 additions & 217 deletions

File tree

autotest/test_interface.py

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,10 @@
99
from modflowapi import Callbacks, ModflowApi, run_simulation
1010
from modflowapi.extensions.pakbase import AdvancedPackage, ArrayPackage, ListPackage
1111

12-
data_pth = Path("../examples/data")
12+
data_pth = Path("../docs/examples/data")
1313
pytestmark = pytest.mark.extensions
1414
os = system()
15-
so = "libmf6" + (
16-
".so"
17-
if os == "Linux"
18-
else ".dylib"
19-
if os == "Darwin"
20-
else ".dll"
21-
if os == "Windows"
22-
else None
23-
)
15+
so = "libmf6" + (".so" if os == "Linux" else ".dylib" if os == "Darwin" else ".dll" if os == "Windows" else None)
2416
if so is None:
2517
pytest.skip("Unsupported operating system", allow_module_level=True)
2618

@@ -76,9 +68,7 @@ def callback(sim, step):
7668
raise AssertionError("ApiModel size is incorrect")
7769

7870
if (model.kper, model.kstp) != (-1, -1):
79-
raise AssertionError(
80-
"ApiModel has advanced prior to initialization callback"
81-
)
71+
raise AssertionError("ApiModel has advanced prior to initialization callback")
8272

8373
dis = model.dis
8474
if not isinstance(dis, ArrayPackage):
@@ -102,15 +92,11 @@ def callback(sim, step):
10292

10393
elif step == Callbacks.stress_period_start:
10494
if sim.kstp != 0:
105-
raise AssertionError(
106-
"Solution advanced prior to stress_period_start callback"
107-
)
95+
raise AssertionError("Solution advanced prior to stress_period_start callback")
10896

10997
elif step == Callbacks.timestep_start:
11098
if sim.iteration != -1:
111-
raise AssertionError(
112-
"Solution advanced prior to timestep_start callback"
113-
)
99+
raise AssertionError("Solution advanced prior to timestep_start callback")
114100

115101
factor = ((1 + sim.kstp) / sim.nstp) * 0.5
116102
spd = sim.test_model.wel.stress_period_data.values
@@ -169,9 +155,7 @@ def callback(sim, step):
169155
raise AssertionError("ApiModel size is incorrect")
170156

171157
if (model.kper, model.kstp) != (-1, -1):
172-
raise AssertionError(
173-
"ApiModel has advanced prior to initialization callback"
174-
)
158+
raise AssertionError("ApiModel has advanced prior to initialization callback")
175159

176160
dis = model.dis
177161
if not isinstance(dis, ArrayPackage):
@@ -195,15 +179,11 @@ def callback(sim, step):
195179

196180
elif step == Callbacks.stress_period_start:
197181
if sim.kstp != 0:
198-
raise AssertionError(
199-
"Solution advanced prior to stress_period_start callback"
200-
)
182+
raise AssertionError("Solution advanced prior to stress_period_start callback")
201183

202184
elif step == Callbacks.timestep_start:
203185
if sim.iteration != -1:
204-
raise AssertionError(
205-
"Solution advanced prior to timestep_start callback"
206-
)
186+
raise AssertionError("Solution advanced prior to timestep_start callback")
207187

208188
factor = 0.75
209189
spd = sim.gwf_1.chd_left.stress_period_data.values
@@ -253,9 +233,7 @@ def callback(sim, step):
253233
raise AssertionError("ApiModel size is incorrect")
254234

255235
if (model.kper, model.kstp) != (-1, -1):
256-
raise AssertionError(
257-
"ApiModel has advanced prior to initialization callback"
258-
)
236+
raise AssertionError("ApiModel has advanced prior to initialization callback")
259237

260238
dis = model.dis
261239
if not isinstance(dis, ArrayPackage):
@@ -275,15 +253,11 @@ def callback(sim, step):
275253

276254
elif step == Callbacks.stress_period_start:
277255
if sim.kstp != 0:
278-
raise AssertionError(
279-
"Solution advanced prior to stress_period_start callback"
280-
)
256+
raise AssertionError("Solution advanced prior to stress_period_start callback")
281257

282258
elif step == Callbacks.timestep_start:
283259
if sim.iteration != -1:
284-
raise AssertionError(
285-
"Solution advanced prior to timestep_start callback"
286-
)
260+
raise AssertionError("Solution advanced prior to timestep_start callback")
287261

288262
factor = 1.75
289263
spd = sim.gwf_1.rch.stress_period_data.values
@@ -362,9 +336,7 @@ def callback(sim, step):
362336
wel.rhs = rhs
363337

364338
rhs2 = wel.get_advanced_var("rhs")
365-
np.testing.assert_allclose(
366-
rhs, rhs2, err_msg="rhs variable not being properly set"
367-
)
339+
np.testing.assert_allclose(rhs, rhs2, err_msg="rhs variable not being properly set")
368340

369341
hcof = wel.hcof
370342
hcof[0:3] = np.abs(rhs)[0:3] / 2
@@ -373,17 +345,13 @@ def callback(sim, step):
373345

374346
hcof2 = wel.get_advanced_var("hcof")
375347

376-
np.testing.assert_allclose(
377-
hcof, hcof2, err_msg="hcof is not being properly set"
378-
)
348+
np.testing.assert_allclose(hcof, hcof2, err_msg="hcof is not being properly set")
379349

380350
rhs *= 1.2
381351
wel.set_advanced_var("rhs", rhs)
382352
rhs3 = wel.rhs
383353

384-
np.testing.assert_allclose(
385-
rhs, rhs3, err_msg="set advanced var method not working properly"
386-
)
354+
np.testing.assert_allclose(rhs, rhs3, err_msg="set advanced var method not working properly")
387355

388356
npf = model.npf
389357

docs/conf.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,41 @@
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

66
import os
7+
import sys
78
from pathlib import Path
9+
810
from flopy.utils.get_modflow import run_main as get_modflow
9-
import sys
10-
sys.path.insert(0, os.path.abspath('../'))
11+
12+
sys.path.insert(0, os.path.abspath("../"))
1113
from modflowapi import __version__
1214

1315
# -- Determine if this is a development or release version ------------------
1416
branch_or_version = __version__ if "dev" not in __version__ else "develop"
1517

1618
# -- Project information -----------------------------------------------------
1719
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
18-
project = 'modflowapi'
19-
copyright = '2025, modflowapi developers'
20-
author = 'modflowapi developers'
21-
release = '0.3.0.dev0'
20+
project = "modflowapi"
21+
copyright = "2025, modflowapi developers"
22+
author = "modflowapi developers"
23+
release = "0.3.0.dev0"
2224

2325
# -- General configuration ---------------------------------------------------
2426
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
25-
extensions = [
26-
"sphinx.ext.autodoc",
27-
"sphinx.ext.autosummary",
28-
"myst_parser",
29-
"nbsphinx"
30-
]
31-
templates_path = ['_templates']
32-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**/Extensions.py']
27+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.autosummary", "myst_parser", "nbsphinx"]
28+
templates_path = ["_templates"]
29+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**/Extensions.py"]
3330

3431
# -- Options for HTML output -------------------------------------------------
3532
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
36-
html_theme = 'sphinx_rtd_theme'
37-
html_static_path = ['_static']
33+
html_theme = "sphinx_rtd_theme"
34+
html_static_path = ["_static"]
3835

3936
# -- nbsphinx configuration -------------------------------------------------
4037
nbsphinx_custom_formats = {
41-
'.py': ['jupytext.reads', {'fmt': 'py:light'}],
38+
".py": ["jupytext.reads", {"fmt": "py:light"}],
4239
}
4340

4441
# -- Install MODFLOW --------------------------------------------------------
4542
bindir = Path.cwd() / "examples" / "notebooks"
4643
repo = "modflow6-nightly-build" if branch_or_version == "develop" else "modflow6"
47-
get_modflow(str(bindir), repo=repo)
44+
get_modflow(str(bindir), repo=repo)

0 commit comments

Comments
 (0)