metasyn.gmf
The validation module contains functions to validate the serialized output of distributions.
This ensures that the Generative Metadata Format (GMF) files are interoperable and well formed.
Functions
|
Parse GMF dictionary to convert it to the standard dictionary. |
|
Validate gmf dictionary as read from the file for different GMF versions. |
- metasyn.gmf.parse_gmf_dict(gmf_dict, validate=True)
Parse GMF dictionary to convert it to the standard dictionary.
This acts as a compatibility layer for different versions of the GMF standard.
- Parameters:
gmf_dict (
dict) – Dictionary to be convertedvalidate (
bool) – Whether to validate the dictionary with the JSON schema, by default True
- Return type:
dict- Returns:
A potentially validated and converted dictionary.
- metasyn.gmf.validate_gmf_dict(gmf_dict)
Validate gmf dictionary as read from the file for different GMF versions.
- Parameters:
gmf_dict (
dict) – Dictionary to be validated.
Classes
|
Base class for parsing GmfFiles. |
|
GMF parser for version 1.1 and earlier. |
|
GMF parser for version 2.0 and later. |
- class metasyn.gmf.BaseGmfParser
Bases:
ABCBase class for parsing GmfFiles.
- create_schema(packages)
Create JSON Schema to validate a GMF file.
- Parameters:
packages (
list[str]) – List of packages to create the schema with.- Returns:
Schema containing all the distributions in the distribution packages.
- Return type:
schema
- parse(gmf_dict)
Convert the specific version of the gmf dictionary to the current standard.
- Parameters:
gmf_dict (
dict) – Dictionary to be converted.- Returns:
Converted dictionary.
- validate_gmf_dict(gmf_dict)
Validate a JSON dictionary of a metaframe as it would be written to a GMF file.
Make sure that you have used the _jsonify function to convert numpy arrays to lists, etc.
- Parameters:
gmf_dict (
dict) – Dictionary containing the metasyn output for a metaframe.
- class metasyn.gmf.GmfV11Parser
Bases:
BaseGmfParserGMF parser for version 1.1 and earlier.
- parse(gmf_dict)
Convert the specific version of the gmf dictionary to the current standard.
- Parameters:
gmf_dict (
dict) – Dictionary to be converted.- Returns:
Converted dictionary.
- class metasyn.gmf.GmfV20Parser
Bases:
BaseGmfParserGMF parser for version 2.0 and later.