Skip to content

Commit

Permalink
Add silent option to %graph_notebook_vis_options (#203)
Browse files Browse the repository at this point in the history
* Add silent option to %graph_notebook_vis_options

* Update changelog

Co-authored-by: Michael Chin <[email protected]>
  • Loading branch information
michaelnchin and michaelnchin authored Sep 28, 2021
1 parent 816c1d5 commit 5e6a806
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +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
- Added `--silent` option for suppressing query output ([Link to PR](https://github.com/aws/graph-notebook/pull/201))
- Added `--silent` option for suppressing query output ([PR #1](https://github.com/aws/graph-notebook/pull/201)) ([PR #2](https://github.com/aws/graph-notebook/pull/203))

## Release 3.0.6 (September 20, 2021)
- Added a new `%stream_viewer` magic that allows interactive exploration of the Neptune CDC stream (if enabled). ([Link to PR](https://github.com/aws/graph-notebook/pull/191))
Expand Down
15 changes: 14 additions & 1 deletion src/graph_notebook/magics/graph_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,11 +1368,24 @@ def graph_notebook_version(self, line):
@line_cell_magic
@display_exceptions
def graph_notebook_vis_options(self, line='', cell=''):
parser = argparse.ArgumentParser()
parser.add_argument('--silent', action='store_true', default=False, help="Display no output.")
line_args = line.split()
if line_args:
if line_args[0] == 'reset':
line = 'reset'
if len(line_args) > 1:
line_args = line_args[1:]
else:
line_args = []
args = parser.parse_args(line_args)

if line == 'reset':
self.graph_notebook_vis_options = OPTIONS_DEFAULT_DIRECTED

if cell == '':
print(json.dumps(self.graph_notebook_vis_options, indent=2))
if not args.silent:
print(json.dumps(self.graph_notebook_vis_options, indent=2))
else:
options_dict = json.loads(cell)
self.graph_notebook_vis_options = vis_options_merge(self.graph_notebook_vis_options, options_dict)
Expand Down

0 comments on commit 5e6a806

Please sign in to comment.