Made two helper functions private by adding the prefix __
This commit is contained in:
@ -13,7 +13,7 @@ import instruments.readers.filereader_registry as filereader_registry
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def transfer_file_dict_to_hdf5(h5file, group_name, file_dict):
|
def __transfer_file_dict_to_hdf5(h5file, group_name, file_dict):
|
||||||
"""
|
"""
|
||||||
Transfers data from a file_dict to an HDF5 file.
|
Transfers data from a file_dict to an HDF5 file.
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ def transfer_file_dict_to_hdf5(h5file, group_name, file_dict):
|
|||||||
print(inst)
|
print(inst)
|
||||||
logging.error('Failed to transfer data into HDF5: %s', inst)
|
logging.error('Failed to transfer data into HDF5: %s', inst)
|
||||||
|
|
||||||
def copy_file_in_group(source_file_path, dest_file_obj : h5py.File, dest_group_name, work_with_copy : bool = True):
|
def __copy_file_in_group(source_file_path, dest_file_obj : h5py.File, dest_group_name, work_with_copy : bool = True):
|
||||||
# Create copy of original file to avoid possible file corruption and work with it.
|
# Create copy of original file to avoid possible file corruption and work with it.
|
||||||
|
|
||||||
if work_with_copy:
|
if work_with_copy:
|
||||||
@ -191,7 +191,7 @@ def create_hdf5_file_from_filesystem_path(path_to_input_directory: str,
|
|||||||
#file_dict = ext_to_reader_dict[file_ext](os.path.join(dirpath,filename))
|
#file_dict = ext_to_reader_dict[file_ext](os.path.join(dirpath,filename))
|
||||||
file_dict = filereader_registry.select_file_reader(dest_group_name)(os.path.join(dirpath,filename))
|
file_dict = filereader_registry.select_file_reader(dest_group_name)(os.path.join(dirpath,filename))
|
||||||
|
|
||||||
transfer_file_dict_to_hdf5(h5file, group_name, file_dict)
|
__transfer_file_dict_to_hdf5(h5file, group_name, file_dict)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
source_file_path = os.path.join(dirpath,filename)
|
source_file_path = os.path.join(dirpath,filename)
|
||||||
@ -199,7 +199,7 @@ def create_hdf5_file_from_filesystem_path(path_to_input_directory: str,
|
|||||||
#group_name +'/'+filename
|
#group_name +'/'+filename
|
||||||
#ext_to_reader_dict[file_ext](source_file_path, dest_file_obj, dest_group_name)
|
#ext_to_reader_dict[file_ext](source_file_path, dest_file_obj, dest_group_name)
|
||||||
#g5505f_reader.select_file_reader(dest_group_name)(source_file_path, dest_file_obj, dest_group_name)
|
#g5505f_reader.select_file_reader(dest_group_name)(source_file_path, dest_file_obj, dest_group_name)
|
||||||
copy_file_in_group(source_file_path, dest_file_obj, dest_group_name, False)
|
__copy_file_in_group(source_file_path, dest_file_obj, dest_group_name, False)
|
||||||
|
|
||||||
# Update the progress bar and log the end message
|
# Update the progress bar and log the end message
|
||||||
utils.progressBar(dir_number, number_of_dirs, end_message)
|
utils.progressBar(dir_number, number_of_dirs, end_message)
|
||||||
@ -286,6 +286,6 @@ def save_processed_dataframe_to_hdf5(df, annotator, output_filename): # src_hdf5
|
|||||||
with h5py.File(output_filename, mode) as h5file:
|
with h5py.File(output_filename, mode) as h5file:
|
||||||
# Add project level attributes at the root/top level
|
# Add project level attributes at the root/top level
|
||||||
h5file.attrs.update(project_level_attributes)
|
h5file.attrs.update(project_level_attributes)
|
||||||
transfer_file_dict_to_hdf5(h5file, '/', file_dict)
|
__transfer_file_dict_to_hdf5(h5file, '/', file_dict)
|
||||||
|
|
||||||
#if __name__ == '__main__':
|
#if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user