Skip to content

Commit b06c6dd

Browse files
authored
Merge pull request #398 from GispoCoding/397-fix-cli-str-outputs
Fix result str sending in CLI
2 parents f315add + 515d4ce commit b06c6dd

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

eis_toolkit/cli.py

+8-17
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,9 @@ def descriptive_statistics_raster_cli(input_file: INPUT_FILE_OPTION):
726726
results_dict = descriptive_statistics_raster(raster)
727727
typer.echo("Progress: 75%")
728728

729-
json_str = json.dumps(results_dict)
730-
typer.echo("Progress: 100%\n")
729+
typer.echo("Progress: 100% \n")
731730

732-
typer.echo(f"Results: {json_str}")
731+
typer.echo(f"Results: {str(results_dict)}")
733732
typer.echo("\nDescriptive statistics (raster) completed")
734733

735734

@@ -755,11 +754,10 @@ def descriptive_statistics_vector_cli(input_file: INPUT_FILE_OPTION, column: str
755754
raise Exception("Could not read input file as raster or dataframe")
756755
typer.echo("Progress: 75%")
757756

758-
json_str = json.dumps(results_dict)
759757
typer.echo("Progress: 100%")
760758

761-
typer.echo(f"Results: {json_str}")
762-
typer.echo("Descriptive statistics (vector) completed")
759+
typer.echo(f"Results: {str(results_dict)}")
760+
typer.echo("\nDescriptive statistics (vector) completed")
763761

764762

765763
# LOCAL MORAN'S I
@@ -3115,10 +3113,9 @@ def summarize_probability_metrics_cli(true_labels: INPUT_FILE_OPTION, probabilit
31153113

31163114
typer.echo("Progress: 75%")
31173115

3118-
json_str = json.dumps(results_dict)
31193116
typer.echo("Progress: 100% \n")
31203117

3121-
typer.echo(f"Results: {json_str}")
3118+
typer.echo(f"Results: {str(results_dict)}")
31223119
typer.echo("\nGenerating probability metrics summary completed.")
31233120

31243121

@@ -3141,11 +3138,10 @@ def summarize_label_metrics_binary_cli(true_labels: INPUT_FILE_OPTION, predictio
31413138
results_dict = summarize_label_metrics_binary(y_true=y_true, y_pred=y_pred)
31423139
typer.echo("Progress: 75%")
31433140

3144-
json_str = json.dumps(results_dict)
31453141
typer.echo("Progress: 100% \n")
31463142

3147-
typer.echo(f"Results: {json_str}")
3148-
typer.echo("\n Generating prediction label metrics summary completed.")
3143+
typer.echo(f"Results: {str(results_dict)}")
3144+
typer.echo("\nGenerating prediction label metrics summary completed.")
31493145

31503146

31513147
@app.command()
@@ -3357,12 +3353,7 @@ def score_predictions_cli(
33573353
outputs = score_predictions(y_true, y_pred, metrics)
33583354
typer.echo("Progress: 100% \n")
33593355

3360-
if isinstance(outputs, dict):
3361-
for key, value in outputs.items():
3362-
typer.echo(f"{key}: {value}")
3363-
else:
3364-
typer.echo(outputs)
3365-
3356+
typer.echo(f"Results: {str(outputs)}")
33663357
typer.echo("\nScoring predictions completed.")
33673358

33683359

0 commit comments

Comments
 (0)