Skip to content

Conversation

@mjreno
Copy link
Contributor

@mjreno mjreno commented Oct 9, 2025

Update writes to minimally support running a configuration.

@mjreno mjreno marked this pull request as draft October 9, 2025 12:42
if comp is not None
]
elif isinstance(field_value, (list, tuple)):
elif isinstance(field_value, (list, tuple, xattree.DataTreeList)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be

elif isinstance(field_value, collections.abc.Iterable):

as DataTreeList satisfies that. The condition above already uses the fact DataTreeDict implements MutableMapping, I guess? And that could just be Mapping, too, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I'll update that

{% macro scalar(name, value) %}
{% set format = value|field_format %}
{% if value is not none %}{{ name.upper() }}{% if format != 'keyword' %} {{ value }}{% endif %}{% endif %}
{% if value is not none %}{{ inset ~ name.upper() }}{% if format != 'keyword' %} {{ value }}{% endif %}{% endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't know about the tilde for string concatenation before. TIL.

else:
if field_value is not None:
blocks[block_name][field_name] = field_value
if isinstance(field_value, bool):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this prevents false keywords from being written

@mjreno mjreno marked this pull request as ready for review October 10, 2025 20:43
@mjreno mjreno merged commit d127a0d into modflowpy:develop Oct 10, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants