From 2ce60f756e129a28179a6fbd6bce08c696e1f305 Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Wed, 15 Mar 2023 18:36:31 -0700 Subject: [PATCH 1/2] Fix --store-to for %statistics and %summary --- src/graph_notebook/magics/graph_magic.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/graph_notebook/magics/graph_magic.py b/src/graph_notebook/magics/graph_magic.py index 8b3809f7..7a933a35 100644 --- a/src/graph_notebook/magics/graph_magic.py +++ b/src/graph_notebook/magics/graph_magic.py @@ -416,6 +416,8 @@ def stream_viewer(self,line): viewer.show() @line_magic + @needs_local_scope + @display_exceptions def statistics(self, line, local_ns: dict = None): parser = argparse.ArgumentParser() parser.add_argument('language', nargs='?', type=str.lower, default="propertygraph", @@ -453,10 +455,11 @@ def statistics(self, line, local_ns: dict = None): if not args.silent: print(json.dumps(statistics_res_json, indent=2)) - if args.store_to != '' and local_ns is not None: - local_ns[args.store_to] = statistics_res_json + store_to_ns(args.store_to, statistics_res_json, local_ns) @line_magic + @needs_local_scope + @display_exceptions def summary(self, line, local_ns: dict = None): parser = argparse.ArgumentParser() parser.add_argument('language', nargs='?', type=str.lower, default="propertygraph", @@ -484,8 +487,7 @@ def summary(self, line, local_ns: dict = None): if not args.silent: print(json.dumps(summary_res_json, indent=2)) - if args.store_to != '' and local_ns is not None: - local_ns[args.store_to] = summary_res_json + store_to_ns(args.store_to, summary_res_json, local_ns) @line_magic def graph_notebook_host(self, line): @@ -1903,8 +1905,7 @@ def load_ids(self, line, local_ns: dict = None): vbox = widgets.VBox(labels) display(vbox) - if args.store_to != '' and local_ns is not None: - local_ns[args.store_to] = res + store_to_ns(args.store_to, res, local_ns) @line_magic @display_exceptions @@ -1934,8 +1935,7 @@ def load_status(self, line, local_ns: dict = None): if not args.silent: print(json.dumps(res, indent=2)) - if args.store_to != '' and local_ns is not None: - local_ns[args.store_to] = res + store_to_ns(args.store_to, res, local_ns) @line_magic @display_exceptions @@ -1984,8 +1984,7 @@ def cancel_load(self, line, local_ns: dict = None): else: print("No cancellable load jobs were found.") - if args.store_to != '' and local_ns is not None: - local_ns[args.store_to] = raw_res + store_to_ns(args.store_to, raw_res, local_ns) @line_magic @display_exceptions From 27c4e2452df398f91ade94e583207fcb3bf7f92e Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Wed, 15 Mar 2023 19:22:13 -0700 Subject: [PATCH 2/2] update changelog --- ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.md b/ChangeLog.md index 5b307022..5fedf8b1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ Starting with v1.31.6, this file will contain a record of major features and updates made in each release of graph-notebook. ## Upcoming +- Fixed `--store-to` option for several magics ([Link to PR](https://github.com/aws/graph-notebook/pull/463)) ## Release 3.7.3 (March 14, 2023) - Fixed detailed mode output for graph summary requests ([Link to PR](https://github.com/aws/graph-notebook/pull/461))