0.1.8
Loading...
Searching...
No Matches
pyhelios.validation.files Namespace Reference

Functions

str validate_file_path (str filename, List[str] expected_extensions=None, bool must_exist=True, str param_name="filename", str function_name=None)
 Validate and normalize file path with security checks.
 
str validate_directory_path (str directory, bool must_exist=True, bool create_if_missing=False, str param_name="directory", str function_name=None)
 Validate and normalize directory path.
 

Function Documentation

◆ validate_directory_path()

str pyhelios.validation.files.validate_directory_path ( str directory,
bool must_exist = True,
bool create_if_missing = False,
str param_name = "directory",
str function_name = None )

Validate and normalize directory path.

Parameters
directoryDirectory path to validate
must_existWhether directory must already exist
create_if_missingCreate directory if it doesn't exist
param_nameParameter name for error messages
function_nameFunction name for error messages
Returns
Normalized absolute path
Exceptions
ValidationErrorIf path is invalid or doesn't exist

Definition at line 127 of file files.py.

◆ validate_file_path()

str pyhelios.validation.files.validate_file_path ( str filename,
List[str] expected_extensions = None,
bool must_exist = True,
str param_name = "filename",
str function_name = None )

Validate and normalize file path with security checks.

Based on Context._validate_file_path but enhanced with ValidationError and standardized error messaging.

Parameters
filenameFile path to validate
expected_extensionsList of allowed file extensions (e.g., ['.ply', '.obj'])
must_existWhether file must already exist
param_nameParameter name for error messages
function_nameFunction name for error messages
Returns
Normalized absolute path
Exceptions
ValidationErrorIf path is invalid, doesn't exist, or has wrong extension

Definition at line 34 of file files.py.