Show More
@@ -2,7 +2,7 b'' | |||||
2 | """ |
|
2 | """ | |
3 | Logger class for IPython's logging facilities. |
|
3 | Logger class for IPython's logging facilities. | |
4 |
|
4 | |||
5 |
$Id: Logger.py |
|
5 | $Id: Logger.py 1077 2006-01-24 18:15:27Z vivainio $ | |
6 | """ |
|
6 | """ | |
7 |
|
7 | |||
8 | #***************************************************************************** |
|
8 | #***************************************************************************** | |
@@ -214,6 +214,7 b' which already exists. But you must first start the logging process with' | |||||
214 | def log_write(self,data,kind='input'): |
|
214 | def log_write(self,data,kind='input'): | |
215 | """Write data to the log file, if active""" |
|
215 | """Write data to the log file, if active""" | |
216 |
|
216 | |||
|
217 | #print 'data: %r' % data # dbg | |||
217 | if self.log_active and data: |
|
218 | if self.log_active and data: | |
218 | write = self.logfile.write |
|
219 | write = self.logfile.write | |
219 | if kind=='input': |
|
220 | if kind=='input': |
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Magic functions for InteractiveShell. |
|
2 | """Magic functions for InteractiveShell. | |
3 |
|
3 | |||
4 |
$Id: Magic.py 107 |
|
4 | $Id: Magic.py 1077 2006-01-24 18:15:27Z vivainio $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and | |
@@ -480,27 +480,42 b' Currently the magic system has the following functions:\\n"""' | |||||
480 | def magic_history(self, parameter_s = ''): |
|
480 | def magic_history(self, parameter_s = ''): | |
481 | """Print input history (_i<n> variables), with most recent last. |
|
481 | """Print input history (_i<n> variables), with most recent last. | |
482 |
|
482 | |||
483 |
%history |
|
483 | %history -> print at most 40 inputs (some may be multi-line)\\ | |
484 |
%history |
|
484 | %history n -> print at most n inputs\\ | |
485 |
%history |
|
485 | %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\ | |
486 |
|
486 | |||
487 | Each input's number <n> is shown, and is accessible as the |
|
487 | Each input's number <n> is shown, and is accessible as the | |
488 | automatically generated variable _i<n>. Multi-line statements are |
|
488 | automatically generated variable _i<n>. Multi-line statements are | |
489 | printed starting at a new line for easy copy/paste. |
|
489 | printed starting at a new line for easy copy/paste. | |
490 |
|
490 | |||
491 | If option -n is used, input numbers are not printed. This is useful if |
|
|||
492 | you want to get a printout of many lines which can be directly pasted |
|
|||
493 | into a text editor. |
|
|||
494 |
|
491 | |||
495 | This feature is only available if numbered prompts are in use.""" |
|
492 | Options: | |
|
493 | ||||
|
494 | -n: do NOT print line numbers. This is useful if you want to get a | |||
|
495 | printout of many lines which can be directly pasted into a text | |||
|
496 | editor. | |||
|
497 | ||||
|
498 | This feature is only available if numbered prompts are in use. | |||
|
499 | ||||
|
500 | -r: print the 'raw' history. IPython filters your input and | |||
|
501 | converts it all into valid Python source before executing it (things | |||
|
502 | like magics or aliases are turned into function calls, for | |||
|
503 | example). With this option, you'll see the unfiltered history | |||
|
504 | instead of the filtered version: '%cd /' will be seen as '%cd /' | |||
|
505 | instead of 'ipmagic("%cd /")'. | |||
|
506 | """ | |||
496 |
|
507 | |||
497 | shell = self.shell |
|
508 | shell = self.shell | |
498 | if not shell.outputcache.do_full_cache: |
|
509 | if not shell.outputcache.do_full_cache: | |
499 | print 'This feature is only available if numbered prompts are in use.' |
|
510 | print 'This feature is only available if numbered prompts are in use.' | |
500 | return |
|
511 | return | |
501 | opts,args = self.parse_options(parameter_s,'n',mode='list') |
|
512 | opts,args = self.parse_options(parameter_s,'nr',mode='list') | |
502 |
|
513 | |||
|
514 | if opts.has_key('r'): | |||
|
515 | input_hist = shell.input_hist_raw | |||
|
516 | else: | |||
503 | input_hist = shell.input_hist |
|
517 | input_hist = shell.input_hist | |
|
518 | ||||
504 | default_length = 40 |
|
519 | default_length = 40 | |
505 | if len(args) == 0: |
|
520 | if len(args) == 0: | |
506 | final = len(input_hist) |
|
521 | final = len(input_hist) |
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Release data for the IPython project. |
|
2 | """Release data for the IPython project. | |
3 |
|
3 | |||
4 |
$Id: Release.py 10 |
|
4 | $Id: Release.py 1077 2006-01-24 18:15:27Z vivainio $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> |
|
7 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> | |
@@ -22,9 +22,10 b" name = 'ipython'" | |||||
22 | # because bdist_rpm does not accept dashes (an RPM) convention, and |
|
22 | # because bdist_rpm does not accept dashes (an RPM) convention, and | |
23 | # bdist_deb does not accept underscores (a Debian convention). |
|
23 | # bdist_deb does not accept underscores (a Debian convention). | |
24 |
|
24 | |||
|
25 | ||||
25 | version = '0.7.2.svn' |
|
26 | version = '0.7.2.svn' | |
26 |
|
27 | |||
27 |
revision = '$Revision: 10 |
|
28 | revision = '$Revision: 1077 $' | |
28 |
|
29 | |||
29 | description = "An enhanced interactive Python shell." |
|
30 | description = "An enhanced interactive Python shell." | |
30 |
|
31 |
@@ -80,7 +80,7 b' except NameError:' | |||||
80 | from sets import Set as set |
|
80 | from sets import Set as set | |
81 |
|
81 | |||
82 |
|
82 | |||
83 |
from IPython.genutils import shlex_split,debug |
|
83 | from IPython.genutils import shlex_split,debugx | |
84 |
|
84 | |||
85 | __all__ = ['Completer','IPCompleter'] |
|
85 | __all__ = ['Completer','IPCompleter'] | |
86 |
|
86 |
@@ -5,7 +5,7 b' General purpose utilities.' | |||||
5 | This is a grab-bag of stuff I find useful in most programs I write. Some of |
|
5 | This is a grab-bag of stuff I find useful in most programs I write. Some of | |
6 | these things are also convenient when working at the command line. |
|
6 | these things are also convenient when working at the command line. | |
7 |
|
7 | |||
8 |
$Id: genutils.py 10 |
|
8 | $Id: genutils.py 1077 2006-01-24 18:15:27Z vivainio $""" | |
9 |
|
9 | |||
10 | #***************************************************************************** |
|
10 | #***************************************************************************** | |
11 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
|
11 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> | |
@@ -207,9 +207,10 b' def fatal(msg,exit_val=1):' | |||||
207 |
|
207 | |||
208 | warn(msg,exit_val=exit_val,level=4) |
|
208 | warn(msg,exit_val=exit_val,level=4) | |
209 |
|
209 | |||
210 |
|
210 | #--------------------------------------------------------------------------- | ||
211 | # useful for debugging |
|
211 | # Debugging routines | |
212 | def debugp(expr,pre_msg=''): |
|
212 | # | |
|
213 | def debugx(expr,pre_msg=''): | |||
213 | """Print the value of an expression from the caller's frame. |
|
214 | """Print the value of an expression from the caller's frame. | |
214 |
|
215 | |||
215 | Takes an expression, evaluates it in the caller's frame and prints both |
|
216 | Takes an expression, evaluates it in the caller's frame and prints both | |
@@ -225,7 +226,7 b" def debugp(expr,pre_msg=''):" | |||||
225 | eval(expr,cf.f_globals,cf.f_locals)) |
|
226 | eval(expr,cf.f_globals,cf.f_locals)) | |
226 |
|
227 | |||
227 | # deactivate it by uncommenting the following line, which makes it a no-op |
|
228 | # deactivate it by uncommenting the following line, which makes it a no-op | |
228 |
def debug |
|
229 | #def debugx(expr,pre_msg=''): pass | |
229 |
|
230 | |||
230 | #---------------------------------------------------------------------------- |
|
231 | #---------------------------------------------------------------------------- | |
231 | StringTypes = types.StringTypes |
|
232 | StringTypes = types.StringTypes |
@@ -154,7 +154,7 b' def ev(expr):' | |||||
154 | return eval(expr,user_ns()) |
|
154 | return eval(expr,user_ns()) | |
155 |
|
155 | |||
156 | def launch_new_instance(): |
|
156 | def launch_new_instance(): | |
157 |
""" Creat |
|
157 | """ Create and start a new ipython instance. | |
158 |
|
158 | |||
159 | This can be called even without having an already initialized |
|
159 | This can be called even without having an already initialized | |
160 | ipython session running. |
|
160 | ipython session running. |
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.' | |||||
6 |
|
6 | |||
7 | This file contains all the classes and helper functions specific to IPython. |
|
7 | This file contains all the classes and helper functions specific to IPython. | |
8 |
|
8 | |||
9 |
$Id: iplib.py 10 |
|
9 | $Id: iplib.py 1077 2006-01-24 18:15:27Z vivainio $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
@@ -341,6 +341,10 b' class InteractiveShell(object,Magic):' | |||||
341 | # List of input with multi-line handling. |
|
341 | # List of input with multi-line handling. | |
342 | # Fill its zero entry, user counter starts at 1 |
|
342 | # Fill its zero entry, user counter starts at 1 | |
343 | self.input_hist = InputList(['\n']) |
|
343 | self.input_hist = InputList(['\n']) | |
|
344 | # This one will hold the 'raw' input history, without any | |||
|
345 | # pre-processing. This will allow users to retrieve the input just as | |||
|
346 | # it was exactly typed in by the user, with %hist -r. | |||
|
347 | self.input_hist_raw = InputList(['\n']) | |||
344 |
|
348 | |||
345 | # list of visited directories |
|
349 | # list of visited directories | |
346 | try: |
|
350 | try: | |
@@ -1155,7 +1159,7 b' want to merge them back into the new files.""" % locals()' | |||||
1155 |
|
1159 | |||
1156 | Currently it handles auto-indent only.""" |
|
1160 | Currently it handles auto-indent only.""" | |
1157 |
|
1161 | |||
1158 |
#debug |
|
1162 | #debugx('self.indent_current_nsp','pre_readline:') | |
1159 | self.readline.insert_text(self.indent_current_str()) |
|
1163 | self.readline.insert_text(self.indent_current_str()) | |
1160 |
|
1164 | |||
1161 | def init_readline(self): |
|
1165 | def init_readline(self): | |
@@ -1554,9 +1558,8 b' want to merge them back into the new files.""" % locals()' | |||||
1554 | def autoindent_update(self,line): |
|
1558 | def autoindent_update(self,line): | |
1555 | """Keep track of the indent level.""" |
|
1559 | """Keep track of the indent level.""" | |
1556 |
|
1560 | |||
1557 | #import traceback; traceback.print_stack() # dbg |
|
1561 | #debugx('line') | |
1558 |
|
|
1562 | #debugx('self.indent_current_nsp') | |
1559 | debugp('self.indent_current_nsp') |
|
|||
1560 | if self.autoindent: |
|
1563 | if self.autoindent: | |
1561 | if line: |
|
1564 | if line: | |
1562 | inisp = num_ini_spaces(line) |
|
1565 | inisp = num_ini_spaces(line) | |
@@ -1755,19 +1758,22 b' want to merge them back into the new files.""" % locals()' | |||||
1755 | # Try to be reasonably smart about not re-indenting pasted input more |
|
1758 | # Try to be reasonably smart about not re-indenting pasted input more | |
1756 | # than necessary. We do this by trimming out the auto-indent initial |
|
1759 | # than necessary. We do this by trimming out the auto-indent initial | |
1757 | # spaces, if the user's actual input started itself with whitespace. |
|
1760 | # spaces, if the user's actual input started itself with whitespace. | |
1758 |
#debug |
|
1761 | #debugx('self.buffer[-1]') | |
1759 |
|
1762 | |||
1760 | debugp('line') |
|
|||
1761 | debugp('self.indent_current_nsp') |
|
|||
1762 | if self.autoindent: |
|
1763 | if self.autoindent: | |
1763 | if num_ini_spaces(line) > self.indent_current_nsp: |
|
1764 | if num_ini_spaces(line) > self.indent_current_nsp: | |
1764 | line = line[self.indent_current_nsp:] |
|
1765 | line = line[self.indent_current_nsp:] | |
1765 | self.indent_current_nsp = 0 |
|
1766 | self.indent_current_nsp = 0 | |
1766 | debugp('self.indent_current_nsp') |
|
|||
1767 |
|
1767 | |||
1768 | debugp('line') |
|
1768 | # store the unfiltered input before the user has any chance to modify | |
|
1769 | # it. | |||
|
1770 | if line.strip(): | |||
|
1771 | if continue_prompt: | |||
|
1772 | self.input_hist_raw[-1] += '%s\n' % line | |||
|
1773 | else: | |||
|
1774 | self.input_hist_raw.append('%s\n' % line) | |||
|
1775 | ||||
1769 | lineout = self.prefilter(line,continue_prompt) |
|
1776 | lineout = self.prefilter(line,continue_prompt) | |
1770 | debugp('lineout') |
|
|||
1771 | return lineout |
|
1777 | return lineout | |
1772 |
|
1778 | |||
1773 | def split_user_input(self,line): |
|
1779 | def split_user_input(self,line): | |
@@ -1947,7 +1953,6 b' want to merge them back into the new files.""" % locals()' | |||||
1947 | if (continue_prompt and self.autoindent and line.isspace() and |
|
1953 | if (continue_prompt and self.autoindent and line.isspace() and | |
1948 | (0 < abs(len(line) - self.indent_current_nsp) <= 2 or |
|
1954 | (0 < abs(len(line) - self.indent_current_nsp) <= 2 or | |
1949 | (self.buffer[-1]).isspace() )): |
|
1955 | (self.buffer[-1]).isspace() )): | |
1950 | #print 'reset line' # dbg |
|
|||
1951 | line = '' |
|
1956 | line = '' | |
1952 |
|
1957 | |||
1953 | self.log(line,continue_prompt) |
|
1958 | self.log(line,continue_prompt) |
@@ -7,6 +7,31 b'' | |||||
7 | is_ipython_session() to determine whether we are running |
|
7 | is_ipython_session() to determine whether we are running | |
8 | inside an ipython session. |
|
8 | inside an ipython session. | |
9 |
|
9 | |||
|
10 | * Merged 1071-1076 from banches/0.7.1 | |||
|
11 | ||||
|
12 | 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu> | |||
|
13 | ||||
|
14 | * tools/release (daystamp): Fix build tools to use the new | |||
|
15 | eggsetup.py script to build lightweight eggs. | |||
|
16 | ||||
|
17 | * Applied changesets 1062 and 1064 before 0.7.1 release. | |||
|
18 | ||||
|
19 | * IPython/Magic.py (magic_history): Add '-r' option to %hist, to | |||
|
20 | see the raw input history (without conversions like %ls -> | |||
|
21 | ipmagic("ls")). After a request from W. Stein, SAGE | |||
|
22 | (http://modular.ucsd.edu/sage) developer. This information is | |||
|
23 | stored in the input_hist_raw attribute of the IPython instance, so | |||
|
24 | developers can access it if needed (it's an InputList instance). | |||
|
25 | ||||
|
26 | * Versionstring = 0.7.2.svn | |||
|
27 | ||||
|
28 | * eggsetup.py: A separate script for constructing eggs, creates | |||
|
29 | proper launch scripts even on Windows (an .exe file in | |||
|
30 | \python24\scripts). | |||
|
31 | ||||
|
32 | * ipapi.py: launch_new_instance, launch entry point needed for the | |||
|
33 | egg. | |||
|
34 | ||||
10 | 2006-01-23 Ville Vainio <vivainio@gmail.com> |
|
35 | 2006-01-23 Ville Vainio <vivainio@gmail.com> | |
11 |
|
36 | |||
12 | * Added %cpaste magic for pasting python code |
|
37 | * Added %cpaste magic for pasting python code |
@@ -69,7 +69,7 b'' | |||||
69 | \quotes_language english |
|
69 | \quotes_language english | |
70 | \quotes_times 2 |
|
70 | \quotes_times 2 | |
71 | \papercolumns 1 |
|
71 | \papercolumns 1 | |
72 |
\papersides |
|
72 | \papersides 2 | |
73 | \paperpagestyle fancy |
|
73 | \paperpagestyle fancy | |
74 |
|
74 | |||
75 | \layout Title |
|
75 | \layout Title | |
@@ -87,6 +87,20 b' User Manual, v.' | |||||
87 | \layout Author |
|
87 | \layout Author | |
88 |
|
88 | |||
89 | Fernando P�rez |
|
89 | Fernando P�rez | |
|
90 | \begin_inset Foot | |||
|
91 | collapsed true | |||
|
92 | ||||
|
93 | \layout Standard | |||
|
94 | ||||
|
95 | ||||
|
96 | \size scriptsize | |||
|
97 | Department of Applied Mathematics, University of Colorado at Boulder. | |||
|
98 | ||||
|
99 | \family typewriter | |||
|
100 | <Fernando.Perez@colorado.edu> | |||
|
101 | \end_inset | |||
|
102 | ||||
|
103 | ||||
90 | \layout Standard |
|
104 | \layout Standard | |
91 |
|
105 | |||
92 |
|
106 | |||
@@ -8905,7 +8919,7 b' status Collapsed' | |||||
8905 |
|
8919 | |||
8906 | rez |
|
8920 | rez | |
8907 | \family typewriter |
|
8921 | \family typewriter | |
8908 |
< |
|
8922 | <Fernando.Perez@colorado.edu> | |
8909 | \family default |
|
8923 | \family default | |
8910 | , but the project was born from mixing in Fernando's code with the IPP project |
|
8924 | , but the project was born from mixing in Fernando's code with the IPP project | |
8911 | by Janko Hauser |
|
8925 | by Janko Hauser | |
@@ -8921,7 +8935,7 b' rez' | |||||
8921 |
|
8935 | |||
8922 | \layout Standard |
|
8936 | \layout Standard | |
8923 |
|
8937 | |||
8924 |
As of |
|
8938 | As of early 2006, the following developers have joined the core team: | |
8925 | \layout List |
|
8939 | \layout List | |
8926 | \labelwidthstring 00.00.0000 |
|
8940 | \labelwidthstring 00.00.0000 | |
8927 |
|
8941 | |||
@@ -8956,7 +8970,7 b' Vainio' | |||||
8956 | \family typewriter |
|
8970 | \family typewriter | |
8957 | <vivainio-AT-gmail.com> |
|
8971 | <vivainio-AT-gmail.com> | |
8958 | \family default |
|
8972 | \family default | |
8959 |
: Ville is the new maintainer for the main trunk of IPython a |
|
8973 | : Ville is the new maintainer for the main trunk of IPython after version | |
8960 | 0.7.1. |
|
8974 | 0.7.1. | |
8961 | \layout Standard |
|
8975 | \layout Standard | |
8962 |
|
8976 |
@@ -51,8 +51,8 b' python2.3 ./setup.py bdist_rpm --release=py23 --python=/usr/bin/python2.3' | |||||
51 | python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4 |
|
51 | python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4 | |
52 |
|
52 | |||
53 | # Build eggs |
|
53 | # Build eggs | |
54 |
python2.3 ./ |
|
54 | python2.3 ./eggsetup.py bdist_egg | |
55 |
python2.4 ./ |
|
55 | python2.4 ./eggsetup.py bdist_egg | |
56 |
|
56 | |||
57 | # Call the windows build separately, so that the extra Windows scripts don't |
|
57 | # Call the windows build separately, so that the extra Windows scripts don't | |
58 | # get pulled into Unix builds (setup.py has code which checks for |
|
58 | # get pulled into Unix builds (setup.py has code which checks for | |
@@ -64,7 +64,6 b' python2.4 ./setup_bdist_egg.py' | |||||
64 | $HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \ |
|
64 | $HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \ | |
65 | --install-script=ipython_win_post_install.py |
|
65 | --install-script=ipython_win_post_install.py | |
66 |
|
66 | |||
67 |
|
||||
68 | # Register with the Python Package Index (PyPI) |
|
67 | # Register with the Python Package Index (PyPI) | |
69 | echo "Registering with PyPI..." |
|
68 | echo "Registering with PyPI..." | |
70 | cd $ipdir |
|
69 | cd $ipdir |
@@ -15,8 +15,8 b' python2.3 ./setup.py bdist_rpm --release=py23 --python=/usr/bin/python2.3' | |||||
15 | python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4 |
|
15 | python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4 | |
16 |
|
16 | |||
17 | # Build eggs |
|
17 | # Build eggs | |
18 |
python2.3 ./ |
|
18 | python2.3 ./eggsetup.py bdist_egg | |
19 |
python2.4 ./ |
|
19 | python2.4 ./eggsetup.py bdist_egg | |
20 |
|
20 | |||
21 | # Call the windows build separately, so that the extra Windows scripts don't |
|
21 | # Call the windows build separately, so that the extra Windows scripts don't | |
22 | # get pulled into Unix builds (setup.py has code which checks for |
|
22 | # get pulled into Unix builds (setup.py has code which checks for |
General Comments 0
You need to be logged in to leave comments.
Login now