MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / read_hsgr_file

Function read_hsgr_file

scripts/debug/dump_hsgr.py:167–182  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

165
166
167def read_hsgr_file(args):
168 with tarfile.open(args.input + ".hsgr", "r") as tar:
169 found = 0
170 root = f"/ch/metrics/{args.metric}/contracted_graph/"
171 for member in tar:
172 if fnmatch.fnmatch(member.name, root + "node_array"):
173 node_buffer = tar.extractfile(member).read()
174 found += 1
175 if fnmatch.fnmatch(member.name, root + "edge_array"):
176 edge_buffer = tar.extractfile(member).read()
177 found += 1
178 if found != 2:
179 raise Exception(f"member {root} not found")
180 nodes = struct.iter_unpack("<L", node_buffer)
181 nodes2 = struct.iter_unpack("<L", node_buffer)
182 return nodes, expand_nodes(nodes2, HsgrEdge.make(edge_buffer))
183
184
185def join(params):

Callers 1

dump_hsgr.pyFile · 0.85

Calls 2

expand_nodesFunction · 0.85
makeMethod · 0.45

Tested by

no test coverage detected