MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / as_json

Function as_json

etc/scripts/scanserv.py:17–35  ·  view source on GitHub ↗

Return a JSON string from a `results` data structuret.

(results, pretty=True)

Source from the content-addressed store, hash-verified

15
16
17def as_json(results, pretty=True):
18 """
19 Return a JSON string from a `results` data structuret.
20 """
21 import json
22
23 kwargs = dict(encoding="utf-8")
24 if pretty:
25 kwargs.update(dict(indent=2 * b" "))
26 else:
27 kwargs.update(
28 dict(
29 separators=(
30 b",",
31 b":",
32 )
33 )
34 )
35 return json.dumps(results, **kwargs) + b"\n"
36
37
38def run_scan(location, **kwargs):

Callers 1

run_scanFunction · 0.85

Calls 2

updateMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected