From d5641c961ef62090ccb7ad77a19e717c5fd70f06 Mon Sep 17 00:00:00 2001 From: Martijn Govers Date: Tue, 10 Oct 2023 10:24:09 +0200 Subject: [PATCH 1/3] do not cache pypi and conda versions Signed-off-by: Martijn Govers --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b90c54b6..495b8f48 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ SPDX-FileCopyrightText: 2022 Contributors to the Power Grid Model project -[![PyPI version](https://badge.fury.io/py/power-grid-model-io.svg)](https://badge.fury.io/py/power-grid-model-io) -[![Anaconda-Server Badge](https://anaconda.org/conda-forge/power-grid-model-io/badges/version.svg)](https://anaconda.org/conda-forge/power-grid-model-io) +[![PyPI version](https://badge.fury.io/py/power-grid-model-io.svg?no-cache)](https://badge.fury.io/py/power-grid-model-io) +[![Anaconda-Server Badge](https://anaconda.org/conda-forge/power-grid-model-io/badges/version.svg?no-cache)](https://anaconda.org/conda-forge/power-grid-model-io) [![License: MIT](https://img.shields.io/badge/License-MPL2.0-informational.svg)](https://github.com/PowerGridModel/power-grid-model-io/blob/main/LICENSE) [![Build and Test Python](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/build-test-and-sonar.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/build-test-and-sonar.yml) [![Check Code Quality](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/check-code-quality.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/check-code-quality.yml) From a1d989d6b23a0a48abad00008881707cbbe93f4e Mon Sep 17 00:00:00 2001 From: Martijn Govers Date: Tue, 10 Oct 2023 10:31:42 +0200 Subject: [PATCH 2/3] fix sonar cloud reliability Signed-off-by: Martijn Govers --- src/power_grid_model_io/mappings/unit_mapping.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/power_grid_model_io/mappings/unit_mapping.py b/src/power_grid_model_io/mappings/unit_mapping.py index 3f1dc8d3..983439c8 100644 --- a/src/power_grid_model_io/mappings/unit_mapping.py +++ b/src/power_grid_model_io/mappings/unit_mapping.py @@ -8,6 +8,7 @@ from numbers import Number from typing import Dict, Optional, Set, Tuple +import numpy as np import structlog # si-unit unit factor @@ -58,7 +59,7 @@ def set_mapping(self, mapping: Units): ) self._mapping[unit] = (multiplier, si_unit) if unit == si_unit: - if multiplier != 1.0: + if not np.isclose(multiplier, 1.0, rtol=1.0e-9, atol=0.0): raise ValueError( f"Invalid unit definition for '{unit}': 1{unit} cannot be {multiplier}{si_unit}" ) From 88b52c10210e0e9d196aa784d14d230bf613355b Mon Sep 17 00:00:00 2001 From: Martijn Govers Date: Tue, 10 Oct 2023 10:34:29 +0200 Subject: [PATCH 3/3] fix minor code smell Signed-off-by: Martijn Govers --- src/power_grid_model_io/utils/zip.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/power_grid_model_io/utils/zip.py b/src/power_grid_model_io/utils/zip.py index cb46d00e..a28581da 100644 --- a/src/power_grid_model_io/utils/zip.py +++ b/src/power_grid_model_io/utils/zip.py @@ -42,9 +42,8 @@ def extract(src_file_path: Path, dst_dir_path: Optional[Path] = None, skip_if_ex log = _log.bind(src_file_path=src_file_path, dst_dir_path=dst_dir_path) - if dst_dir_path.exists(): - if not dst_dir_path.is_dir(): - raise NotADirectoryError(f"Destination dir {dst_dir_path} exists and is not a directory") + if dst_dir_path.exists() and not dst_dir_path.is_dir(): + raise NotADirectoryError(f"Destination dir {dst_dir_path} exists and is not a directory") # Create the destination directory dst_dir_path.mkdir(parents=True, exist_ok=True)