MCPcopy
hub / github.com/opengeos/segment-geospatial / _output

Function _output

agent-harness/cli_anything/samgeo/samgeo_cli.py:25–51  ·  view source on GitHub ↗

Print output as JSON or human-readable text. Args: data: Dict or list to output. as_json: Whether to output as JSON.

(data, as_json=False)

Source from the content-addressed store, hash-verified

23
24
25def _output(data, as_json=False):
26 """Print output as JSON or human-readable text.
27
28 Args:
29 data: Dict or list to output.
30 as_json: Whether to output as JSON.
31 """
32 if as_json:
33 click.echo(json.dumps(data, indent=2, default=str))
34 else:
35 if isinstance(data, dict):
36 for k, v in data.items():
37 if isinstance(v, dict):
38 click.echo(f"{k}:")
39 for kk, vv in v.items():
40 click.echo(f" {kk}: {vv}")
41 elif isinstance(v, list):
42 click.echo(f"{k}: [{len(v)} items]")
43 else:
44 click.echo(f"{k}: {v}")
45 elif isinstance(data, list):
46 for item in data:
47 if isinstance(item, dict):
48 line = " ".join(f"{k}={v}" for k, v in item.items())
49 click.echo(f" {line}")
50 else:
51 click.echo(f" {item}")
52
53
54def _load_project(ctx):

Callers 15

project_newFunction · 0.85
project_infoFunction · 0.85
project_set_sourceFunction · 0.85
project_historyFunction · 0.85
model_listFunction · 0.85
model_info_cmdFunction · 0.85
model_checkFunction · 0.85
segment_automaticFunction · 0.85
segment_pointsFunction · 0.85
segment_boxesFunction · 0.85
segment_textFunction · 0.85
data_infoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected