Show More
@@ -9,7 +9,7 b' magics = shell.magics_manager.magics' | |||||
9 |
|
9 | |||
10 | def _strip_underline(line): |
|
10 | def _strip_underline(line): | |
11 | chars = set(line.strip()) |
|
11 | chars = set(line.strip()) | |
12 |
if len(chars) == 1 and ( |
|
12 | if len(chars) == 1 and ("-" in chars or "=" in chars): | |
13 | return "" |
|
13 | return "" | |
14 | else: |
|
14 | else: | |
15 | return line |
|
15 | return line | |
@@ -31,7 +31,7 b' output = [' | |||||
31 | # Case insensitive sort by name |
|
31 | # Case insensitive sort by name | |
32 | def sortkey(s): return s[0].lower() |
|
32 | def sortkey(s): return s[0].lower() | |
33 |
|
33 | |||
34 |
for name, func in sorted(magics[ |
|
34 | for name, func in sorted(magics["line"].items(), key=sortkey): | |
35 | if isinstance(func, Alias) or isinstance(func, MagicAlias): |
|
35 | if isinstance(func, Alias) or isinstance(func, MagicAlias): | |
36 | # Aliases are magics, but shouldn't be documented here |
|
36 | # Aliases are magics, but shouldn't be documented here | |
37 | # Also skip aliases to other magics |
|
37 | # Also skip aliases to other magics | |
@@ -47,11 +47,11 b' output.extend([' | |||||
47 | "", |
|
47 | "", | |
48 | ]) |
|
48 | ]) | |
49 |
|
49 | |||
50 |
for name, func in sorted(magics[ |
|
50 | for name, func in sorted(magics["cell"].items(), key=sortkey): | |
51 | if name == "!": |
|
51 | if name == "!": | |
52 | # Special case - don't encourage people to use %%! |
|
52 | # Special case - don't encourage people to use %%! | |
53 | continue |
|
53 | continue | |
54 |
if func == magics[ |
|
54 | if func == magics["line"].get(name, "QQQP"): | |
55 | # Don't redocument line magics that double as cell magics |
|
55 | # Don't redocument line magics that double as cell magics | |
56 | continue |
|
56 | continue | |
57 | if isinstance(func, MagicAlias): |
|
57 | if isinstance(func, MagicAlias): | |
@@ -62,6 +62,6 b" for name, func in sorted(magics['cell'].items(), key=sortkey):" | |||||
62 | ""]) |
|
62 | ""]) | |
63 |
|
63 | |||
64 | src_path = Path(__file__).parent |
|
64 | src_path = Path(__file__).parent | |
65 |
dest = src_path.joinpath( |
|
65 | dest = src_path.joinpath("source", "interactive", "magics-generated.txt") | |
66 | with open(dest, "w") as f: |
|
66 | with open(dest, "w") as f: | |
67 | f.write("\n".join(output)) |
|
67 | f.write("\n".join(output)) |
General Comments 0
You need to be logged in to leave comments.
Login now