From fbbccc8ee68e1250e4f6bc3d70cb5bf6755fa28f Mon Sep 17 00:00:00 2001 From: Johanne Saxegaard Date: Thu, 10 Oct 2024 16:02:24 +0200 Subject: [PATCH 1/3] Fixed bug with filename --- src/ssb_konjunk/saving.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ssb_konjunk/saving.py b/src/ssb_konjunk/saving.py index 57eec6d..b5a34a9 100644 --- a/src/ssb_konjunk/saving.py +++ b/src/ssb_konjunk/saving.py @@ -87,7 +87,7 @@ def _structure_ssb_filepath( # Handle versionizing or not. if version_number is None: - file_path = f"{file_path}/{file_name}_{time_stamp}" + file_path = f"{file_path}/{file_name}_{time_stamp}_" elif isinstance(version_number, int): file_path = f"{file_path}/{file_name}_{time_stamp}_v{version_number}.{filetype}" else: @@ -324,6 +324,8 @@ def write_ssb_file( version_number = _find_version_number(files, stable_version) if version_number: + if file_path.endswith("_"): + file_path = file_path[:-1] file_path = f"{file_path}_v{version_number}.{filetype}" _save_df(df, file_path, filetype, fs, seperator, encoding) From a0202fec26f5178ae36fecc91000fde68dfa5482 Mon Sep 17 00:00:00 2001 From: Johanne Saxegaard Date: Thu, 10 Oct 2024 16:06:36 +0200 Subject: [PATCH 2/3] Adjusted tests --- tests/test_saving.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_saving.py b/tests/test_saving.py index 1729507..a2d5a23 100644 --- a/tests/test_saving.py +++ b/tests/test_saving.py @@ -49,7 +49,7 @@ def test_structure_ssb_filepath() -> None: assert ( filename_2 - == "ssb-reiseliv-korttid-data-produkt-prod/overnatting/inndata/min_fil_p2023_p2024" + == "ssb-reiseliv-korttid-data-produkt-prod/overnatting/inndata/min_fil_p2023_p2024_" ), filename_2 filename_3 = _structure_ssb_filepath( @@ -65,7 +65,7 @@ def test_structure_ssb_filepath() -> None: assert ( filename_3 - == "ssb-reiseliv-korttid-data-produkt-prod/overnatting/inndata/mellommappe/min_fil_p2023_p2024" + == "ssb-reiseliv-korttid-data-produkt-prod/overnatting/inndata/mellommappe/min_fil_p2023_p2024_" ), filename_3 filename_4 = _structure_ssb_filepath( @@ -81,7 +81,7 @@ def test_structure_ssb_filepath() -> None: assert ( filename_4 - == "ssb-reiseliv-korttid-data-produkt-prod/oppdrag/min_fil_p2023_p2024" + == "ssb-reiseliv-korttid-data-produkt-prod/oppdrag/min_fil_p2023_p2024_" ), filename_4 filename_5 = _structure_ssb_filepath( @@ -97,7 +97,7 @@ def test_structure_ssb_filepath() -> None: assert ( filename_5 - == "ssb-reiseliv-korttid-data-produkt-prod/oppdrag/38-99/min_fil_p2023_p2024" + == "ssb-reiseliv-korttid-data-produkt-prod/oppdrag/38-99/min_fil_p2023_p2024_" ), filename_5 From bd1aa244b3617ace4b828bc6aaf08f79fc325dcc Mon Sep 17 00:00:00 2001 From: Johanne Saxegaard Date: Thu, 10 Oct 2024 16:29:57 +0200 Subject: [PATCH 3/3] Filename bug --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f801247..162a5aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ssb-konjunk" -version = "0.1.12" +version = "0.1.13" description = "SSB Konjunk" authors = ["Edvard Garmannslund "] license = "MIT"