From 638df3d65d04349a033a0b83f1a6435510872882 Mon Sep 17 00:00:00 2001 From: digitalvirtuoso Date: Tue, 6 Oct 2020 22:15:05 -0400 Subject: [PATCH 1/3] Updated to Pathlib Path from os --- docs/autogen_magics.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/autogen_magics.py b/docs/autogen_magics.py index b1662c6bf29..d119e2b6f80 100644 --- a/docs/autogen_magics.py +++ b/docs/autogen_magics.py @@ -1,5 +1,4 @@ -import os - +from pathlib import Path from IPython.core.alias import Alias from IPython.core.interactiveshell import InteractiveShell from IPython.core.magic import MagicAlias @@ -62,7 +61,7 @@ def sortkey(s): return s[0].lower() format_docstring(func), ""]) -here = os.path.dirname(__file__) -dest = os.path.join(here, 'source', 'interactive', 'magics-generated.txt') +src_path = Path(__file__).parent +dest = src_path.joinpath('source', 'interactive', 'magics-generated.txt') with open(dest, "w") as f: f.write("\n".join(output)) From 84dcaaab2e0ef23ef833ce4f870974ab96f627ce Mon Sep 17 00:00:00 2001 From: Adam Hackbarth Date: Mon, 12 Oct 2020 01:18:31 -0400 Subject: [PATCH 2/3] Updated Text Quote formatting --- docs/autogen_magics.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/autogen_magics.py b/docs/autogen_magics.py index d119e2b6f80..1b94fd62fd9 100644 --- a/docs/autogen_magics.py +++ b/docs/autogen_magics.py @@ -9,7 +9,7 @@ def _strip_underline(line): chars = set(line.strip()) - if len(chars) == 1 and ('-' in chars or '=' in chars): + if len(chars) == 1 and ("-" in chars or "=" in chars): return "" else: return line @@ -31,7 +31,7 @@ def format_docstring(func): # Case insensitive sort by name def sortkey(s): return s[0].lower() -for name, func in sorted(magics['line'].items(), key=sortkey): +for name, func in sorted(magics["line"].items(), key=sortkey): if isinstance(func, Alias) or isinstance(func, MagicAlias): # Aliases are magics, but shouldn't be documented here # Also skip aliases to other magics @@ -47,11 +47,11 @@ def sortkey(s): return s[0].lower() "", ]) -for name, func in sorted(magics['cell'].items(), key=sortkey): +for name, func in sorted(magics["cell"].items(), key=sortkey): if name == "!": # Special case - don't encourage people to use %%! continue - if func == magics['line'].get(name, 'QQQP'): + if func == magics["line"].get(name, "QQQP"): # Don't redocument line magics that double as cell magics continue if isinstance(func, MagicAlias): @@ -62,6 +62,6 @@ def sortkey(s): return s[0].lower() ""]) src_path = Path(__file__).parent -dest = src_path.joinpath('source', 'interactive', 'magics-generated.txt') +dest = src_path.joinpath("source", "interactive", "magics-generated.txt") with open(dest, "w") as f: f.write("\n".join(output)) From 7eded0e24c3fc8663ed3865f9d243969963f8b09 Mon Sep 17 00:00:00 2001 From: Adam Hackbarth Date: Mon, 12 Oct 2020 23:08:53 -0400 Subject: [PATCH 3/3] tidy space --- docs/autogen_magics.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/autogen_magics.py b/docs/autogen_magics.py index 4148b29ad46..1f8a47ef506 100644 --- a/docs/autogen_magics.py +++ b/docs/autogen_magics.py @@ -1,4 +1,3 @@ - from pathlib import Path from IPython.core.alias import Alias from IPython.core.interactiveshell import InteractiveShell @@ -62,7 +61,6 @@ def sortkey(s): return s[0].lower() format_docstring(func), ""]) - src_path = Path(__file__).parent dest = src_path.joinpath("source", "interactive", "magics-generated.txt") dest.write_text("\n".join(output))