HOTFIX: nsure path casting in find and meas_io
Some checks failed
Ruff / ruff (push) Waiting to run
Mypy / mypy (push) Successful in 1m9s
Pytest / pytest (3.12) (push) Has been cancelled
Pytest / pytest (3.14) (push) Has been cancelled
Pytest / pytest (3.13) (push) Has been cancelled

This commit is contained in:
Justus Kuhlmann 2026-05-06 16:48:35 +02:00
commit 08d25da188
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6
2 changed files with 8 additions and 2 deletions

View file

@ -322,6 +322,7 @@ def find_record(path: Path, ensemble: str, correlator_name: str, code: str, proj
revision: Optional[str]=None, revision: Optional[str]=None,
customFilter: Optional[Callable[[pd.DataFrame], pd.DataFrame]] = None, customFilter: Optional[Callable[[pd.DataFrame], pd.DataFrame]] = None,
**kwargs: Any) -> pd.DataFrame: **kwargs: Any) -> pd.DataFrame:
path = Path(path)
db_file = get_db_file(path) db_file = get_db_file(path)
db = path / db_file db = path / db_file
if code not in codes: if code not in codes:

View file

@ -37,6 +37,7 @@ def write_measurement(path: Path, ensemble: str, measurement: dict[str, dict[str
parameter_file: str parameter_file: str
The parameter file used for the measurement. The parameter file used for the measurement.
""" """
path = Path(path)
db_file = get_db_file(path) db_file = get_db_file(path)
db = path / db_file db = path / db_file
@ -50,7 +51,7 @@ def write_measurement(path: Path, ensemble: str, measurement: dict[str, dict[str
c = conn.cursor() c = conn.cursor()
for corr in measurement.keys(): for corr in measurement.keys():
file_in_archive = Path('.') / 'archive' / ensemble / corr / str(uuid + '.json.gz') file_in_archive = Path('.') / 'archive' / ensemble / corr / str(uuid + '.json.gz')
file = path / file_in_archive file = Path(path) / file_in_archive
known_meas = {} known_meas = {}
if not os.path.exists(path / 'archive' / ensemble / corr): if not os.path.exists(path / 'archive' / ensemble / corr):
os.makedirs(path / 'archive' / ensemble / corr) os.makedirs(path / 'archive' / ensemble / corr)
@ -174,6 +175,7 @@ def load_records(path: Path, meas_paths: list[str], preloaded: dict[str, Any] =
returned_data: list returned_data: list
The loaded records. The loaded records.
""" """
path = Path(path)
if dry_run: if dry_run:
_check_db2paths(path, meas_paths) _check_db2paths(path, meas_paths)
return [] return []
@ -238,6 +240,7 @@ def cache_path(path: Path, file: str, key: str) -> Path:
cache_path: str cache_path: str
The path at which the measurement of the given file and key is cached. The path at which the measurement of the given file and key is cached.
""" """
path = Path(path)
cache_path = cache_dir(path, file) / key cache_path = cache_dir(path, file) / key
return cache_path return cache_path
@ -258,6 +261,7 @@ def preload(path: Path, file: Path) -> dict[str, Any]:
filedict: dict[str, Any] filedict: dict[str, Any]
The data read from the file. The data read from the file.
""" """
path = Path(path)
get(path, file) get(path, file)
filedict: dict[str, Any] = pj.load_json_dict(str(path / file)) filedict: dict[str, Any] = pj.load_json_dict(str(path / file))
print("> read file") print("> read file")
@ -276,7 +280,7 @@ def drop_record(path: Path, meas_path: str) -> None:
The measurement path as noted in the database. The measurement path as noted in the database.
""" """
file_in_archive = meas_path.split("::")[0] file_in_archive = meas_path.split("::")[0]
file = path / file_in_archive file = Path(path) / file_in_archive
db_file = get_db_file(path) db_file = get_db_file(path)
db = path / db_file db = path / db_file
get(path, db_file) get(path, db_file)
@ -310,6 +314,7 @@ def drop_cache(path: Path) -> None:
path: str path: str
The path of the library. The path of the library.
""" """
path = Path(path)
cache_dir = path / ".cache" cache_dir = path / ".cache"
for f in os.listdir(cache_dir): for f in os.listdir(cache_dir):
shutil.rmtree(cache_dir / f) shutil.rmtree(cache_dir / f)