MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / read_graph_json

Function read_graph_json

graphify/paths.py:723–733  ·  view source on GitHub ↗

A graph file's data with one copy of each string its rows repeat.

(path)

Source from the content-addressed store, hash-verified

721
722
723def read_graph_json(path) -> dict:
724 """A graph file's data with one copy of each string its rows repeat."""
725 shared: dict[str, str] = {}
726
727 def share(row: dict) -> dict:
728 for field, value in row.items():
729 if type(value) is str:
730 row[field] = shared.setdefault(value, value)
731 return row
732
733 return json.loads(Path(path).read_text(encoding="utf-8"), object_hook=share)
734
735
736def consumed(rows: list):

Callers 5

_load_cli_graphFunction · 0.90
dispatch_commandFunction · 0.90
load_graphFunction · 0.90
_read_graphFunction · 0.90
load_node_link_graphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected