MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / validate

Function validate

tools/provenance-export/verify_dsse.py:45–57  ·  view source on GitHub ↗
(item, depth=0)

Source from the content-addressed store, hash-verified

43 value = json.loads(raw.decode("utf-8"), object_pairs_hook=unique_object, parse_int=integer,
44 parse_float=refuse_number, parse_constant=refuse_number)
45 def validate(item, depth=0):
46 if isinstance(item, (dict, list)):
47 if depth >= 128:
48 raise ValueError("JSON exceeds nesting limit")
49 if isinstance(item, dict):
50 for key, child in item.items():
51 key.encode("utf-8", errors="strict")
52 validate(child, depth + 1)
53 else:
54 for child in item:
55 validate(child, depth + 1)
56 elif isinstance(item, str):
57 item.encode("utf-8", errors="strict")
58 validate(value)
59 return value
60

Callers 1

admitted_jsonFunction · 0.70

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected