Skip to content

Commit

Permalink
Made input_validation.check_input() a "public" function
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Collins committed Feb 2, 2023
1 parent 5767bde commit f3addc9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/opera/util/input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from opera.util.error_codes import ErrorCode


def _check_input(input_object, logger, name, valid_extensions):
def check_input(input_object, logger, name, valid_extensions):
"""
Called by _validate_inputs() to check individual files.
Validation checks for individual files.
The input object is checked for existence and that it ends with
a valid file extension.
Expand Down Expand Up @@ -84,18 +84,18 @@ def validate_slc_s1_inputs(runconfig, logger, name):
for key, value in input_file_group_dict.items():
if key == 'safe_file_path':
for i in range(len(value)):
_check_input(value[i], logger, name, valid_extensions=('.zip',))
check_input(value[i], logger, name, valid_extensions=('.zip',))
elif key == 'orbit_file_path':
for i in range(len(value)):
_check_input(value[i], logger, name, valid_extensions=('.EOF',))
check_input(value[i], logger, name, valid_extensions=('.EOF',))
elif key == 'dem_file':
_check_input(value, logger, name, valid_extensions=('.tif', '.tiff', '.vrt'))
check_input(value, logger, name, valid_extensions=('.tif', '.tiff', '.vrt'))
elif key in ('burst_id', 'dem_description'):
# these fields are included in the SAS input paths, but are not
# actually file paths, so skip them
continue
elif key == 'burst_database_file':
_check_input(value, logger, name, valid_extensions=('.sqlite3',))
check_input(value, logger, name, valid_extensions=('.sqlite3',))
else:
error_msg = f"Unexpected input: {key}: {value}"
logger.critical(name, ErrorCode.INVALID_INPUT, error_msg)

0 comments on commit f3addc9

Please sign in to comment.