use pathlib.Path for directories and files
Some checks failed
Ruff / ruff (push) Waiting to run
Pytest / pytest (3.12) (push) Successful in 1m15s
Pytest / pytest (3.13) (push) Has been cancelled
Mypy / mypy (push) Successful in 1m13s
Pytest / pytest (3.14) (push) Has been cancelled

This commit is contained in:
Justus Kuhlmann 2026-03-23 16:15:55 +01:00
commit 8162758cec
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6
13 changed files with 137 additions and 125 deletions

View file

@ -11,6 +11,7 @@ from .meas_io import load_record as mio_load_record
import os
from pyerrors import Corr
from importlib.metadata import version
from pathlib import Path
app = typer.Typer()
@ -24,8 +25,8 @@ def _version_callback(value: bool) -> None:
@app.command()
def update(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -40,8 +41,8 @@ def update(
@app.command()
def lister(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -52,8 +53,8 @@ def lister(
"""
if entities in ['ensembles', 'Ensembles','ENSEMBLES']:
print("Ensembles:")
for item in os.listdir(path + "/archive"):
if os.path.isdir(os.path.join(path + "/archive", item)):
for item in os.listdir(path / "archive"):
if os.path.isdir(path / "archive" / item):
print(item)
elif entities == 'projects':
results = list_projects(path)
@ -71,8 +72,8 @@ def lister(
@app.command()
def alias_add(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -89,8 +90,8 @@ def alias_add(
@app.command()
def find(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -116,8 +117,8 @@ def find(
@app.command()
def stat(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -136,8 +137,8 @@ def stat(
@app.command()
def importer(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -159,8 +160,8 @@ def importer(
@app.command()
def reimporter(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -183,8 +184,8 @@ def reimporter(
@app.command()
def init(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),
@ -203,8 +204,8 @@ def init(
@app.command()
def drop_cache(
path: str = typer.Option(
str('./corrlib'),
path: Path = typer.Option(
Path('./corrlib'),
"--dataset",
"-d",
),