use pathlib.Path for directories and files
This commit is contained in:
parent
110ddaf3a1
commit
8162758cec
13 changed files with 137 additions and 125 deletions
|
|
@ -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",
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue