Skip to content

Commit

Permalink
[py] ruff: misc manual fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke authored and endJunction committed Nov 29, 2023
1 parent 1318f54 commit 5f6fc12
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"OGS_INSTALL_DEPENDENCIES": "OFF",
"OGS_USE_PIP": "OFF",
"OGS_USE_MFRONT": "ON",
"DOGS_BUILD_PROCESSES": "SteadyStateDiffusion",
"BUILD_SHARED_LIBS": "ON"
}
}
Expand Down
5 changes: 3 additions & 2 deletions Tests/Python/test_simulator_mesh_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tempfile

import numpy as np
import ogs.mesh as mesh # noqa: F401
from ogs import simulator


Expand Down Expand Up @@ -120,9 +121,9 @@ def test_simulator():
if len(read_back_bc_values) != len(bc_values_for_second_time_step):
print(
"Python: error: data array size mismatch: got "
+ str(len(new_bc_values))
+ str(len(read_back_bc_values))
+ ", expected "
+ str(len(bc_values))
+ str(len(bc_values_for_second_time_step))
)
comparison = read_back_bc_values == bc_values_for_second_time_step
if not comparison.all():
Expand Down
8 changes: 5 additions & 3 deletions scripts/snakemake/vtkdiff/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
__copyright__ = "Copyright 2020, OpenGeoSys Community"
__license__ = "BSD"

import os
from pathlib import Path

from snakemake.shell import shell

if os.path.exists(snakemake.output[0]):
os.remove(snakemake.output[0])
# ruff: noqa: F821
output = Path(snakemake.output[0])
if output.exists():
output.unlink()

if snakemake.params.check_mesh:
shell("vtkdiff {snakemake.input.a} {snakemake.input.b} -m > {snakemake.output[0]}")
Expand Down
5 changes: 3 additions & 2 deletions scripts/test/cppcheck_gen_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import hashlib
import json
import sys
from pathlib import Path

data = None
with open(sys.argv[1]) as json_file:
with Path(sys.argv[1]).open() as json_file:
data = json.load(json_file)

for entry in data:
Expand All @@ -13,7 +14,7 @@
hash = hashlib.sha256((desc + path).encode("utf-8")).hexdigest()
entry["fingerprint"] = hash

with open(sys.argv[1], "w") as outfile:
with Path(sys.argv[1]).open("w") as outfile:
json.dump(data, outfile)

print(f"Added cppcheck fingerprints to {sys.argv[1]}.")
3 changes: 2 additions & 1 deletion scripts/test/generate_coverage_vis_data.in.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python

import os
from pathlib import Path

# need to increase OGS_CTEST_MAX_RUNTIME to enable these:
# ctests = ["SurfaceComplexation", "EquilibriumPhase", "KineticReactant"]
ctests = ["SteadyState", "ComponentTransport", "ThermoHydroMechanics"]
report_path = "./coverage_reports"

os.makedirs(report_path, exist_ok=True)
Path(report_path).mkdir(parents=True, exist_ok=True)

for t in ctests:
os.system("cmake --build . -t clean_coverage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Bayer, P., de Paly, M., & Beck, M. (2014).
Strategic optimization of borehole heat exchanger field
for seasonal geothermal heating and cooling.
Applied Energy, 136, 445453.
Applied Energy, 136, 445-453.
https://doi.org/10.1016/j.apenergy.2014.09.029
Author: Shuang Chen
Expand Down

0 comments on commit 5f6fc12

Please sign in to comment.