Skip to content

Commit

Permalink
docs/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Oct 15, 2024
1 parent 3d014fa commit ee8d599
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 11 additions & 6 deletions flopy/mf6/utils/codegen/dfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ def __init__(
@staticmethod
def _load(f, common: Optional[dict] = None) -> Tuple[OMD, List[str]]:
"""
Internal use only. Loads the DFN as an ordered multi-dictionary, and
Internal use only. Loads the DFN as an ordered multi-dictionary* and
a list of string metadata. This is later parsed into more structured
form. We also store the original representation for now so it can be
used by the shim.
*The point of the OMD is to handle duplicate variable names; the only
case of this right now is 'auxiliary' which can appear in the options
block and again as a keyword in a record in a package data variable.
"""
var = dict()
vars = list()
Expand Down Expand Up @@ -211,12 +216,12 @@ def _map(spec: Dict[str, Any]) -> Var:
Notes
-----
This involves expanding nested type hierarchies, mapping
types to roughly equivalent Python primitives/composites,
and other shaping.
types to roughly equivalent Python primitives/composites.
The composite inflation step will not be necessary after
DFNs move to a structured format.
The rules for optional variable defaults are as follows:
If a `default_value` is not provided, keywords are `False`
by default, everything else is `None`.
If a variable does not have a `default` attribute, it will
default to `False` if it is a keyword, otherwise to `None`.
Any filepath variable whose name functions as a foreign key
for another context will be given a pointer to the context.
Expand Down
6 changes: 1 addition & 5 deletions flopy/mf6/utils/codegen/templates/init.py.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
def __init__(
self,
{%- for var in vars.values() if var.init_param %}
{%- if var.default is defined %}
{{ var.name }}={{ var.default }},
{%- else %}
{{ var.name }},
{%- endif -%}
{{ var.name }}{%- if var.default is defined %}={{ var.default }}{%- endif -%},
{%- endfor %}
**kwargs,
):
Expand Down

0 comments on commit ee8d599

Please sign in to comment.