def import_json_to_all_dataset(self, dataset_id_list, dataset_source_folder_path): for dataset in DatasetModel.find_datasets_by_id_list(dataset_id_list): result = format_mount_directory(dataset_source_folder_path, dataset.name)\ .flat_map(lambda path: self.execute(dataset.id, path)) if result.is_failure(): return result return Result.success(dataset_id_list)
def check_labelme_json(self, dataset_id_list, dataset_source_folder_path): for dataset in DatasetModel.find_datasets_by_id_list(dataset_id_list): result = format_mount_directory(dataset_source_folder_path, dataset.name)\ .flat_map(lambda path: self.find_labelme_json(path)\ .flat_map(lambda labelme_json: LabelChecker.check_string(labelme_json))) if result.is_failure(): return result return Result.success('')