data_management.helper_fxns

This file contains helper functions used throughout the various parsing scripts in this directory.

Functions

find_files(source_root, extensions[, recursive])

Recursively find all files in the given directory with the provided

lookup_extension(format)

Looks up the extension for a basis set file format.

sanitize_basis_name(bs_name)

Sanitizes the basis set name. For example, replace numbers with the

desanitize_basis_name(bs_name)

"Desanitizes" the basis set name. For example, replace "_star" with

write_warning(fout, script_name[, prefix])

Writes a warning saying the file was auto-generated by the given script

Module Contents

data_management.helper_fxns.find_files(source_root, extensions, recursive=False)

Recursively find all files in the given directory with the provided extensions.

Parameters:
  • source_root (str) – Root directory containing relevant files.

  • extensions (list of str) – File extensions to search for.

  • recursive (bool) – Whether or not to recursively search in subdirectories, defaults to False

Returns:

Dictionary of file extensions mapping to lists of full paths to files found with the respective extension

Return type:

dict of lists

data_management.helper_fxns.lookup_extension(format)

Looks up the extension for a basis set file format.

Parameters:

format (str) – BSE basis set file format identifier.

Returns:

Extension for the file format.

Return type:

str

data_management.helper_fxns.sanitize_basis_name(bs_name)

Sanitizes the basis set name. For example, replace numbers with the corresponding word and hyphens, plus-signs, and other symbols with underscores.

Parameters:

bs_name (str) – Basis set name

Returns:

Sanitized basis set name

Return type:

str

data_management.helper_fxns.desanitize_basis_name(bs_name)

“Desanitizes” the basis set name. For example, replace “_star” with an asterisk character ‘*’.

Parameters:

bs_name (str) – Sanitized basis set name

Returns:

Unsanitized basis set name

Return type:

str

data_management.helper_fxns.write_warning(fout, script_name, prefix='')

Writes a warning saying the file was auto-generated by the given script and will be overwritten the next time it is run.

Parameters:
  • fout (:class:io.TextIOBase) – Text file opened for output.

  • script_name (str) – Name of the script that generates the file.

  • prefix (str) – An optional, additional prefix to be added to every line of the warning comment. This is a quick an dirty fix to output this warning to non-C++ files, where comments may be different. Defaults to “”.