Skip to content

minimal

Python reference for nagasim.modelfmt.minimal.

Return the shortest form of a model that migrates to the same model.

This is the form naga fmt writes: defaults the loader would fill in are left out.

Parameters:

Name Type Description Default
layout str or dict

A path or a layout dict.

required

Returns:

Type Description
dict

The minimal layout.

See Also

nagasim.build.Model : Its to_dict returns this form. nagasim.modelschema.build_json_schema : What the form is checked against.

Examples:

>>> from pathlib import Path
>>> import nagasim
>>> from nagasim.modelfmt import minimal
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> short = minimal(str(path))
>>> "blocks" in short and "links" in short
True