valpas.utils.checker.check_infile#

valpas.utils.checker.check_infile(path)#

Checks whether a give infile exsits. Returns the absolute path to the file if the file exsits. Can be used in conjuction with the type paramater in argparse.ArgumentParser.add_argument.

Parameters:

path (str | PathLike | Path) – A path like object that contains the file path that should be checked for existence.

Returns:

Returns the absolute Path to the file if the file exists.

Return type:

str

Raises:
  • TypeError – If the passed path argument is not in a path like format

  • FileNotFoundError – If the file is not found / does not exist

  • ValueError – If the supplied file is not a defined type (in this case .csv or .xlsx).