Renamed the input argument yaml_review_file as review_yaml_file.
This commit is contained in:
@ -9,8 +9,8 @@ import yaml
|
|||||||
import src.hdf5_ops as hdf5_ops
|
import src.hdf5_ops as hdf5_ops
|
||||||
|
|
||||||
|
|
||||||
def load_yaml(yaml_review_file):
|
def load_yaml(review_yaml_file):
|
||||||
with open(yaml_review_file, 'r') as stream:
|
with open(review_yaml_file, 'r') as stream:
|
||||||
try:
|
try:
|
||||||
return yaml.load(stream, Loader=yaml.FullLoader)
|
return yaml.load(stream, Loader=yaml.FullLoader)
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
@ -78,7 +78,7 @@ def validate_yaml_dict(input_hdf5_file, yaml_dict):
|
|||||||
return len(errors) == 0, errors, notes
|
return len(errors) == 0, errors, notes
|
||||||
|
|
||||||
|
|
||||||
def update_hdf5_file_with_review(input_hdf5_file, yaml_review_file):
|
def update_hdf5_file_with_review(input_hdf5_file, review_yaml_file):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Updates, appends, or deletes metadata attributes in an HDF5 file based on a provided YAML dictionary.
|
Updates, appends, or deletes metadata attributes in an HDF5 file based on a provided YAML dictionary.
|
||||||
@ -97,11 +97,11 @@ def update_hdf5_file_with_review(input_hdf5_file, yaml_review_file):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
yaml_dict = load_yaml(yaml_review_file)
|
yaml_dict = load_yaml(review_yaml_file)
|
||||||
|
|
||||||
success, errors, notes = validate_yaml_dict(input_hdf5_file,yaml_dict)
|
success, errors, notes = validate_yaml_dict(input_hdf5_file,yaml_dict)
|
||||||
if not success:
|
if not success:
|
||||||
raise ValueError(f"Review yaml file {yaml_review_file} is invalid. Validation errors: {errors}")
|
raise ValueError(f"Review yaml file {review_yaml_file} is invalid. Validation errors: {errors}")
|
||||||
|
|
||||||
# Initialize HDF5 operations manager
|
# Initialize HDF5 operations manager
|
||||||
DataOpsAPI = hdf5_ops.HDF5DataOpsManager(input_hdf5_file)
|
DataOpsAPI = hdf5_ops.HDF5DataOpsManager(input_hdf5_file)
|
||||||
@ -165,6 +165,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if sys.argv[1] == 'update':
|
if sys.argv[1] == 'update':
|
||||||
input_hdf5_file = sys.argv[2]
|
input_hdf5_file = sys.argv[2]
|
||||||
yaml_review_file = sys.argv[3]
|
review_yaml_file = sys.argv[3]
|
||||||
update_hdf5_file_with_review(input_hdf5_file, yaml_review_file)
|
update_hdf5_file_with_review(input_hdf5_file, review_yaml_file)
|
||||||
#run(sys.argv[2])
|
#run(sys.argv[2])
|
||||||
|
Reference in New Issue
Block a user