Feat: report a csv file, a directory or all
This commit is contained in:
parent
7a0bb4179d
commit
6fb11cb054
@ -55,18 +55,25 @@ def reporting(csv_file):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.argument("csv_file", required=False)
|
@click.argument("target", required=False)
|
||||||
def report(csv_file=""):
|
def report(target=""):
|
||||||
if csv_file:
|
""" Make a report for the eval
|
||||||
csv = Path(csv_file)
|
|
||||||
|
:param target: csv file or a directory where csvs are
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if target.endswith(".csv"):
|
||||||
|
csv = Path(target)
|
||||||
if not csv.exists():
|
if not csv.exists():
|
||||||
click.echo(f"{csv_file} does not exists")
|
click.echo(f"{target} does not exists")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if csv.suffix != ".csv":
|
if csv.suffix != ".csv":
|
||||||
click.echo(f"{csv_file} has to be a csv file")
|
click.echo(f"{target} has to be a csv file")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
csvs = [csv]
|
csvs = [csv]
|
||||||
else:
|
else:
|
||||||
|
csvs = list(Path(target).glob('**/*.csv'))
|
||||||
|
except AttributeError:
|
||||||
csvs = list(Path(config["source"]).glob('**/*.csv'))
|
csvs = list(Path(config["source"]).glob('**/*.csv'))
|
||||||
|
|
||||||
for csv in csvs:
|
for csv in csvs:
|
||||||
|
Loading…
Reference in New Issue
Block a user