filesystem¶
filesystem ¶
read_env_var ¶
Reads an environment variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var_name | str | Name of the environment variable. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | The value of the environment variable if valid. |
Raises:
| Type | Description |
|---|---|
KeyError | If the environment variable does not exist. |
ValueError | If the environment variable is empty or contains only whitespace. |
Source code in source/src/filesystem.py
read_file ¶
Reads a file and returns its content. Handles edge cases such as the file not existing or being unreadable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | str | Path to the token file. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | The content of the file. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist. |
PermissionError | If the file cannot be read due to permission issues. |
Source code in source/src/filesystem.py
list_dir ¶
Returns a list of all file names in the ./input/salaries directory.
Source code in source/src/filesystem.py
remove_folder ¶
Remove the folder at the given path if it exists. Do nothing if it doesn't.