From 3a4508d4c164235a11446b3f23958c280177f7f4 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 11 Sep 2025 20:55:49 +1200 Subject: [PATCH 1/2] refactor(dfn): rename _SCALAR_TYPES to public SCALAR_TYPES --- modflow_devtools/dfn.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modflow_devtools/dfn.py b/modflow_devtools/dfn.py index b77c2ab8..00659d04 100644 --- a/modflow_devtools/dfn.py +++ b/modflow_devtools/dfn.py @@ -115,7 +115,8 @@ def block_sort_key(item) -> int: ] -_SCALAR_TYPES = ("keyword", "integer", "double precision", "string") +SCALAR_TYPES = ("keyword", "integer", "double precision", "string") +_SCALAR_TYPES = SCALAR_TYPES # allow backwards compat; imported by flopy Dfns = dict[str, "Dfn"] @@ -455,7 +456,7 @@ def _item() -> Field: return _convert_field(next(iter(flat.getlist(item_names[0])))) # implicit simple record (no children) - if all(t in _SCALAR_TYPES for t in item_types): + if all(t in SCALAR_TYPES for t in item_types): return Field( name=_name, type="record", @@ -543,7 +544,7 @@ def _fields() -> Fields: # for now, we can tell a var is an array if its type # is scalar and it has a shape. once we have proper # typing, this can be read off the type itself. - elif shape is not None and _type not in _SCALAR_TYPES: + elif shape is not None and _type not in SCALAR_TYPES: raise TypeError(f"Unsupported array type: {_type}") else: From 22aa6a67d901d88386aacff97563e94995174a45 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 11 Sep 2025 21:27:10 +1200 Subject: [PATCH 2/2] Fix lint (RUF059) --- modflow_devtools/dfn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modflow_devtools/dfn.py b/modflow_devtools/dfn.py index 00659d04..9a543ec0 100644 --- a/modflow_devtools/dfn.py +++ b/modflow_devtools/dfn.py @@ -131,7 +131,7 @@ def get_blocks(dfn: "Dfn") -> Blocks: """ def _is_block(item: tuple[str, Any]) -> bool: - k, v = item + k, _v = item return k not in Dfn.__annotations__ return dict(