gnatss.utilities.io module

gnatss.utilities.io module#

gnatss.utilities.io.check_file_exists(input_path: str, storage_options: dict[str, Any] = {}) bool#

Perform a check if either file or directory exists by parsing the input_path into a parsed url, extracting the scheme, and running a check.

Parameters:
input_pathstr

Input path string. This can be a url path, such as s3://mybucket/file.dat or s3://mybucket/**/myfile.csv

storage_optionsdict

Protocol keyword argument for specified file system. This is not needed for local paths.

Returns:
bool

A flag that indicates whether file or directory exists.

Notes

In the case of a glob path string (has **), the function will traverse through all child directories until it finds the specified file matching the pattern.

gnatss.utilities.io.check_permission(input_path: FSMap) None#

Perform permission check to a file directory as specified. This function will attempt to write a file called .permission_test in the base directory.

Parameters:
input_pathfsspec.FSMap

Input path as mutable mapping

Returns:
None
Raises:
PermissionError

If the directory is not writable