Show More
@@ -1997,7 +1997,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1997 | 1997 | from IPython.core import magics as m |
|
1998 | 1998 | self.magics_manager = magic.MagicsManager(shell=self, |
|
1999 | 1999 | confg=self.config, |
|
2000 |
user_magics=m |
|
|
2000 | user_magics=m.UserMagics(self)) | |
|
2001 | 2001 | self.configurables.append(self.magics_manager) |
|
2002 | 2002 | |
|
2003 | 2003 | # Expose as public API from the magics manager |
@@ -165,7 +165,7 b' class MagicsManager(Configurable):' | |||
|
165 | 165 | 'Automagic is OFF, % prefix IS needed for magic functions.', |
|
166 | 166 | 'Automagic is ON, % prefix IS NOT needed for magic functions.'] |
|
167 | 167 | |
|
168 |
user_magics = Instance('IPython.core.magic |
|
|
168 | user_magics = Instance('IPython.core.magics.UserMagics') | |
|
169 | 169 | |
|
170 | 170 | def __init__(self, shell=None, config=None, user_magics=None, **traits): |
|
171 | 171 |
@@ -61,20 +61,6 b' from IPython.utils.text import format_screen' | |||
|
61 | 61 | from IPython.utils.timing import clock, clock2 |
|
62 | 62 | from IPython.utils.warn import warn, error |
|
63 | 63 | |
|
64 | #----------------------------------------------------------------------------- | |
|
65 | # Magic implementation classes | |
|
66 | #----------------------------------------------------------------------------- | |
|
67 | ||
|
68 | @register_magics | |
|
69 | class UserMagics(Magics): | |
|
70 | """Placeholder for user-defined magics to be added at runtime. | |
|
71 | ||
|
72 | All magics are eventually merged into a single namespace at runtime, but we | |
|
73 | use this class to isolate the magics defined dynamically by the user into | |
|
74 | their own class. | |
|
75 | """ | |
|
76 | ||
|
77 | ||
|
78 | 64 | @register_magics |
|
79 | 65 | class BasicMagics(Magics): |
|
80 | 66 | """Magics that provide central IPython functionality. |
@@ -11,4 +11,19 b'' | |||
|
11 | 11 | #----------------------------------------------------------------------------- |
|
12 | 12 | # Imports |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 | from IPython.core.magic import Magics, register_magics | |
|
14 | 15 | from history import (HistoryMagics) |
|
16 | ||
|
17 | ||
|
18 | #----------------------------------------------------------------------------- | |
|
19 | # Magic implementation classes | |
|
20 | #----------------------------------------------------------------------------- | |
|
21 | ||
|
22 | @register_magics | |
|
23 | class UserMagics(Magics): | |
|
24 | """Placeholder for user-defined magics to be added at runtime. | |
|
25 | ||
|
26 | All magics are eventually merged into a single namespace at runtime, but we | |
|
27 | use this class to isolate the magics defined dynamically by the user into | |
|
28 | their own class. | |
|
29 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now