Commit 2bbc1aeb authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

[Lorenz] Handle graphs without metadata

Metadata was added recently, but older graphs do not contain it. Avoid
errors when reading these graphs.

Change-Id: Ib5c6eb01d53a1e67a0fb5b7451875e891fe3184d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522240Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826507}
parent d1accc64
......@@ -19,6 +19,8 @@ CLASSES_TO_COUNT_INBOUND = ['ChromeActivity', 'ChromeTabbedActivity']
def _copy_metadata(metadata: Dict) -> Dict[str, str]:
if metadata is None:
return {}
return {f'meta_{key}': value for key, value in metadata.items()}
......
......@@ -143,7 +143,7 @@ def load_class_graph_from_file(
json_obj = json.load(json_file)
class_graph_json_obj = json_obj[json_consts.CLASS_GRAPH]
return create_class_graph_from_json_obj(
class_graph_json_obj), json_obj[json_consts.BUILD_METADATA]
class_graph_json_obj), json_obj.get(json_consts.BUILD_METADATA)
def load_class_and_package_graphs_from_file(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment