h5rdmtoolbox.convention.core.Convention

h5rdmtoolbox.convention.core.Convention#

class h5rdmtoolbox.convention.core.Convention(*, name, contact, institution=None, standard_attributes=None, decoders=None, filename=None)[source]#

Convention class

A convention is a set of standard attributes, which are defined in a YAML or JSON file. Recommended initialization is via Convention.from_yaml(<yaml_filename>) or Convention.from_json(<json_filename>).

Parameters:
  • name (str) – Name of the convention

  • contact (str) – ORCID of the researcher

  • institution (str, optional) – Institution of the researcher (if different from that of contact)

  • decoders (List[str], optional=None) – List of decoders to be used for decoding datasets. If None, no decoder is used. Decoders can be written by the user and registered with h5tbx.register_dataset_decoder(<decoder_func>).

__init__(*, name, contact, institution=None, standard_attributes=None, decoders=None, filename=None)[source]#

Methods

__init__(*, name, contact[, institution, ...])

add(std_attr)

Add a standard attribute to the convention.

add_decoder(decoder)

Add a decoder to the convention.

add_standard_attribute(std_attr)

Add a standard attribute to the convention.

delete()

Delete the convention from the user directory.

from_json(json_filename[, overwrite])

Create a convention from a json file.

from_yaml(yaml_filename[, overwrite])

Create a convention from a yaml file.

pop(*names)

removes the standard attribute with the given name from the convention

register()

Register the convention in the convention directory

remove_decoder(decoder)

Remove a decoder from the convention.

validate(file_or_filename)

Checks a file for compliance with the convention.

Attributes

decoders

Return registered decoders.

registered_standard_attributes

Return the registered standard attributes.