Show More
@@ -228,16 +228,16 b' class Magics(object):' | |||||
228 | """ |
|
228 | """ | |
229 | # Dict holding all command-line options for each magic. |
|
229 | # Dict holding all command-line options for each magic. | |
230 | options_table = None |
|
230 | options_table = None | |
231 |
|
231 | # Dict for the mapping of magic names to methods, set by class decorator | ||
232 | # Non-configurable class attributes |
|
232 | magics = None | |
233 | magics = Dict |
|
233 | # Flag to check that the class decorator was properly applied | |
234 |
|
||||
235 | registered = False |
|
234 | registered = False | |
236 |
|
235 | |||
237 | def __init__(self, shell): |
|
236 | def __init__(self, shell): | |
238 | if not(self.__class__.registered): |
|
237 | if not(self.__class__.registered): | |
239 | raise ValueError('unregistered Magics') |
|
238 | raise ValueError('unregistered Magics') | |
240 | self.shell = shell |
|
239 | self.shell = shell | |
|
240 | self.options_table = {} | |||
241 | mtab = dict(line={}, cell={}) |
|
241 | mtab = dict(line={}, cell={}) | |
242 | for mtype in magic_types: |
|
242 | for mtype in magic_types: | |
243 | tab = mtab[mtype] |
|
243 | tab = mtab[mtype] | |
@@ -251,7 +251,7 b' class Magics(object):' | |||||
251 | print 'Error in arguments:' |
|
251 | print 'Error in arguments:' | |
252 | print oinspect.getdoc(func) |
|
252 | print oinspect.getdoc(func) | |
253 |
|
253 | |||
254 | def format_latex(self,strng): |
|
254 | def format_latex(self, strng): | |
255 | """Format a string for latex inclusion.""" |
|
255 | """Format a string for latex inclusion.""" | |
256 |
|
256 | |||
257 | # Characters that need to be escaped for latex: |
|
257 | # Characters that need to be escaped for latex: | |
@@ -301,7 +301,7 b' class Magics(object):' | |||||
301 | standard library.""" |
|
301 | standard library.""" | |
302 |
|
302 | |||
303 | # inject default options at the beginning of the input line |
|
303 | # inject default options at the beginning of the input line | |
304 |
caller = sys._getframe(1).f_code.co_name |
|
304 | caller = sys._getframe(1).f_code.co_name | |
305 | arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str) |
|
305 | arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str) | |
306 |
|
306 | |||
307 | mode = kw.get('mode','string') |
|
307 | mode = kw.get('mode','string') |
General Comments 0
You need to be logged in to leave comments.
Login now