Skip to content

Commit 59afa51

Browse files
authored
refactor(dfn): rename _SCALAR_TYPES to public SCALAR_TYPES (#236)
This variable is accessed externally (here), which means it should be a public variable, not private. Keep a private _SCALAR_TYPES copy for now.
1 parent a563977 commit 59afa51

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

modflow_devtools/dfn.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ def block_sort_key(item) -> int:
115115
]
116116

117117

118-
_SCALAR_TYPES = ("keyword", "integer", "double precision", "string")
118+
SCALAR_TYPES = ("keyword", "integer", "double precision", "string")
119+
_SCALAR_TYPES = SCALAR_TYPES # allow backwards compat; imported by flopy
119120

120121

121122
Dfns = dict[str, "Dfn"]
@@ -130,7 +131,7 @@ def get_blocks(dfn: "Dfn") -> Blocks:
130131
"""
131132

132133
def _is_block(item: tuple[str, Any]) -> bool:
133-
k, v = item
134+
k, _v = item
134135
return k not in Dfn.__annotations__
135136

136137
return dict(
@@ -455,7 +456,7 @@ def _item() -> Field:
455456
return _convert_field(next(iter(flat.getlist(item_names[0]))))
456457

457458
# implicit simple record (no children)
458-
if all(t in _SCALAR_TYPES for t in item_types):
459+
if all(t in SCALAR_TYPES for t in item_types):
459460
return Field(
460461
name=_name,
461462
type="record",
@@ -543,7 +544,7 @@ def _fields() -> Fields:
543544
# for now, we can tell a var is an array if its type
544545
# is scalar and it has a shape. once we have proper
545546
# typing, this can be read off the type itself.
546-
elif shape is not None and _type not in _SCALAR_TYPES:
547+
elif shape is not None and _type not in SCALAR_TYPES:
547548
raise TypeError(f"Unsupported array type: {_type}")
548549

549550
else:

0 commit comments

Comments
 (0)