Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- pytest-dotenv
- pytest-xdist
- pyzmq>=25.1.2
- syrupy
- syrupy<5.0.0
- virtualenv

# optional
Expand Down
6 changes: 3 additions & 3 deletions flopy/mf6/utils/codegen/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ def type(var: dict) -> str:

def children(var: dict) -> Optional[dict]:
_type = var["type"]
items = var.get("items", None) # TODO: fix to use "item" or "items"
item = var.get("item", None)
fields = var.get("fields", None)
choices = var.get("choices", None)
if items:
if item:
assert _type == "recarray"
return items
return {item["name"]: item}
if fields:
assert _type == "record"
return fields
Expand Down
5 changes: 4 additions & 1 deletion flopy/mf6/utils/codegen/templates/macros.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
{{ v.description|clean|math|wordwrap|indent(loop.depth * 4, first=true) }}
{% endif %}
{% if recurse and children is not none %}
{% if v.type == "list" and children|length == 1 and (children.values()|first).type in ["record", "union"] %}
{% if v.type == "recarray" and children|length == 1 and (children.values()|first).name == v.name and (children.values()|first).type in ["record", "keystring"] %}
{# For recarray with single record item of same name, show the record's fields directly #}
{% set grandchildren = (children.values()|first)|children %}
{% if grandchildren %}
{{ loop(grandchildren.values())|indent(loop.depth * 4, first=true) }}
{% endif %}
{% else %}
{{ loop(children.values())|indent(loop.depth * 4, first=true) }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test = [
"pytest-dotenv",
"pytest-xdist",
"pyzmq >=25.1.2",
"syrupy",
"syrupy <5.0.0",
"tomli",
"tomli-w",
"virtualenv"
Expand Down
Loading