mloq._utils#

This module contains some utilities that are not currently used.

Module Contents#

Functions#

dir_trees_are_equal(dir1, dir2)

Compare two directories recursively. Files in each directory are assumed to be equal if their names and contents are equal.

files_are_equal(path1, path2)

Compare the content of two files.

get_generated_files(path)

List all the files generated in the last mloq run.

get_generated_directories(path)

List all the directories generated in the last mloq run.

check_directories_exist(paths)

Check if the provided paths exist.

get_docker_python_version(template)

Return the highest python version defined for the project.

write_config_setup(config, path[, safe])

Write setup config in a yaml file.

load_empty_config_setup()

Return a dictionary containing all the MLOQ setup config values set to None.

mloq._utils.dir_trees_are_equal(dir1, dir2)[source]#

Compare two directories recursively. Files in each directory are assumed to be equal if their names and contents are equal.

@param dir1: First directory path @param dir2: Second directory path

@return: True if the directory trees are the same and

there were no errors while accessing the directories or files, False otherwise.

Parameters
  • dir1 (Union[str, pathlib.Path]) –

  • dir2 (Union[str, pathlib.Path]) –

Return type

bool

mloq._utils.files_are_equal(path1, path2)[source]#

Compare the content of two files.

Compare two incoming files. They are assumed equal if their contents are the same.

Parameters
  • path1 (Union[str, pathlib.Path]) – Path containing the first file to be compared.

  • path2 (Union[str, pathlib.Path]) – Path containing the second file to be compared.

Returns

It returns True if the two given files are equal and no errors

have arisen during the process. False otherwise.

Return type

bool

mloq._utils.get_generated_files(path)[source]#

List all the files generated in the last mloq run.

Parameters

path (Union[str, pathlib.Path]) – path to WHAT_MLOQ_GENERATED.md file.

Returns

List of Path containing the names of the files generated by mloq.

Return type

List[pathlib.Path]

mloq._utils.get_generated_directories(path)[source]#

List all the directories generated in the last mloq run.

Parameters

path (Union[str, pathlib.Path]) – path to WHAT_MLOQ_GENERATED.md file.

Returns

List of Path containing the names of the directories generated by mloq.

Return type

List[pathlib.Path]

mloq._utils.check_directories_exist(paths)[source]#

Check if the provided paths exist.

Parameters

paths (List[Union[str, pathlib.Path]]) – List of paths that will be checked

Returns

True if all the provided paths exist. False otherwise.

Return type

bool

mloq._utils.get_docker_python_version(template)[source]#

Return the highest python version defined for the project.

Parameters

template (omegaconf.DictConfig) –

Return type

str

mloq._utils.write_config_setup(config, path, safe=False)[source]#

Write setup config in a yaml file.

Parameters
  • config (omegaconf.DictConfig) –

  • path (Union[pathlib.Path, str]) –

  • safe (bool) –

mloq._utils.load_empty_config_setup()[source]#

Return a dictionary containing all the MLOQ setup config values set to None.

Return type

omegaconf.DictConfig