From 3fa62639539df9e03e87bac9cb8ba3a5e95d8027 Mon Sep 17 00:00:00 2001 From: Sarthak Kapoor Date: Thu, 19 Dec 2024 15:51:38 +0100 Subject: [PATCH] Merge if conditions --- src/nomad_measurements/utils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/nomad_measurements/utils.py b/src/nomad_measurements/utils.py index ab646105..17382fbb 100644 --- a/src/nomad_measurements/utils.py +++ b/src/nomad_measurements/utils.py @@ -249,10 +249,13 @@ def add_dataset( dataset = DatasetModel( **params, ) - if validate_path and self.valid_dataset_paths: - if path not in self.valid_dataset_paths: - self.logger.warning(f'Invalid dataset path "{path}".') - return + if ( + validate_path + and self.valid_dataset_paths + and path not in self.valid_dataset_paths + ): + self.logger.warning(f'Invalid dataset path "{path}".') + return # handle the pint.Quantity and add data if isinstance(dataset.data, pint.Quantity):