tmas.src.input_validation
Module Contents
- tmas.src.input_validation.is_image_file(file_path: str, plate_design: Dict[str, Any]) bool [source]
Check if the provided file path is a valid image file based on several criteria.
This function verifies whether a given file is a valid image file by checking: 1. The file extension to ensure it is an image format (e.g., .png, .jpg, .jpeg). 2. The presence of ‘raw’ or ‘filtered’ in the filename to ensure it matches expected naming conventions. 3. The existence of the plate design type extracted from the image name in the provided plate design dictionary.
- Parameters:
file_path (str) – The full path to the file being checked.
plate_design (Dict[str, Any]) – A dictionary representing the plate design loaded from a JSON file, containing design types and related information.
- Returns:
Returns True if the file is a valid image, contains ‘raw’ or ‘filtered’ in the filename, and the plate design type exists in the plate design dictionary. Returns False otherwise.
- Return type:
bool