From 5766690be7fdb47313180642060a953d05f8ddc0 Mon Sep 17 00:00:00 2001 From: Max Rossmannek Date: Mon, 21 Feb 2022 15:04:40 +0100 Subject: [PATCH] fix: Python <3.9 compatibility --- qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py | 2 +- test/drivers/second_quantization/hdf5d/test_driver_hdf5.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py b/qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py index 6740e132ac..cfd47e9559 100644 --- a/qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py +++ b/qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py @@ -95,7 +95,7 @@ def convert(self, replace: bool = False) -> None: new_hdf5_file = hdf5_file if not replace: - new_hdf5_file = hdf5_file.with_stem(str(hdf5_file.stem) + "_new") + new_hdf5_file = hdf5_file.with_name(str(hdf5_file.stem) + "_new.hdf5") driver_result = ElectronicStructureDriverResult.from_legacy_driver_result(q_mol) save_to_hdf5(driver_result, str(new_hdf5_file), replace=replace) diff --git a/test/drivers/second_quantization/hdf5d/test_driver_hdf5.py b/test/drivers/second_quantization/hdf5d/test_driver_hdf5.py index 7497208f58..2f1a27aec9 100644 --- a/test/drivers/second_quantization/hdf5d/test_driver_hdf5.py +++ b/test/drivers/second_quantization/hdf5d/test_driver_hdf5.py @@ -64,8 +64,8 @@ def test_convert(self): # pylint: disable=consider-using-with tmp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".hdf5") tmp_file.close() - new_file_name = pathlib.Path(tmp_file.name).with_stem( - str(pathlib.Path(tmp_file.name).stem) + "_new" + new_file_name = pathlib.Path(tmp_file.name).with_name( + str(pathlib.Path(tmp_file.name).stem) + "_new.hdf5" ) os.unlink(tmp_file.name) shutil.copy(legacy_file_path, tmp_file.name)