hevslib.general module

General Functions

hevslib.general.createDir(directory, verbose=0)

Checks if directory exists, and creates it if not

Parameters
  • dir – string location of directory

  • verbose – integer for verbosity

Returns

None

Raises

NotADirectoryError

hevslib.general.genMd2Pdf(src_file_path, outputDir, css_path=None, verbose=1)

Converts md file to a pdf file markdown-pdf is needed for PDF Report: https://www.npmjs.com/package/markdown-pdf

`npm install -g markdown-pdf`

Parameters
  • src_file_path – path to md file

  • outputDir – output directory for output pdf file

  • css_path – path to css file

  • verbose – integer for verbosity

Returns

absolute path to pdf file directory

Return type

path

Raises

None

hevslib.general.generateAllMd2Pdf(srcdir, outputDir, css_path=None, verbose=1)

Search all md files and generate pdf files markdown-pdf is needed for PDF Report: https://www.npmjs.com/package/markdown-pdf

`npm install -g markdown-pdf`

Parameters
  • srcdir – search directory for md files

  • outputDir – output directory for output pdf files

  • css_path – path to css file

  • verbose – integer for verbosity

Returns

absolute path to pdf file directory

Return type

path

Raises

None

hevslib.general.listDir(directory, verbose=0)

List all file in directory

Parameters
  • directory – link to directory relative or absolut to cwd

  • verbose – integer for verbosity

Returns

list of files in directory

Return type

dirlst

Raises

None

hevslib.general.loadObj(name)

Import a python object (dataframe, dictionary, …) from a pickle file

Parameters

name – the name of the pickle file

Returns

The object stored in the pickle file

Return type

Python object

Raises

None

hevslib.general.moveFiles(indir, outdir, ext, verbose=0)

Find files with given extension and move them from one dir to another

Parameters
  • indir – search directory

  • outdir – move directory

  • ext – file extention to search for

  • verbose – integer for verbosity

Returns

list of files in directory

Return type

dirlst

Raises

None

hevslib.general.printColor(s, fg_color)

Function to print text in specific color

Parameters
  • s – text to print

  • fg_color – foreground color from “colorama” package

Returns

None

Raises

None

hevslib.general.printColorHtml(s, color='black')

Function to display html text in specific color

Parameters
  • s – text to print

  • color – color of the text

Returns

None

Raises

None

hevslib.general.printFile(text='', file=None, fileoutput=True, consoleoutput=True, append=True)

Prints output to file and/or console

Parameters
  • text – text to print

  • file – path/name to file

  • fileoutput – enable file output

  • consoleoutput – enable console output

  • append – append to file if true or create new file

Returns

None

Raises

None

hevslib.general.remDir(directory, verbose=0)

Checks if directory exists, and removes it including files

Parameters
  • dir – string relative or absolut directory path location of directory

  • verbose – integer for verbosity

Returns

None

Raises

DirectoryDoesntExistError

hevslib.general.saveObj(obj, name)

Save a python object (dataframe, dictionary, …) to a pickle file

Parameters
  • obj – the python object to export

  • name – the name of the pickle file

Returns

None

Raises

None