utils.datafile module

datafile functions, to help reliably datafiles from the data directory.

utils.datafile.data_path_for_filename(filename, base_path, testmod_path=None)[source]

Returns the data path for a given file name

utils.datafile.load_data_file(filename, replacements=None)[source]

Opens the given filename, returning a file object

  • filename – If a base_path string is passed, filename will be loaded from there
  • replacements – If a replacements mapping is passed, the loaded file is assumed to be a template. In this case the replacements mapping will be used in that template’s subsitute method.

Returns: A file object.