Show More
@@ -1,23 +1,26 b'' | |||
|
1 | 1 | """Support for interactive macros in IPython""" |
|
2 | 2 | |
|
3 | 3 | #***************************************************************************** |
|
4 | 4 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> |
|
5 | 5 | # |
|
6 | 6 | # Distributed under the terms of the BSD License. The full license is in |
|
7 | 7 | # the file COPYING, distributed as part of this software. |
|
8 | 8 | #***************************************************************************** |
|
9 | 9 | |
|
10 | 10 | class Macro: |
|
11 | 11 | """Simple class to store the value of macros as strings. |
|
12 | 12 | |
|
13 | 13 | This allows us to later exec them by checking when something is an |
|
14 | 14 | instance of this class.""" |
|
15 | 15 | |
|
16 | 16 | def __init__(self,data): |
|
17 | 17 | |
|
18 | 18 | # store the macro value, as a single string which can be evaluated by |
|
19 | 19 | # runlines() |
|
20 | 20 | self.value = ''.join(data).rstrip()+'\n' |
|
21 | 21 | |
|
22 | 22 | def __str__(self): |
|
23 | 23 | return self.value |
|
24 | ||
|
25 | def __repr__(self): | |
|
26 | return 'IPython.macro.Macro(%s)' % repr(self.value) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now