Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_isochrone_graph.py
Show All 38 Lines | def isochrone_graph_from_dict(d: Dict[str, Any], depth: int = 0) -> IsochroneNode: | ||||
children = d.get("children", []) | children = d.get("children", []) | ||||
node = IsochroneNode( | node = IsochroneNode( | ||||
entry=DirectoryEntry(**d["entry"]), | entry=DirectoryEntry(**d["entry"]), | ||||
dbdate=dbdate, | dbdate=dbdate, | ||||
depth=depth, | depth=depth, | ||||
) | ) | ||||
node.maxdate = datetime.fromtimestamp(d["maxdate"], timezone.utc) | node.maxdate = datetime.fromtimestamp(d["maxdate"], timezone.utc) | ||||
node.known = d.get("known", False) | |||||
node.invalid = d.get("invalid", False) | node.invalid = d.get("invalid", False) | ||||
node.path = bytes(d["path"], encoding="utf-8") | node.path = bytes(d["path"], encoding="utf-8") | ||||
node.children = set( | node.children = set( | ||||
isochrone_graph_from_dict(child, depth=depth + 1) for child in children | isochrone_graph_from_dict(child, depth=depth + 1) for child in children | ||||
) | ) | ||||
return node | return node | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |