Skip to content

verify.renames

The expected renames and differences of a comparison of two dumps.

MetadataRenames

Bases: TypedDict

The expected changes of the metadata of the fit mappings.

Renames

Bases: TypedDict

The expected renames and differences between two dumps.

Expected

Expected(patterns)

The expected differences of a renames file and which of them occurred.

Create the expected differences.

Parameters:

Name Type Description Default
patterns Mapping[str, Sequence[str]]

the patterns of the keys per part of the dump.

required

match

match(part, key)

Check whether the difference of a key is expected, recording the patterns.

* and ? of a pattern are the wildcards of fnmatch; a bracket is literal, so that E/task/[A] is the variable [A].

unused

unused()

Get the patterns which matched no difference.

load_renames

load_renames(path)

Load the expected renames from a json file.

Raises:

Type Description
ValueError

for a part which is not known.

rename_mapping

rename_mapping(description, renames)

Apply the expected renames to the metadata of a mapping description.

rename_ids

rename_ids(dump, rename)

Rename the ids of the tasks, datasets, figures and fit mappings of a dump.

Returns:

Type Description
Dump

A new dump; the given one is not changed.

Raises:

Type Description
ValueError

if two ids of a part have the same new id, or a mapping description cannot be renamed.

drop_figure_fields

drop_figure_fields(dump, fields)

Leave out keys of the specifications of the figures, of the figure only.

A key is left out at the level of the figure, not inside its plots, curves or axes: a plot has a width and a height of its own.

Returns:

Type Description
Dump

A new dump; the given one is not changed.

apply_renames

apply_renames(dump, renames)

Apply the expected renames to a dump, the old one of a comparison.

The strings first, then the ids (ids, sids), then the metadata.

Returns:

Type Description
Dump

A new dump; the given one is not changed.

Raises:

Type Description
ValueError

if two keys or ids get the same new key or id, or a mapping description cannot be renamed.