Show More
@@ -5,7 +5,7 b' We define a special input line filter to allow typing lines which begin with' | |||
|
5 | 5 | '~', '/' or '.'. If one of those strings is encountered, it is automatically |
|
6 | 6 | executed. |
|
7 | 7 | |
|
8 |
$Id: InterpreterExec.py 1 |
|
|
8 | $Id: InterpreterExec.py 1121 2006-02-01 21:12:20Z vivainio $""" | |
|
9 | 9 | |
|
10 | 10 | #***************************************************************************** |
|
11 | 11 | # Copyright (C) 2004 W.J. van der Laan <gnufnork@hetdigitalegat.nl> |
@@ -20,6 +20,7 b" __author__ = 'W.J. van der Laan <gnufnork@hetdigitalegat.nl>, '\\" | |||
|
20 | 20 | '%s <%s>' % Release.authors['Fernando'] |
|
21 | 21 | __license__ = Release.license |
|
22 | 22 | |
|
23 | # TODO: deprecated | |
|
23 | 24 | def prefilter_shell(self,line,continuation): |
|
24 | 25 | """Alternate prefilter, modified for shell-like functionality. |
|
25 | 26 | |
@@ -234,10 +235,6 b' def pysh():' | |||
|
234 | 235 | # doesn't really expose a clean API for it. Be careful if you start making |
|
235 | 236 | # many modifications here. |
|
236 | 237 | |
|
237 | print """\ | |
|
238 | Welcome to pysh, a set of extensions to IPython for shell usage. | |
|
239 | help(pysh) -> help on the installed shell extensions and syntax. | |
|
240 | """ | |
|
241 | 238 | |
|
242 | 239 | # Set the 'cd' command to quiet mode, a more shell-like behavior |
|
243 | 240 | __IPYTHON__.default_option('cd','-q') |
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Magic functions for InteractiveShell. |
|
3 | 3 | |
|
4 |
$Id: Magic.py 11 |
|
|
4 | $Id: Magic.py 1121 2006-02-01 21:12:20Z vivainio $""" | |
|
5 | 5 | |
|
6 | 6 | #***************************************************************************** |
|
7 | 7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -2698,8 +2698,19 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2698 | 2698 | This magic is similar to the cat utility, but it will assume the file |
|
2699 | 2699 | to be Python source and will show it with syntax highlighting. """ |
|
2700 | 2700 | |
|
2701 | filename = get_py_filename(parameter_s) | |
|
2702 | page(self.shell.pycolorize(file_read(filename)), | |
|
2701 | try: | |
|
2702 | filename = get_py_filename(parameter_s) | |
|
2703 | cont = file_read(filename) | |
|
2704 | except IOError: | |
|
2705 | try: | |
|
2706 | cont = eval(parameter_s,self.user_ns) | |
|
2707 | except NameError: | |
|
2708 | cont = None | |
|
2709 | if cont is None: | |
|
2710 | print "Error: no such file or variable" | |
|
2711 | return | |
|
2712 | ||
|
2713 | page(self.shell.pycolorize(cont), | |
|
2703 | 2714 | screen_lines=self.shell.rc.screen_length) |
|
2704 | 2715 | |
|
2705 | 2716 | def magic_cpaste(self, parameter_s=''): |
@@ -3,51 +3,63 b'' | |||
|
3 | 3 | This is a more flexible and safe way to configure ipython than *rc files |
|
4 | 4 | (ipythonrc, ipythonrc-pysh etc.) |
|
5 | 5 | |
|
6 |
This file is always imported on ipython startup. You |
|
|
6 | This file is always imported on ipython startup. You can import the | |
|
7 | 7 | ipython extensions you need here (see IPython/Extensions directory). |
|
8 | 8 | |
|
9 |
Feel free to edit this file to customize your ipython experience. |
|
|
10 | you wish to only use the old config system, it's perfectly ok to make this file | |
|
11 | empty. | |
|
9 | Feel free to edit this file to customize your ipython experience. | |
|
10 | ||
|
11 | Note that as such this file does nothing, for backwards compatibility. | |
|
12 | To enable this config file, uncomment the call to main() at the end. | |
|
13 | ||
|
14 | Try it out! | |
|
12 | 15 | |
|
13 | 16 | """ |
|
14 | 17 | |
|
15 | 18 | # Most of your config files and extensions will probably start with this import |
|
16 | 19 | |
|
17 | 20 | from IPython import ipapi |
|
18 | ip = ipapi.get() | |
|
19 | 21 | import os |
|
22 | from IPython import Release | |
|
20 | 23 | |
|
21 | o = ip.options() | |
|
22 | # autocall 1 ('smart') is default anyway, this is just an | |
|
23 | # example on how to set an option | |
|
24 | o.autocall = 1 | |
|
24 | import sys | |
|
25 | 25 | |
|
26 | if o.profile == 'pysh': | |
|
26 | ||
|
27 | def main(): | |
|
28 | ip = ipapi.get() | |
|
29 | o = ip.options() | |
|
30 | # autocall to "full" mode (smart mode is default, I like full mode) | |
|
31 | ||
|
32 | o.autocall = 1 | |
|
33 | ||
|
27 | 34 | # Jason Orendorff's path class is handy to have in user namespace |
|
28 | 35 | # if you are doing shell-like stuff |
|
29 | 36 | try: |
|
30 | 37 | ip.ex("from path import path" ) |
|
31 | 38 | except ImportError: |
|
32 | 39 | pass |
|
40 | ||
|
41 | # Get prompt with working dir | |
|
33 | 42 | |
|
34 | # Uncomment these lines to get pysh-like prompt for all profiles. | |
|
35 | ||
|
36 | #o.prompt_in1= '\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> ' | |
|
37 | #o.prompt_in2= '\C_Green|\C_LightGreen\D\C_Green> ' | |
|
38 | #o.prompt_out= '<\#> ' | |
|
39 | ||
|
40 | # make 'd' an alias for ls -F | |
|
41 | ||
|
42 | ip.magic('alias d ls -F --color=auto') | |
|
43 | ||
|
44 | # Make available all system commands through "rehashing" immediately. | |
|
45 | # You can comment these lines out to speed up startup on very slow | |
|
46 | # machines, and to conserve a bit of memory. Note that pysh profile does this | |
|
47 | # automatically | |
|
43 | o.prompt_in1= '\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> ' | |
|
44 | o.prompt_in2= '\C_Green|\C_LightGreen\D\C_Green> ' | |
|
45 | o.prompt_out= '<\#> ' | |
|
46 | ||
|
47 | # I like my banner minimal. | |
|
48 | o.banner = "Py %s IPy %s\n" % (sys.version.split('\n')[0],Release.version) | |
|
49 | ||
|
50 | # make 'd' an alias for ls -F | |
|
51 | ||
|
52 | ip.magic('alias d ls -F --color=auto') | |
|
53 | ||
|
54 | # Make available all system commands through "rehashing" immediately. | |
|
55 | # You can comment these lines out to speed up startup on very slow | |
|
56 | # machines, and to conserve a bit of memory. Note that pysh profile does this | |
|
57 | # automatically | |
|
58 | ||
|
59 | #if os.name=='posix': | |
|
60 | # ip.magic('rehash') | |
|
61 | #else: | |
|
62 | # #slightly slower, but better results esp. with Windows | |
|
63 | # ip.magic('rehashx') | |
|
48 | 64 | |
|
49 | #if os.name=='posix': | |
|
50 | # ip.magic('rehash') | |
|
51 | #else: | |
|
52 | # #slightly slower, but better results esp. with Windows | |
|
53 | # ip.magic('rehashx') | |
|
65 | #main() No newline at end of file |
@@ -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 111 |
|
|
9 | $Id: iplib.py 1121 2006-02-01 21:12:20Z vivainio $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
@@ -1320,10 +1320,14 b' want to merge them back into the new files.""" % locals()' | |||
|
1320 | 1320 | if self.rc.c: # Emulate Python's -c option |
|
1321 | 1321 | self.exec_init_cmd() |
|
1322 | 1322 | if banner is None: |
|
1323 | if self.rc.banner: | |
|
1324 | banner = self.BANNER+self.banner2 | |
|
1325 | else: | |
|
1323 | if not self.rc.banner: | |
|
1326 | 1324 | banner = '' |
|
1325 | # banner is string? Use it directly! | |
|
1326 | elif isinstance(self.rc.banner,basestring): | |
|
1327 | banner = self.rc.banner | |
|
1328 | else: | |
|
1329 | banner = self.BANNER+self.banner2 | |
|
1330 | ||
|
1327 | 1331 | self.interact(banner) |
|
1328 | 1332 | |
|
1329 | 1333 | def exec_init_cmd(self): |
@@ -1,6 +1,15 b'' | |||
|
1 | 1 | 2006-02-01 Ville Vainio <vivainio@gmail.com> |
|
2 | 2 | |
|
3 |
* easy_install ipython==dev works |
|
|
3 | * setup.py, eggsetup.py: easy_install ipython==dev works | |
|
4 | correctly now (on Linux) | |
|
5 | ||
|
6 | * ipy_user_conf,ipmaker: user config changes, removed spurious | |
|
7 | warnings | |
|
8 | ||
|
9 | * iplib: if rc.banner is string, use it as is. | |
|
10 | ||
|
11 | * Magic: %pycat accepts a string argument and pages it's contents. | |
|
12 | ||
|
4 | 13 | |
|
5 | 14 | 2006-01-30 Ville Vainio <vivainio@gmail.com> |
|
6 | 15 |
General Comments 0
You need to be logged in to leave comments.
Login now