graphdoc.data.helper module
- graphdoc.data.helper.check_directory_path(directory_path: str | Path) None [source]
Check if the provided path resolves to a valid directory.
- Parameters:
directory_path (Union[str, Path]) – The path to check.
- Raises:
ValueError – If the path does not resolve to a valid directory.
- Returns:
None
- Return type:
None
- graphdoc.data.helper.check_file_path(file_path: str | Path) None [source]
Check if the provided path resolves to a valid file.
- Parameters:
file_path (Union[str, Path]) – The path to check.
- Raises:
ValueError – If the path does not resolve to a valid file.
- Returns:
None
- Return type:
None
- graphdoc.data.helper._env_constructor(loader: SafeLoader, node: ScalarNode) str [source]
Custom constructor for environment variables.
- Parameters:
loader (yaml.SafeLoader) – The YAML loader.
node (yaml.nodes.ScalarNode) – The node to construct.
- Returns:
The environment variable value.
- Return type:
- Raises:
ValueError – If the environment variable is not set.
- graphdoc.data.helper.load_yaml_config(file_path: str | Path, use_env: bool = True) dict [source]
Load a YAML configuration file.
- Parameters:
- Returns:
The YAML configuration.
- Return type:
- Raises:
ValueError – If the path does not resolve to a valid file or the environment variable is not set.
- graphdoc.data.helper.load_yaml_config_redacted(file_path: str | Path, replace_value: str = 'redacted') dict [source]
Load a YAML configuration file with environment variables redacted.
- Parameters:
- Returns:
The YAML configuration with env vars replaced by “redacted”.
- Return type:
- Raises:
ValueError – If the path does not resolve to a valid file.