MetadataGenerator#

class MetadataGenerator(di, **kwargs)#

Bases: object

Generate metadata from interface.

Options are stored in an instance of options_cls.

Parameters:
creation_commit = <neba.data.writer.MetadataMethod object>#

Return latest commit hash.

Use the creation_script if present in metadata, or "." otherwise.

Return type:

str

creation_diff = <neba.data.writer.MetadataMethod object>#

Add git diff, only if latest commit hash is present.

  • creation_diff_short: list of files modified since last commit

  • creation_diff_long: full diff, truncated at max_diff_lines

Use the creation_script if present in metadata, or "." otherwise.

Return type:

dict[str, Any] | None

creation_hostname = <neba.data.writer.MetadataMethod object>#

Return hostname of current running process.

Return type:

str

creation_params = <neba.data.writer.MetadataMethod object>#

Return interface parameters as dictionary or str.

Return type:

dict[str, Any] | str

creation_script = <neba.data.writer.MetadataMethod object>#

Filename of top-level script or notebook.

Return type:

str

creation_time = <neba.data.writer.MetadataMethod object>#

Date and time.

Return type:

str

generate()#

Generate metadata.

Return type:

dict[str, Any]

get_methods()#

Return methods names, skipping those not selected by user.

Return type:

list[str]

metadata: dict[str, Any]#

Dictionary that is progressively filled during generation.

options_cls#

alias of MetadataOptions

methods: List[Unicode] | None#

  • Default value: None

Manually specify methods to run. If left to None, all methods are run.

add_params: Bool#

  • Default value: True

If True add parameters (either as dict or str).

add_git_info: Bool#

  • Default value: True

If True add information about git repository status.

params_exclude: List[Unicode]#

  • Default value: ['log_']

Prefixes of parameters to exclude from metadata attribute.

params_str: Bool#

  • Default value: True

If True, serialize parameters using JSON.

max_diff_lines: Int#

  • Default value: 30

Maximum number of lines to include in diff.

creation_script: Unicode | None#

  • Default value: None

Manually specify the creation script.

git_ignore: List[Unicode]#

  • Default value: []

Files and folders to ignore when creating git diff.

postprocess()#

Modify the metadata attribute in place, after generation.

Return type:

None

written_with_interface = <neba.data.writer.MetadataMethod object>#

Class-name and ID of parent interface.

Return type:

str