Skip to content

Commit

Permalink
refactor: resolve ruff check F821 for undefined name (#2062)
Browse files Browse the repository at this point in the history
* refactor: resolve ruff check F821 for undefined name

* Update test_gwf_lak_wetlakbedarea01.py

* Update test_gwe_esl02.py

make codespell happy

* ruff

---------

Co-authored-by: Eric Morway <emorway@usgs.gov>
Co-authored-by: langevin-usgs <langevin@usgs.gov>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 1ab8050 commit c8f846c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
3 changes: 2 additions & 1 deletion autotest/test_gwe_esl02.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ def check_output(idx, test):
"Grid cell temperatures do not reflect the expected difference"
"in stress period "
)
assert np.isclose(np.sum(temps[-1]), ncol[idx]), msg0 + str(index)
answer = ncol[idx]
assert np.isclose(np.sum(temps[-1]), answer), msg0 + str(idx)


# - No need to change any code below
Expand Down
2 changes: 1 addition & 1 deletion autotest/test_gwe_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def check_output(idx, test):
# return out of function
return None
else:
assert error_count == 0, errmsg0
assert error_count == 0

name = cases[idx]
gwename1 = "gwe-" + name + "-1"
Expand Down
6 changes: 0 additions & 6 deletions autotest/test_gwf_lak_wetlakbedarea01.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ def calc_qSat(top, bot, thk):
else:
y = 1.0

else:
if x < bot:
y = 0.0
else:
y = 1.0

return y


Expand Down
1 change: 1 addition & 0 deletions autotest/test_gwf_laket.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def check_output(idx, test):
stage_compare = True

test.success = True
msg = ""
if not evap_compare:
test.success = False
msg += " Lake evaporation comparison failed."
Expand Down
6 changes: 2 additions & 4 deletions doc/mf6io/mf6ivar/mf6ivar.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def parse_mf6var_file(fname):
else:
key = name
if key in vardict:
raise ValueError(f"Variable already exists in dictionary: {k}")
raise ValueError(f"Variable already exists in dictionary: {key}")
vardict[key] = vd
vd = {}
continue
Expand Down Expand Up @@ -233,9 +233,7 @@ def block_entry(varname, block, vardict, prefix=" "):
elif " " in vtype:
vtype = vtype.split(" ", 1)[0]
if vtype not in VALID_TYPES:
raise ValueError(
f"{fname}: {key}: {vtype!r} is not a valid type from {VALID_TYPES}"
)
raise ValueError(f"{key}: {vtype!r} is not a valid type from {VALID_TYPES}")

# record or recarray
if v["type"].startswith("rec"):
Expand Down
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ select = [
ignore = [
"E722", # do not use bare `except`
"E741", # ambiguous variable name
"F821", # undefined name TODO FIXME
"F841", # local variable assigned but never used
]

Expand Down

0 comments on commit c8f846c

Please sign in to comment.