Skip to content

Commit

Permalink
appease codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Oct 11, 2024
1 parent 27bf297 commit 58f2db4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flopy/mf6/utils/codegen/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def _default(value: str) -> Any:
if _type != "string":
try:
return literal_eval(value)
except:
except SyntaxError:
return value

def _fields(record_name: str) -> Vars:
Expand Down
1 change: 0 additions & 1 deletion flopy/mf6/utils/codegen/dfn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections import UserList
from dataclasses import dataclass
from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple


Expand Down
1 change: 0 additions & 1 deletion flopy/mf6/utils/codegen/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# noqa: F401
from flopy.mf6.utils.codegen.context import (
get_context_names,
make_context,
make_contexts,
)
from flopy.mf6.utils.codegen.dfn import Dfn, DfnName, Dfns
Expand Down
6 changes: 2 additions & 4 deletions flopy/mf6/utils/codegen/render.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import asdict
from enum import Enum
from typing import Any, Callable, Dict, Iterable, Optional, Tuple, Union
from typing import Any, Callable, Dict, Iterable, Optional, Tuple

Predicate = Callable[[Any], bool]
Transform = Callable[[Any], Dict[str, str]]
Expand Down Expand Up @@ -137,10 +137,8 @@ def _dict(o):
break

for p, e in set_pairs:
if not p(d):
if not (p(d) and e):
continue
if e is None:
raise ValueError(f"No value for key: {k}")
for k, v in e:
if callable(v):
v = v(d)
Expand Down

0 comments on commit 58f2db4

Please sign in to comment.