sovabids.files#

Module with file utilities.

Module Contents#

Functions#

_get_files(root_path)

Recursively scan the directory for files, returning a list with the full-paths to each.

_write_yaml(dictionary[, path])

Write a yaml file based on the dictionary to the specified path.

download(url, path)

Download in the path the file from the given url.

sovabids.files._get_files(root_path)[source]#

Recursively scan the directory for files, returning a list with the full-paths to each.

Parameters:

root_path (str) – The path we want to obtain the files from.

Returns:

filepaths – A list containing the path to each file in root_path.

Return type:

list of str

sovabids.files._write_yaml(dictionary, path=None)[source]#

Write a yaml file based on the dictionary to the specified path.

Parameters:
  • dictionary (dict) – The dictionary to be written.

  • path (str | None) – Full path to the yaml file to be written. If None, no file will be written.

Returns:

The dump version of the generated yaml document.

Return type:

str

sovabids.files.download(url, path)[source]#

Download in the path the file from the given url.

From H S Umer farooq answer at https://stackoverflow.com/questions/22676/how-to-download-a-file-over-http

Parameters:
  • url (str) – The url of the file to download.

  • path (str) – The path where to download the file.