##// END OF EJS Templates
- Final commits for 0.8.0 tag....
jdh2358 -
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 2221 2007-04-06 02:58:37Z fperez $"""
4 $Id: Magic.py 2225 2007-04-08 02:48:16Z jdh2358 $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -1673,8 +1673,7 b' Currently the magic system has the following functions:\\n"""'
1673 1673 sys.argv = save_argv
1674 1674 if restore_main:
1675 1675 sys.modules['__main__'] = restore_main
1676 if self.shell.has_readline:
1677 self.shell.readline.read_history_file(self.shell.histfile)
1676 self.shell.reloadhist()
1678 1677
1679 1678 return stats
1680 1679
@@ -28,7 +28,7 b''
28 28 scan Python source code and re-emit it with no changes to its original
29 29 formatting (which is the hard part).
30 30
31 $Id: PyColorize.py 2205 2007-04-04 06:04:01Z fperez $"""
31 $Id: PyColorize.py 2225 2007-04-08 02:48:16Z jdh2358 $"""
32 32
33 33 __all__ = ['ANSICodeColors','Parser']
34 34
@@ -131,7 +131,7 b' class Parser:'
131 131 out should be a file-type object. Optionally, out can be given as the
132 132 string 'str' and the parser will automatically return the output in a
133 133 string."""
134
134
135 135 string_output = 0
136 136 if out == 'str' or self.out == 'str':
137 137 out_old = self.out
@@ -155,10 +155,11 b' class Parser:'
155 155
156 156 # Remove trailing whitespace and normalize tabs
157 157 self.raw = raw.expandtabs().rstrip()
158
158 159 # store line offsets in self.lines
159 160 self.lines = [0, 0]
160 161 pos = 0
161 raw_find = raw.find
162 raw_find = self.raw.find
162 163 lines_append = self.lines.append
163 164 while 1:
164 165 pos = raw_find('\n', pos) + 1
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 2221 2007-04-06 02:58:37Z fperez $
9 $Id: iplib.py 2225 2007-04-08 02:48:16Z jdh2358 $
10 10 """
11 11
12 12 #*****************************************************************************
@@ -355,6 +355,11 b' class InteractiveShell(object,Magic):'
355 355 # dict of output history
356 356 self.output_hist = {}
357 357
358 # Get system encoding at startup time. Certain terminals (like Emacs
359 # under Win32 have it set to None, and we need to have a known valid
360 # encoding to use in the raw_input() method
361 self.stdin_encoding = sys.stdin.encoding or 'ascii'
362
358 363 # dict of things NOT to alias (keywords, builtins and some magics)
359 364 no_alias = {}
360 365 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
@@ -410,7 +415,8 b' class InteractiveShell(object,Magic):'
410 415 # Set all default hooks, defined in the IPython.hooks module.
411 416 hooks = IPython.hooks
412 417 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
418 # default hooks have priority 100, i.e. low; user hooks should have
419 # 0-100 priority
414 420 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 421 #print "bound hook",hook_name
416 422
@@ -495,7 +501,6 b' class InteractiveShell(object,Magic):'
495 501 r'(\S*\s*)'
496 502 r'(\(?.*$)')
497 503
498
499 504 # A simpler regexp used as a fallback if the above doesn't work. This
500 505 # one is more conservative in how it partitions the input. This code
501 506 # can probably be cleaned up to do everything with just one regexp, but
@@ -1245,6 +1250,13 b' want to merge them back into the new files.""" % locals()'
1245 1250 print 'Unable to save IPython command history to file: ' + \
1246 1251 `self.histfile`
1247 1252
1253 def reloadhist(self):
1254 """Reload the input history from disk file."""
1255
1256 if self.has_readline:
1257 self.readline.clear_history()
1258 self.readline.read_history_file(self.shell.histfile)
1259
1248 1260 def history_saving_wrapper(self, func):
1249 1261 """ Wrap func for readline history saving
1250 1262
@@ -1988,7 +2000,7 b' want to merge them back into the new files.""" % locals()'
1988 2000 self.set_completer()
1989 2001
1990 2002 try:
1991 line = raw_input_original(prompt).decode(sys.stdin.encoding)
2003 line = raw_input_original(prompt).decode(self.stdin_encoding)
1992 2004 except ValueError:
1993 2005 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
1994 2006 " or sys.stdout.close()!\nExiting IPython!")
@@ -1,3 +1,15 b''
1 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * Tag 0.8.0 for release.
4
5 * IPython/iplib.py (reloadhist): add API function to cleanly
6 reload the readline history, which was growing inappropriately on
7 every %run call.
8
9 * win32_manual_post_install.py (run): apply last part of Nicolas
10 Pernetty's patch (I'd accidentally applied it in a different
11 directory and this particular file didn't get patched).
12
1 13 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
2 14
3 15 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
@@ -4430,28 +4430,47 b' In [6]: cd ipython # automagic can work again'
4430 4430
4431 4431 \begin_layout Standard
4432 4432 You can define your own magic functions to extend the system.
4433 The following is a snippet of code which shows how to do it.
4434 It is provided as file
4433 The following example defines a new magic command,
4435 4434 \family typewriter
4436 example-magic.py
4435 %impall
4437 4436 \family default
4438 in the examples directory:
4437 :
4439 4438 \end_layout
4440 4439
4441 \begin_layout Standard
4442 \begin_inset ERT
4443 status open
4440 \begin_layout LyX-Code
4441 import IPython.ipapi
4442 \end_layout
4444 4443
4445 \begin_layout Standard
4444 \begin_layout LyX-Code
4445 ip = IPython.ipapi.get()
4446 \end_layout
4446 4447
4448 \begin_layout LyX-Code
4447 4449
4448 \backslash
4449 codelist{examples/example-magic.py}
4450 4450 \end_layout
4451 4451
4452 \end_inset
4452 \begin_layout LyX-Code
4453 def doimp(self, arg):
4454 \end_layout
4453 4455
4456 \begin_layout LyX-Code
4457 ip = self.api
4458 \end_layout
4454 4459
4460 \begin_layout LyX-Code
4461 ip.ex("import %s; reload(%s); from %s import *" % (
4462 \end_layout
4463
4464 \begin_layout LyX-Code
4465 arg,arg,arg)
4466 \end_layout
4467
4468 \begin_layout LyX-Code
4469 )
4470 \end_layout
4471
4472 \begin_layout LyX-Code
4473 ip.expose_magic('impall', doimp)
4455 4474 \end_layout
4456 4475
4457 4476 \begin_layout Standard
@@ -55,7 +55,6 b" if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):"
55 55 ['doc/manual.lyx',
56 56 'doc/magic.tex',
57 57 'doc/examples/example-gnuplot.py',
58 'doc/examples/example-magic.py',
59 58 'doc/examples/example-embed.py',
60 59 'doc/examples/example-embed-short.py',
61 60 'IPython/UserConfig/ipythonrc',
@@ -94,6 +94,11 b' def run(wait=0):'
94 94 sys.prefix + r'\Scripts\ipython" %*')
95 95 fic.close()
96 96
97 # Create .bat file in \\Scripts
98 fic = open(sys.prefix + '\\Scripts\\ipython.bat','w')
99 fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*')
100 fic.close()
101
97 102 # Create shortcuts in Programs\IPython:
98 103 if not os.path.isdir(ip_prog_dir):
99 104 os.mkdir(ip_prog_dir)
General Comments 0
You need to be logged in to leave comments. Login now