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