Show More
@@ -1,9 +1,9 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ IPython extension: add %clear magic """ |
|
2 | """ IPython extension: add %clear magic """ | |
3 |
|
3 | |||
4 |
|
|
4 | from IPython.core import ipapi | |
5 | import gc |
|
5 | import gc | |
6 |
ip = |
|
6 | ip = ipapi.get() | |
7 |
|
7 | |||
8 | def clear_f(self,arg): |
|
8 | def clear_f(self,arg): | |
9 | """ Clear various data (e.g. stored history data) |
|
9 | """ Clear various data (e.g. stored history data) |
@@ -2,8 +2,8 b'' | |||||
2 | """ %env magic command for storing environment variables persistently |
|
2 | """ %env magic command for storing environment variables persistently | |
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
5 |
|
|
5 | from IPython.core import ipapi | |
6 |
ip = |
|
6 | ip = ipapi.get() | |
7 |
|
7 | |||
8 | import os,sys |
|
8 | import os,sys | |
9 |
|
9 | |||
@@ -16,7 +16,7 b' def restore_env(self):' | |||||
16 | os.environ[k] = os.environ.get(k,"") + v |
|
16 | os.environ[k] = os.environ.get(k,"") + v | |
17 | for k,v in env['pre']: |
|
17 | for k,v in env['pre']: | |
18 | os.environ[k] = v + os.environ.get(k,"") |
|
18 | os.environ[k] = v + os.environ.get(k,"") | |
19 |
raise |
|
19 | raise ipapi.TryNext | |
20 |
|
20 | |||
21 | ip.set_hook('late_startup_hook', restore_env) |
|
21 | ip.set_hook('late_startup_hook', restore_env) | |
22 |
|
22 |
@@ -8,10 +8,10 b' var = %magic blah blah' | |||||
8 | var = !ls |
|
8 | var = !ls | |
9 | """ |
|
9 | """ | |
10 |
|
10 | |||
11 |
|
|
11 | from IPython.core import ipapi | |
12 | from IPython.utils.genutils import * |
|
12 | from IPython.utils.genutils import * | |
13 |
|
13 | |||
14 |
ip = |
|
14 | ip = ipapi.get() | |
15 |
|
15 | |||
16 | import re |
|
16 | import re | |
17 |
|
17 | |||
@@ -58,6 +58,6 b' def regex_prefilter_f(self,line):' | |||||
58 | if mo: |
|
58 | if mo: | |
59 | return handler(line,mo) |
|
59 | return handler(line,mo) | |
60 |
|
60 | |||
61 |
raise |
|
61 | raise ipapi.TryNext | |
62 |
|
62 | |||
63 | ip.set_hook('input_prefilter', regex_prefilter_f) |
|
63 | ip.set_hook('input_prefilter', regex_prefilter_f) |
@@ -2,7 +2,7 b'' | |||||
2 |
|
2 | |||
3 | import curses, fcntl, signal, struct, tty, textwrap, inspect |
|
3 | import curses, fcntl, signal, struct, tty, textwrap, inspect | |
4 |
|
4 | |||
5 | from IPython import ipapi |
|
5 | from IPython.coreZ import ipapi | |
6 |
|
6 | |||
7 | import astyle, ipipe |
|
7 | import astyle, ipipe | |
8 |
|
8 |
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: iso-8859-1 -*- |
|
1 | # -*- coding: iso-8859-1 -*- | |
2 |
|
2 | |||
3 | import ipipe, os, webbrowser, urllib |
|
3 | import ipipe, os, webbrowser, urllib | |
4 | from IPython import ipapi |
|
4 | from IPython.core import ipapi | |
5 | import wx |
|
5 | import wx | |
6 | import wx.grid, wx.html |
|
6 | import wx.grid, wx.html | |
7 |
|
7 |
@@ -139,7 +139,7 b' except ImportError:' | |||||
139 | genutils = None |
|
139 | genutils = None | |
140 | generics = None |
|
140 | generics = None | |
141 |
|
141 | |||
142 | from IPython import ipapi |
|
142 | from IPython.core import ipapi | |
143 |
|
143 | |||
144 |
|
144 | |||
145 | __all__ = [ |
|
145 | __all__ = [ |
@@ -5,9 +5,9 b' IPython extension that installs the completers related to external apps.' | |||||
5 | The actual implementations are in Extensions/ipy_completers.py |
|
5 | The actual implementations are in Extensions/ipy_completers.py | |
6 |
|
6 | |||
7 | """ |
|
7 | """ | |
8 |
|
|
8 | from IPython.core import ipapi | |
9 |
|
9 | |||
10 |
ip = |
|
10 | ip = ipapi.get() | |
11 |
|
11 | |||
12 | from ipy_completers import * |
|
12 | from ipy_completers import * | |
13 |
|
13 |
@@ -224,15 +224,15 b' reloader = ModuleReloader()' | |||||
224 | #------------------------------------------------------------------------------ |
|
224 | #------------------------------------------------------------------------------ | |
225 | # IPython connectivity |
|
225 | # IPython connectivity | |
226 | #------------------------------------------------------------------------------ |
|
226 | #------------------------------------------------------------------------------ | |
227 |
|
|
227 | from IPython.core import ipapi | |
228 |
|
228 | |||
229 |
ip = |
|
229 | ip = ipapi.get() | |
230 |
|
230 | |||
231 | autoreload_enabled = False |
|
231 | autoreload_enabled = False | |
232 |
|
232 | |||
233 | def runcode_hook(self): |
|
233 | def runcode_hook(self): | |
234 | if not autoreload_enabled: |
|
234 | if not autoreload_enabled: | |
235 |
raise |
|
235 | raise ipapi.TryNext | |
236 | try: |
|
236 | try: | |
237 | reloader.check() |
|
237 | reloader.check() | |
238 | except: |
|
238 | except: |
@@ -7,12 +7,12 b' but the basic idea is to do:' | |||||
7 | ip.set_hook('complete_command', svn_completer, str_key = 'svn') |
|
7 | ip.set_hook('complete_command', svn_completer, str_key = 'svn') | |
8 |
|
8 | |||
9 | """ |
|
9 | """ | |
10 | import IPython.ipapi |
|
10 | import IPython.core import ipapi | |
11 | import glob,os,shlex,sys |
|
11 | import glob,os,shlex,sys | |
12 | import inspect |
|
12 | import inspect | |
13 | from time import time |
|
13 | from time import time | |
14 | from zipimport import zipimporter |
|
14 | from zipimport import zipimporter | |
15 |
ip = |
|
15 | ip = ipapi.get() | |
16 |
|
16 | |||
17 | try: |
|
17 | try: | |
18 | set |
|
18 | set | |
@@ -329,7 +329,7 b' def cd_completer(self, event):' | |||||
329 | if ' ' in d: |
|
329 | if ' ' in d: | |
330 | # we don't want to deal with any of that, complex code |
|
330 | # we don't want to deal with any of that, complex code | |
331 | # for this is elsewhere |
|
331 | # for this is elsewhere | |
332 |
raise |
|
332 | raise ipapi.TryNext | |
333 | found.append( d ) |
|
333 | found.append( d ) | |
334 |
|
334 | |||
335 | if not found: |
|
335 | if not found: | |
@@ -341,7 +341,7 b' def cd_completer(self, event):' | |||||
341 | if bkmatches: |
|
341 | if bkmatches: | |
342 | return bkmatches |
|
342 | return bkmatches | |
343 |
|
343 | |||
344 |
raise |
|
344 | raise ipapi.TryNext | |
345 |
|
345 | |||
346 |
|
346 | |||
347 | def single_dir_expand(matches): |
|
347 | def single_dir_expand(matches): |
@@ -13,8 +13,8 b' ipy_profile_PROFILENAME etc.' | |||||
13 | """ |
|
13 | """ | |
14 |
|
14 | |||
15 | import IPython.rlineimpl as readline |
|
15 | import IPython.rlineimpl as readline | |
16 |
|
|
16 | from IPython.core import ipapi | |
17 |
ip = |
|
17 | ip = ipapi.get() | |
18 |
|
18 | |||
19 | o = ip.options |
|
19 | o = ip.options | |
20 |
|
20 |
@@ -5,8 +5,8 b' They should honor the line number argument, at least.' | |||||
5 | Contributions are *very* welcome. |
|
5 | Contributions are *very* welcome. | |
6 | """ |
|
6 | """ | |
7 |
|
7 | |||
8 |
|
|
8 | from IPython.core import ipapi | |
9 |
ip = |
|
9 | ip = ipapi.get() | |
10 |
|
10 | |||
11 | from IPython.Itpl import itplns |
|
11 | from IPython.Itpl import itplns | |
12 | import os |
|
12 | import os | |
@@ -29,7 +29,7 b' def install_editor(run_template, wait = False):' | |||||
29 | cmd = itplns(run_template, locals()) |
|
29 | cmd = itplns(run_template, locals()) | |
30 | print ">",cmd |
|
30 | print ">",cmd | |
31 | if os.system(cmd) != 0: |
|
31 | if os.system(cmd) != 0: | |
32 |
raise |
|
32 | raise ipapi.TryNext() | |
33 | if wait: |
|
33 | if wait: | |
34 | raw_input("Press Enter when done editing:") |
|
34 | raw_input("Press Enter when done editing:") | |
35 |
|
35 |
@@ -1,11 +1,11 b'' | |||||
1 |
|
|
1 | from IPython.core import ipapi | |
2 |
ip = |
|
2 | ip = ipapi.get() | |
3 |
|
3 | |||
4 | import os,pprint |
|
4 | import os,pprint | |
5 |
|
5 | |||
6 | def export(filename = None): |
|
6 | def export(filename = None): | |
7 |
|
7 | |||
8 | lines = ['import IPython.ipapi', 'ip = IPython.ipapi.get()',''] |
|
8 | lines = ['import IPython.core.ipapi', 'ip = IPython.core.ipapi.get()',''] | |
9 |
|
9 | |||
10 | vars = ip.db.keys('autorestore/*') |
|
10 | vars = ip.db.keys('autorestore/*') | |
11 | vars.sort() |
|
11 | vars.sort() |
@@ -7,8 +7,8 b' to.' | |||||
7 | # for the purposes of this module, every module that has the name 'ip' globally |
|
7 | # for the purposes of this module, every module that has the name 'ip' globally | |
8 | # installed as below is an IPython extension |
|
8 | # installed as below is an IPython extension | |
9 |
|
9 | |||
10 |
|
|
10 | from IPython.core import ipapi | |
11 |
ip = |
|
11 | ip = ipapi.get() | |
12 |
|
12 | |||
13 | import sys,textwrap,inspect |
|
13 | import sys,textwrap,inspect | |
14 |
|
14 | |||
@@ -34,7 +34,7 b' class ExtUtil:' | |||||
34 | act = [] |
|
34 | act = [] | |
35 | for mname,m in sys.modules.items(): |
|
35 | for mname,m in sys.modules.items(): | |
36 | o = getattr(m, 'ip', None) |
|
36 | o = getattr(m, 'ip', None) | |
37 |
if isinstance(o, |
|
37 | if isinstance(o, ipapi.IPApi): | |
38 | act.append((mname,m)) |
|
38 | act.append((mname,m)) | |
39 | act.sort() |
|
39 | act.sort() | |
40 | return act |
|
40 | return act |
@@ -15,13 +15,13 b" do some useful tricks on their own, though (like use 'mglob' patterns)." | |||||
15 | Not to be confused with ipipe commands (ils etc.) that also start with i. |
|
15 | Not to be confused with ipipe commands (ils etc.) that also start with i. | |
16 | """ |
|
16 | """ | |
17 |
|
17 | |||
18 |
|
|
18 | from IPython.core import ipapi | |
19 |
ip = |
|
19 | ip = ipapi.get() | |
20 |
|
20 | |||
21 | import shutil,os,shlex |
|
21 | import shutil,os,shlex | |
22 | from IPython.external import mglob |
|
22 | from IPython.external import mglob | |
23 | from IPython.external.path import path |
|
23 | from IPython.external.path import path | |
24 | from IPython.ipapi import UsageError |
|
24 | from IPython.core.ipapi import UsageError | |
25 | import IPython.utils.generics |
|
25 | import IPython.utils.generics | |
26 |
|
26 | |||
27 | def parse_args(args): |
|
27 | def parse_args(args): | |
@@ -229,7 +229,7 b' def complete_pathobj(obj, prev_completions):' | |||||
229 | if res: |
|
229 | if res: | |
230 | return res |
|
230 | return res | |
231 | # just return normal attributes of 'path' object if the dir is empty |
|
231 | # just return normal attributes of 'path' object if the dir is empty | |
232 |
raise |
|
232 | raise ipapi.TryNext | |
233 |
|
233 | |||
234 | complete_pathobj = IPython.utils.generics.complete_object.when_type(PathObj)(complete_pathobj) |
|
234 | complete_pathobj = IPython.utils.generics.complete_object.when_type(PathObj)(complete_pathobj) | |
235 |
|
235 |
@@ -8,8 +8,8 b' http://www.gnu.org/software/global/' | |||||
8 |
|
8 | |||
9 | """ |
|
9 | """ | |
10 |
|
10 | |||
11 |
|
|
11 | from IPython.core import ipapi | |
12 |
ip = |
|
12 | ip = ipapi.get() | |
13 | import os |
|
13 | import os | |
14 |
|
14 | |||
15 | # alter to your liking |
|
15 | # alter to your liking |
@@ -9,7 +9,7 b' only whitespace as completer delimiter. If this works well, we will' | |||||
9 | do the same in default completer. |
|
9 | do the same in default completer. | |
10 |
|
10 | |||
11 | """ |
|
11 | """ | |
12 | from IPython import ipapi |
|
12 | from IPython.core import ipapi | |
13 | from IPython.utils import generics |
|
13 | from IPython.utils import generics | |
14 | from IPython.utils.genutils import dir2 |
|
14 | from IPython.utils.genutils import dir2 | |
15 |
|
15 |
@@ -8,8 +8,8 b' Stores variables in Struct with some notes in PicleShare database' | |||||
8 | """ |
|
8 | """ | |
9 |
|
9 | |||
10 | from datetime import datetime |
|
10 | from datetime import datetime | |
11 |
|
|
11 | from IPython.core import ipapi | |
12 |
ip = |
|
12 | ip = ipapi.get() | |
13 |
|
13 | |||
14 | import pickleshare |
|
14 | import pickleshare | |
15 |
|
15 |
@@ -9,8 +9,8 b' Stuff that is considered obsolete / redundant is gradually moved here.' | |||||
9 |
|
9 | |||
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 |
|
|
12 | from IPython.core import ipapi | |
13 |
ip = |
|
13 | ip = ipapi.get() | |
14 |
|
14 | |||
15 | import os,sys |
|
15 | import os,sys | |
16 |
|
16 |
@@ -201,8 +201,8 b' def _lookfor_generate_cache(module, import_modules, regenerate):' | |||||
201 | # IPython connectivity |
|
201 | # IPython connectivity | |
202 | #------------------------------------------------------------------------------ |
|
202 | #------------------------------------------------------------------------------ | |
203 |
|
203 | |||
204 |
|
|
204 | from IPython.core import ipapi | |
205 |
ip = |
|
205 | ip = ipapi.get() | |
206 |
|
206 | |||
207 | _lookfor_modules = ['numpy', 'scipy'] |
|
207 | _lookfor_modules = ['numpy', 'scipy'] | |
208 |
|
208 |
@@ -3,8 +3,8 b'' | |||||
3 | Add %p4 magic for pythonic p4 (Perforce) usage. |
|
3 | Add %p4 magic for pythonic p4 (Perforce) usage. | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 |
|
|
6 | from IPython.core import ipapi | |
7 |
ip = |
|
7 | ip = ipapi.get() | |
8 |
|
8 | |||
9 | import os,sys,marshal |
|
9 | import os,sys,marshal | |
10 |
|
10 |
@@ -16,12 +16,12 b' for numpy dtype objects, add the following to your ipy_user_conf.py::' | |||||
16 | ipy_pretty.for_type_by_name('numpy', 'dtype', ipy_pretty.dtype_pprinter) |
|
16 | ipy_pretty.for_type_by_name('numpy', 'dtype', ipy_pretty.dtype_pprinter) | |
17 | """ |
|
17 | """ | |
18 |
|
18 | |||
19 |
|
|
19 | from IPython.core import ipapi | |
20 | from IPython.utils.genutils import Term |
|
20 | from IPython.utils.genutils import Term | |
21 |
|
21 | |||
22 | from IPython.external import pretty |
|
22 | from IPython.external import pretty | |
23 |
|
23 | |||
24 |
ip = |
|
24 | ip = ipapi.get() | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | #### Implementation ############################################################ |
|
27 | #### Implementation ############################################################ |
@@ -14,7 +14,7 b' similar as possible to the default Python ones, for inclusion in doctests."""' | |||||
14 | # get various stuff that are there for historical / familiarity reasons |
|
14 | # get various stuff that are there for historical / familiarity reasons | |
15 | import ipy_legacy |
|
15 | import ipy_legacy | |
16 |
|
16 | |||
17 |
from |
|
17 | from IPython.core import ipapi | |
18 |
|
18 | |||
19 | from IPython.Extensions import InterpreterPasteInput |
|
19 | from IPython.Extensions import InterpreterPasteInput | |
20 |
|
20 |
@@ -5,11 +5,11 b' This profile loads the math/cmath modules as well as all of numpy.' | |||||
5 | It exposes numpy via the 'np' shorthand as well for convenience. |
|
5 | It exposes numpy via the 'np' shorthand as well for convenience. | |
6 | """ |
|
6 | """ | |
7 |
|
7 | |||
8 |
|
|
8 | from IPython.core import ipapi | |
9 | import ipy_defaults |
|
9 | import ipy_defaults | |
10 |
|
10 | |||
11 | def main(): |
|
11 | def main(): | |
12 |
ip = |
|
12 | ip = ipapi.get() | |
13 |
|
13 | |||
14 | try: |
|
14 | try: | |
15 | ip.ex("import math,cmath") |
|
15 | ip.ex("import math,cmath") |
@@ -6,11 +6,11 b" It exposes numpy and scipy via the 'np' and 'sp' shorthands as well for" | |||||
6 | convenience. |
|
6 | convenience. | |
7 | """ |
|
7 | """ | |
8 |
|
8 | |||
9 |
|
|
9 | from IPython.core import ipapi | |
10 | import ipy_defaults |
|
10 | import ipy_defaults | |
11 |
|
11 | |||
12 | def main(): |
|
12 | def main(): | |
13 |
ip = |
|
13 | ip = ipapi.get() | |
14 |
|
14 | |||
15 | try: |
|
15 | try: | |
16 | ip.ex("import math,cmath") |
|
16 | ip.ex("import math,cmath") |
@@ -7,7 +7,7 b" shell mode and is recommended for users who don't care about pysh-mode" | |||||
7 | compatibility) |
|
7 | compatibility) | |
8 | """ |
|
8 | """ | |
9 |
|
9 | |||
10 | from IPython import ipapi |
|
10 | from IPython.core import ipapi | |
11 | import os,re,textwrap |
|
11 | import os,re,textwrap | |
12 |
|
12 | |||
13 | # The import below effectively obsoletes your old-style ipythonrc[.ini], |
|
13 | # The import below effectively obsoletes your old-style ipythonrc[.ini], |
@@ -17,7 +17,7 b' Authors' | |||||
17 | # Distributed under the terms of the BSD License. The full license is in |
|
17 | # Distributed under the terms of the BSD License. The full license is in | |
18 | # the file COPYING, distributed as part of this software. |
|
18 | # the file COPYING, distributed as part of this software. | |
19 |
|
19 | |||
20 | from IPython import ipapi |
|
20 | from IPython.core import ipapi | |
21 | from IPython import Release |
|
21 | from IPython import Release | |
22 | from types import StringType |
|
22 | from types import StringType | |
23 | import sys |
|
23 | import sys |
@@ -1,7 +1,7 b'' | |||||
1 | import inspect |
|
1 | import inspect | |
2 |
|
|
2 | from IPython.core import ipapi | |
3 | from IPython.utils.genutils import arg_split |
|
3 | from IPython.utils.genutils import arg_split | |
4 |
ip = |
|
4 | ip = ipapi.get() | |
5 |
|
5 | |||
6 | from IPython.core import debugger |
|
6 | from IPython.core import debugger | |
7 |
|
7 |
@@ -15,8 +15,8 b' extensions are allowed to do that).' | |||||
15 |
|
15 | |||
16 | """ |
|
16 | """ | |
17 |
|
17 | |||
18 |
|
|
18 | from IPython.core import ipapi | |
19 |
ip = |
|
19 | ip = ipapi.get() | |
20 |
|
20 | |||
21 |
|
21 | |||
22 | import os,re,fnmatch,sys |
|
22 | import os,re,fnmatch,sys |
@@ -2,9 +2,9 b'' | |||||
2 |
|
2 | |||
3 | """ IPython extension: Render templates from variables and paste to clipbard """ |
|
3 | """ IPython extension: Render templates from variables and paste to clipbard """ | |
4 |
|
4 | |||
5 |
|
|
5 | from IPython.core import ipapi | |
6 |
|
6 | |||
7 |
ip = |
|
7 | ip = ipapi.get() | |
8 |
|
8 | |||
9 | from string import Template |
|
9 | from string import Template | |
10 | import sys,os |
|
10 | import sys,os |
@@ -13,8 +13,8 b' This is a bit like \'M-x server-start" or gnuserv in the emacs world.' | |||||
13 |
|
13 | |||
14 | """ |
|
14 | """ | |
15 |
|
15 | |||
16 |
|
|
16 | from IPython.core import ipapi | |
17 |
ip = |
|
17 | ip = ipapi.get() | |
18 |
|
18 | |||
19 | import SocketServer |
|
19 | import SocketServer | |
20 |
|
20 |
@@ -10,10 +10,10 b' If _ip.options.verbose is true, show exit status if nonzero' | |||||
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | import signal,os,sys |
|
12 | import signal,os,sys | |
13 |
|
|
13 | from IPython.core import ipapi | |
14 | import subprocess |
|
14 | import subprocess | |
15 |
|
15 | |||
16 |
ip = |
|
16 | ip = ipapi.get() | |
17 |
|
17 | |||
18 | def new_ipsystem_posix(cmd): |
|
18 | def new_ipsystem_posix(cmd): | |
19 | """ ctrl+c ignoring replacement for system() command in iplib. |
|
19 | """ ctrl+c ignoring replacement for system() command in iplib. |
@@ -5,9 +5,9 b' IPython extension that installs completers related to core ipython behaviour.' | |||||
5 | The actual implementations are in Extensions/ipy_completers.py |
|
5 | The actual implementations are in Extensions/ipy_completers.py | |
6 |
|
6 | |||
7 | """ |
|
7 | """ | |
8 |
|
|
8 | from IPython.core import ipapi | |
9 |
|
9 | |||
10 |
ip = |
|
10 | ip = ipapi.get() | |
11 |
|
11 | |||
12 | from ipy_completers import * |
|
12 | from ipy_completers import * | |
13 |
|
13 |
@@ -1,5 +1,5 b'' | |||||
1 |
|
|
1 | from IPython.core import ipapi | |
2 |
ip = |
|
2 | ip = ipapi.get() | |
3 |
|
3 | |||
4 | import win32api |
|
4 | import win32api | |
5 | import win32ui |
|
5 | import win32ui |
@@ -7,8 +7,8 b' should reside there.' | |||||
7 |
|
7 | |||
8 | """ |
|
8 | """ | |
9 |
|
9 | |||
10 |
|
|
10 | from IPython.core import ipapi | |
11 |
ip = |
|
11 | ip = ipapi.get() | |
12 |
|
12 | |||
13 | # add system wide configuration information, import extensions etc. here. |
|
13 | # add system wide configuration information, import extensions etc. here. | |
14 | # nothing here is essential |
|
14 | # nothing here is essential |
@@ -52,7 +52,7 b' Notes' | |||||
52 | from enthought.traits import api as T |
|
52 | from enthought.traits import api as T | |
53 |
|
53 | |||
54 | # IPython imports |
|
54 | # IPython imports | |
55 | from IPython.ipapi import TryNext, get as ipget |
|
55 | from IPython.core.ipapi import TryNext, get as ipget | |
56 | from IPython.utils.genutils import dir2 |
|
56 | from IPython.utils.genutils import dir2 | |
57 | try: |
|
57 | try: | |
58 | set |
|
58 | set |
@@ -67,15 +67,15 b' something. Instead of edit, use the vim magic. Thats it!' | |||||
67 |
|
67 | |||
68 | """ |
|
68 | """ | |
69 |
|
69 | |||
70 |
|
|
70 | from IPython.core import ipapi | |
71 | #import ipythonhooks |
|
71 | ||
72 | import socket, select |
|
72 | import socket, select | |
73 | import os, threading, subprocess |
|
73 | import os, threading, subprocess | |
74 | import re |
|
74 | import re | |
75 |
|
75 | |||
76 | ERRCONDS = select.POLLHUP|select.POLLERR |
|
76 | ERRCONDS = select.POLLHUP|select.POLLERR | |
77 | SERVER = None |
|
77 | SERVER = None | |
78 |
ip = |
|
78 | ip = ipapi.get() | |
79 |
|
79 | |||
80 | # this listens to a unix domain socket in a separate thread, so that comms |
|
80 | # this listens to a unix domain socket in a separate thread, so that comms | |
81 | # between a vim instance and ipython can happen in a fun and productive way |
|
81 | # between a vim instance and ipython can happen in a fun and productive way | |
@@ -161,7 +161,7 b' def shutdown_server(self):' | |||||
161 | if SERVER: |
|
161 | if SERVER: | |
162 | SERVER.stop() |
|
162 | SERVER.stop() | |
163 | SERVER.join(3) |
|
163 | SERVER.join(3) | |
164 |
raise |
|
164 | raise ipapi.TryNext | |
165 |
|
165 | |||
166 | ip.set_hook('shutdown_hook', shutdown_server, 10) |
|
166 | ip.set_hook('shutdown_hook', shutdown_server, 10) | |
167 |
|
167 |
@@ -4,8 +4,8 b' r""" %which magic command' | |||||
4 |
|
4 | |||
5 | """ |
|
5 | """ | |
6 |
|
6 | |||
7 |
|
|
7 | from IPython.core import ipapi | |
8 |
ip = |
|
8 | ip = ipapi.get() | |
9 |
|
9 | |||
10 | import os,sys |
|
10 | import os,sys | |
11 | from fnmatch import fnmatch |
|
11 | from fnmatch import fnmatch |
@@ -21,10 +21,10 b' For more details: https://bugs.launchpad.net/ipython/+bug/249036' | |||||
21 |
|
21 | |||
22 | import os |
|
22 | import os | |
23 |
|
23 | |||
24 |
|
|
24 | from IPython.core import ipapi | |
25 | import rpdb2 |
|
25 | import rpdb2 | |
26 |
|
26 | |||
27 |
ip = |
|
27 | ip = ipapi.get() | |
28 |
|
28 | |||
29 | rpdb_started = False |
|
29 | rpdb_started = False | |
30 |
|
30 | |||
@@ -58,7 +58,7 b' def wdb_f(self, arg):' | |||||
58 |
|
58 | |||
59 | path = os.path.abspath(arg) |
|
59 | path = os.path.abspath(arg) | |
60 | if not os.path.isfile(path): |
|
60 | if not os.path.isfile(path): | |
61 |
raise |
|
61 | raise ipapi.UsageError("%%wdb: file %s does not exist" % path) | |
62 | if not rpdb_started: |
|
62 | if not rpdb_started: | |
63 | passwd = ip.db.get('winpdb_pass', None) |
|
63 | passwd = ip.db.get('winpdb_pass', None) | |
64 | if passwd is None: |
|
64 | if passwd is None: |
@@ -1,7 +1,7 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 |
|
2 | |||
3 |
|
|
3 | from IPython.core import ipapi | |
4 |
ip = |
|
4 | ip = ipapi.get() | |
5 |
|
5 | |||
6 | import os, subprocess |
|
6 | import os, subprocess | |
7 |
|
7 |
@@ -47,7 +47,7 b' import threading,Queue' | |||||
47 |
|
47 | |||
48 | from IPython.utils import genutils |
|
48 | from IPython.utils import genutils | |
49 |
|
49 | |||
50 |
|
|
50 | from IPython.core import ipapi | |
51 |
|
51 | |||
52 | if os.name == 'nt': |
|
52 | if os.name == 'nt': | |
53 | def kill_process(pid): |
|
53 | def kill_process(pid): | |
@@ -128,7 +128,7 b' def jobctrl_prefilter_f(self,line):' | |||||
128 | return '_ip.startjob(%s)' % genutils.make_quoted_expr(line) |
|
128 | return '_ip.startjob(%s)' % genutils.make_quoted_expr(line) | |
129 | return '_ip.jobq(%s)' % genutils.make_quoted_expr(line) |
|
129 | return '_ip.jobq(%s)' % genutils.make_quoted_expr(line) | |
130 |
|
130 | |||
131 |
raise |
|
131 | raise ipapi.TryNext | |
132 |
|
132 | |||
133 | def jobq_output_hook(self): |
|
133 | def jobq_output_hook(self): | |
134 | if not _jobq: |
|
134 | if not _jobq: | |
@@ -230,7 +230,7 b' def jobctrl_shellcmd(ip,cmd):' | |||||
230 |
|
230 | |||
231 | def install(): |
|
231 | def install(): | |
232 | global ip |
|
232 | global ip | |
233 |
ip = |
|
233 | ip = ipapi.get() | |
234 | # needed to make startjob visible as _ip.startjob('blah') |
|
234 | # needed to make startjob visible as _ip.startjob('blah') | |
235 | ip.startjob = startjob |
|
235 | ip.startjob = startjob | |
236 | ip.set_hook('input_prefilter', jobctrl_prefilter_f) |
|
236 | ip.set_hook('input_prefilter', jobctrl_prefilter_f) |
@@ -43,9 +43,9 b' l.__class__ l.__hash__ l.__repr__ l.expandtabs l.lj' | |||||
43 | ... (completions for string variable shown ) ... |
|
43 | ... (completions for string variable shown ) ... | |
44 |
|
44 | |||
45 | """ |
|
45 | """ | |
46 |
|
|
46 | from IPython.core import ipapi | |
47 | import pprint |
|
47 | import pprint | |
48 |
ip = |
|
48 | ip = ipapi.get() | |
49 |
|
49 | |||
50 | curdata = [] |
|
50 | curdata = [] | |
51 |
|
51 |
@@ -5,9 +5,9 b'' | |||||
5 | Stores variables, aliases etc. in PickleShare database. |
|
5 | Stores variables, aliases etc. in PickleShare database. | |
6 | """ |
|
6 | """ | |
7 |
|
7 | |||
8 |
|
|
8 | from IPython.core import ipapi | |
9 | from IPython.ipapi import UsageError |
|
9 | from IPython.core.ipapi import UsageError | |
10 |
ip = |
|
10 | ip = ipapi.get() | |
11 |
|
11 | |||
12 | import pickleshare |
|
12 | import pickleshare | |
13 |
|
13 | |||
@@ -47,7 +47,7 b' def restore_data(self):' | |||||
47 | refresh_variables(ip) |
|
47 | refresh_variables(ip) | |
48 | restore_aliases(self) |
|
48 | restore_aliases(self) | |
49 | restore_dhist(self) |
|
49 | restore_dhist(self) | |
50 |
raise |
|
50 | raise ipapi.TryNext | |
51 |
|
51 | |||
52 | ip.set_hook('late_startup_hook', restore_data) |
|
52 | ip.set_hook('late_startup_hook', restore_data) | |
53 |
|
53 |
@@ -1,6 +1,6 b'' | |||||
1 |
|
|
1 | from IPython.core import ipapi | |
2 |
|
2 | |||
3 |
ip = |
|
3 | ip = ipapi.get() | |
4 |
|
4 | |||
5 | def clip_f( self, parameter_s = '' ): |
|
5 | def clip_f( self, parameter_s = '' ): | |
6 | """Save a set of lines to the clipboard. |
|
6 | """Save a set of lines to the clipboard. |
@@ -53,8 +53,8 b' from IPython.macro import Macro' | |||||
53 | from IPython.utils.genutils import * |
|
53 | from IPython.utils.genutils import * | |
54 | from IPython import platutils |
|
54 | from IPython import platutils | |
55 | import IPython.utils.generics |
|
55 | import IPython.utils.generics | |
56 |
|
|
56 | from IPython.core import ipapi | |
57 | from IPython.ipapi import UsageError |
|
57 | from IPython.core.ipapi import UsageError | |
58 | from IPython.testing import decorators as testdec |
|
58 | from IPython.testing import decorators as testdec | |
59 |
|
59 | |||
60 | #*************************************************************************** |
|
60 | #*************************************************************************** | |
@@ -720,7 +720,7 b' Currently the magic system has the following functions:\\n"""' | |||||
720 | try: |
|
720 | try: | |
721 | IPython.utils.generics.inspect_object(info.obj) |
|
721 | IPython.utils.generics.inspect_object(info.obj) | |
722 | return |
|
722 | return | |
723 |
except |
|
723 | except ipapi.TryNext: | |
724 | pass |
|
724 | pass | |
725 | # Get the docstring of the class property if it exists. |
|
725 | # Get the docstring of the class property if it exists. | |
726 | path = oname.split('.') |
|
726 | path = oname.split('.') | |
@@ -2386,7 +2386,7 b' Currently the magic system has the following functions:\\n"""' | |||||
2386 | sys.stdout.flush() |
|
2386 | sys.stdout.flush() | |
2387 | try: |
|
2387 | try: | |
2388 | self.shell.hooks.editor(filename,lineno) |
|
2388 | self.shell.hooks.editor(filename,lineno) | |
2389 |
except |
|
2389 | except ipapi.TryNext: | |
2390 | warn('Could not open editor') |
|
2390 | warn('Could not open editor') | |
2391 | return |
|
2391 | return | |
2392 |
|
2392 |
@@ -23,7 +23,7 b' import time' | |||||
23 | from IPython.utils import coloransi |
|
23 | from IPython.utils import coloransi | |
24 | from IPython import Release |
|
24 | from IPython import Release | |
25 | from IPython.external.Itpl import ItplNS |
|
25 | from IPython.external.Itpl import ItplNS | |
26 | from IPython.ipapi import TryNext |
|
26 | from IPython.core.ipapi import TryNext | |
27 | from IPython.ipstruct import Struct |
|
27 | from IPython.ipstruct import Struct | |
28 | from IPython.macro import Macro |
|
28 | from IPython.macro import Macro | |
29 | import IPython.utils.generics |
|
29 | import IPython.utils.generics |
@@ -34,7 +34,8 b' except ImportError:' | |||||
34 |
|
34 | |||
35 | # IPython imports |
|
35 | # IPython imports | |
36 | import IPython |
|
36 | import IPython | |
37 |
from IPython import ultraTB |
|
37 | from IPython import ultraTB | |
|
38 | from IPython.core import ipapi | |||
38 | from IPython.Magic import Magic |
|
39 | from IPython.Magic import Magic | |
39 | from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no |
|
40 | from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no | |
40 | from IPython.iplib import InteractiveShell |
|
41 | from IPython.iplib import InteractiveShell | |
@@ -562,7 +563,7 b' class MatplotlibShellBase:' | |||||
562 | self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive) |
|
563 | self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive) | |
563 |
|
564 | |||
564 | # Build a user namespace initialized with matplotlib/matlab features. |
|
565 | # Build a user namespace initialized with matplotlib/matlab features. | |
565 |
user_ns, user_global_ns = |
|
566 | user_ns, user_global_ns = ipapi.make_user_namespaces(user_ns, | |
566 | user_global_ns) |
|
567 | user_global_ns) | |
567 |
|
568 | |||
568 | # Import numpy as np/pyplot as plt are conventions we're trying to |
|
569 | # Import numpy as np/pyplot as plt are conventions we're trying to | |
@@ -1088,7 +1089,7 b' def _load_pylab(user_ns):' | |||||
1088 | This little utility must be called AFTER the actual ipython instance is |
|
1089 | This little utility must be called AFTER the actual ipython instance is | |
1089 | running, since only then will the options file have been fully parsed.""" |
|
1090 | running, since only then will the options file have been fully parsed.""" | |
1090 |
|
1091 | |||
1091 |
ip = |
|
1092 | ip = ipapi.get() | |
1092 | if ip.options.pylab_import_all: |
|
1093 | if ip.options.pylab_import_all: | |
1093 | ip.ex("from matplotlib.pylab import *") |
|
1094 | ip.ex("from matplotlib.pylab import *") | |
1094 | ip.IP.user_config_ns.update(ip.user_ns) |
|
1095 | ip.IP.user_config_ns.update(ip.user_ns) |
@@ -18,8 +18,8 b' description on what you could do here.' | |||||
18 |
|
18 | |||
19 | # Most of your config files and extensions will probably start with this import |
|
19 | # Most of your config files and extensions will probably start with this import | |
20 |
|
20 | |||
21 |
|
|
21 | from IPython.core import ipapi | |
22 |
ip = |
|
22 | ip = ipapi.get() | |
23 |
|
23 | |||
24 | # You probably want to uncomment this if you did %upgrade -nolegacy |
|
24 | # You probably want to uncomment this if you did %upgrade -nolegacy | |
25 | # import ipy_defaults |
|
25 | # import ipy_defaults |
@@ -73,7 +73,7 b' import sys' | |||||
73 | import IPython.rlineimpl as readline |
|
73 | import IPython.rlineimpl as readline | |
74 | import itertools |
|
74 | import itertools | |
75 | from IPython.ipstruct import Struct |
|
75 | from IPython.ipstruct import Struct | |
76 | from IPython import ipapi |
|
76 | from IPython.core import ipapi | |
77 | from IPython.utils import generics |
|
77 | from IPython.utils import generics | |
78 | import types |
|
78 | import types | |
79 |
|
79 |
@@ -31,7 +31,8 b' import linecache' | |||||
31 | import os |
|
31 | import os | |
32 | import sys |
|
32 | import sys | |
33 |
|
33 | |||
34 |
from IPython import PyColorize |
|
34 | from IPython import PyColorize | |
|
35 | from IPython.core import ipapi | |||
35 | from IPython.utils import coloransi |
|
36 | from IPython.utils import coloransi | |
36 | from IPython.utils.genutils import Term |
|
37 | from IPython.utils.genutils import Term | |
37 | from IPython.core.excolors import exception_colors |
|
38 | from IPython.core.excolors import exception_colors |
@@ -6,7 +6,7 b' import fnmatch' | |||||
6 | import os |
|
6 | import os | |
7 |
|
7 | |||
8 | from IPython.utils.genutils import Term, ask_yes_no, warn |
|
8 | from IPython.utils.genutils import Term, ask_yes_no, warn | |
9 |
|
|
9 | from IPython.core import ipapi | |
10 |
|
10 | |||
11 | def magic_history(self, parameter_s = ''): |
|
11 | def magic_history(self, parameter_s = ''): | |
12 | """Print input history (_i<n> variables), with most recent last. |
|
12 | """Print input history (_i<n> variables), with most recent last. | |
@@ -228,7 +228,7 b' class ShadowHist:' | |||||
228 | #print "new",newidx # dbg |
|
228 | #print "new",newidx # dbg | |
229 | self.db.hset('shadowhist',ent, newidx) |
|
229 | self.db.hset('shadowhist',ent, newidx) | |
230 | except: |
|
230 | except: | |
231 |
|
|
231 | ipapi.get().IP.showtraceback() | |
232 | print "WARNING: disabling shadow history" |
|
232 | print "WARNING: disabling shadow history" | |
233 | self.disabled = True |
|
233 | self.disabled = True | |
234 |
|
234 |
@@ -19,8 +19,8 b" For example, suppose that you have a module called 'myiphooks' in your" | |||||
19 | PYTHONPATH, which contains the following definition: |
|
19 | PYTHONPATH, which contains the following definition: | |
20 |
|
20 | |||
21 | import os |
|
21 | import os | |
22 |
|
|
22 | from IPython.core import ipapi | |
23 |
ip = |
|
23 | ip = ipapi.get() | |
24 |
|
24 | |||
25 | def calljed(self,filename, linenum): |
|
25 | def calljed(self,filename, linenum): | |
26 | "My editor hook calls the jed editor directly." |
|
26 | "My editor hook calls the jed editor directly." | |
@@ -41,7 +41,7 b' somewhere in your configuration files or ipython command line.' | |||||
41 | # the file COPYING, distributed as part of this software. |
|
41 | # the file COPYING, distributed as part of this software. | |
42 | #***************************************************************************** |
|
42 | #***************************************************************************** | |
43 |
|
43 | |||
44 | from IPython import ipapi |
|
44 | from IPython.core import ipapi | |
45 |
|
45 | |||
46 | import os,bisect |
|
46 | import os,bisect | |
47 | from IPython.utils.genutils import Term,shell |
|
47 | from IPython.utils.genutils import Term,shell |
@@ -24,8 +24,8 b' That way the module is imported at startup and you can have all your' | |||||
24 | personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME |
|
24 | personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME | |
25 | stuff) in there. |
|
25 | stuff) in there. | |
26 |
|
26 | |||
27 |
|
|
27 | from IPython.core import ipapi | |
28 |
ip = |
|
28 | ip = ipapi.get() | |
29 |
|
29 | |||
30 | def ankka_f(self, arg): |
|
30 | def ankka_f(self, arg): | |
31 | print 'Ankka',self,'says uppercase:',arg.upper() |
|
31 | print 'Ankka',self,'says uppercase:',arg.upper() | |
@@ -331,8 +331,8 b' class IPApi(object):' | |||||
331 | To use this, you first must obtain a handle on the ipython object as |
|
331 | To use this, you first must obtain a handle on the ipython object as | |
332 | indicated above, via: |
|
332 | indicated above, via: | |
333 |
|
333 | |||
334 |
|
|
334 | from IPython.core import ipapi | |
335 |
ip = |
|
335 | ip = ipapi.get() | |
336 |
|
336 | |||
337 | Once this is done, inside a routine foo() where you want to expose |
|
337 | Once this is done, inside a routine foo() where you want to expose | |
338 | variables x and y, you do the following: |
|
338 | variables x and y, you do the following: |
@@ -22,5 +22,8 b' def test_import_history():' | |||||
22 | def test_import_hooks(): |
|
22 | def test_import_hooks(): | |
23 | from IPython.core import hooks |
|
23 | from IPython.core import hooks | |
24 |
|
24 | |||
|
25 | def test_import_ipapi(): | |||
|
26 | from IPython.core import ipapi | |||
|
27 | ||||
25 |
|
28 | |||
26 |
|
29 |
@@ -10,8 +10,8 b' See the idoctest docstring below for usage details.' | |||||
10 | import doctest |
|
10 | import doctest | |
11 | import sys |
|
11 | import sys | |
12 |
|
12 | |||
13 |
|
|
13 | from IPython.core import ipapi | |
14 |
ip = |
|
14 | ip = ipapi.get() | |
15 |
|
15 | |||
16 | def rundoctest(text,ns=None,eraise=False): |
|
16 | def rundoctest(text,ns=None,eraise=False): | |
17 | """Run a the input source as a doctest, in the caller's namespace. |
|
17 | """Run a the input source as a doctest, in the caller's namespace. |
@@ -28,7 +28,7 b' import re' | |||||
28 | import __builtin__ |
|
28 | import __builtin__ | |
29 |
|
29 | |||
30 | from IPython.ipmaker import make_IPython |
|
30 | from IPython.ipmaker import make_IPython | |
31 | from IPython.ipapi import IPApi |
|
31 | from IPython.core.ipapi import IPApi | |
32 | from IPython.kernel.core.redirector_output_trap import RedirectorOutputTrap |
|
32 | from IPython.kernel.core.redirector_output_trap import RedirectorOutputTrap | |
33 |
|
33 | |||
34 | from IPython.kernel.core.sync_traceback_trap import SyncTracebackTrap |
|
34 | from IPython.kernel.core.sync_traceback_trap import SyncTracebackTrap |
@@ -19,7 +19,7 b' import string' | |||||
19 | from nose.tools import assert_equal |
|
19 | from nose.tools import assert_equal | |
20 |
|
20 | |||
21 | from IPython.frontend.prefilterfrontend import PrefilterFrontEnd |
|
21 | from IPython.frontend.prefilterfrontend import PrefilterFrontEnd | |
22 | from IPython.ipapi import get as get_ipython0 |
|
22 | from IPython.core.ipapi import get as get_ipython0 | |
23 | from IPython.testing.plugin.ipdoctest import default_argv |
|
23 | from IPython.testing.plugin.ipdoctest import default_argv | |
24 |
|
24 | |||
25 |
|
25 |
@@ -184,8 +184,8 b' class NonBlockingIPShell(object):' | |||||
184 | self._IP.user_ns['help'] = _Helper(self._pager_help) |
|
184 | self._IP.user_ns['help'] = _Helper(self._pager_help) | |
185 |
|
185 | |||
186 | #we disable cpase magic... until we found a way to use it properly. |
|
186 | #we disable cpase magic... until we found a way to use it properly. | |
187 |
|
|
187 | from IPython.core import ipapi | |
188 |
ip = |
|
188 | ip = ipapi.get() | |
189 | def bypass_magic(self, arg): |
|
189 | def bypass_magic(self, arg): | |
190 | print '%this magic is currently disabled.' |
|
190 | print '%this magic is currently disabled.' | |
191 | ip.expose_magic('cpaste', bypass_magic) |
|
191 | ip.expose_magic('cpaste', bypass_magic) |
@@ -19,7 +19,7 b' except ImportError:' | |||||
19 | is_sync_frontend_ok = False |
|
19 | is_sync_frontend_ok = False | |
20 |
|
20 | |||
21 | #used to create options.conf file in user directory |
|
21 | #used to create options.conf file in user directory | |
22 | from IPython.ipapi import get |
|
22 | from IPython.core.ipapi import get | |
23 |
|
23 | |||
24 | __version__ = 0.91 |
|
24 | __version__ = 0.91 | |
25 | __author__ = "Laurent Dufrechou" |
|
25 | __author__ = "Laurent Dufrechou" |
@@ -57,7 +57,7 b' from IPython.ipstruct import Struct' | |||||
57 | from IPython.lib.backgroundjobs import BackgroundJobManager |
|
57 | from IPython.lib.backgroundjobs import BackgroundJobManager | |
58 | from IPython.utils.genutils import * |
|
58 | from IPython.utils.genutils import * | |
59 | from IPython.strdispatch import StrDispatch |
|
59 | from IPython.strdispatch import StrDispatch | |
60 |
|
|
60 | from IPython.core import ipapi | |
61 | import IPython.core.history |
|
61 | import IPython.core.history | |
62 | import IPython.prefilter as prefilter |
|
62 | import IPython.prefilter as prefilter | |
63 | import IPython.shadowns |
|
63 | import IPython.shadowns | |
@@ -463,7 +463,7 b' class InteractiveShell(object,Magic):' | |||||
463 | # These routines return properly built dicts as needed by the rest of |
|
463 | # These routines return properly built dicts as needed by the rest of | |
464 | # the code, and can also be used by extension writers to generate |
|
464 | # the code, and can also be used by extension writers to generate | |
465 | # properly initialized namespaces. |
|
465 | # properly initialized namespaces. | |
466 |
user_ns, user_global_ns = |
|
466 | user_ns, user_global_ns = ipapi.make_user_namespaces(user_ns, | |
467 | user_global_ns) |
|
467 | user_global_ns) | |
468 |
|
468 | |||
469 | # Assign namespaces |
|
469 | # Assign namespaces | |
@@ -783,7 +783,7 b' class InteractiveShell(object,Magic):' | |||||
783 | self.auto_alias = [s.split(None,1) for s in auto_alias] |
|
783 | self.auto_alias = [s.split(None,1) for s in auto_alias] | |
784 |
|
784 | |||
785 | # Produce a public API instance |
|
785 | # Produce a public API instance | |
786 |
self.api = |
|
786 | self.api = ipapi.IPApi(self) | |
787 |
|
787 | |||
788 | # Initialize all user-visible namespaces |
|
788 | # Initialize all user-visible namespaces | |
789 | self.init_namespaces() |
|
789 | self.init_namespaces() | |
@@ -1592,7 +1592,7 b' class InteractiveShell(object,Magic):' | |||||
1592 | try: |
|
1592 | try: | |
1593 | self.hooks.fix_error_editor(e.filename, |
|
1593 | self.hooks.fix_error_editor(e.filename, | |
1594 | int0(e.lineno),int0(e.offset),e.msg) |
|
1594 | int0(e.lineno),int0(e.offset),e.msg) | |
1595 |
except |
|
1595 | except ipapi.TryNext: | |
1596 | warn('Could not open editor') |
|
1596 | warn('Could not open editor') | |
1597 | return False |
|
1597 | return False | |
1598 | return True |
|
1598 | return True | |
@@ -1706,7 +1706,7 b' class InteractiveShell(object,Magic):' | |||||
1706 |
|
1706 | |||
1707 | if etype is SyntaxError: |
|
1707 | if etype is SyntaxError: | |
1708 | self.showsyntaxerror(filename) |
|
1708 | self.showsyntaxerror(filename) | |
1709 |
elif etype is |
|
1709 | elif etype is ipapi.UsageError: | |
1710 | print "UsageError:", value |
|
1710 | print "UsageError:", value | |
1711 | else: |
|
1711 | else: | |
1712 | # WARNING: these variables are somewhat deprecated and not |
|
1712 | # WARNING: these variables are somewhat deprecated and not | |
@@ -2548,7 +2548,7 b' class InteractiveShell(object,Magic):' | |||||
2548 | self.log(line,line,continue_prompt) |
|
2548 | self.log(line,line,continue_prompt) | |
2549 | return line |
|
2549 | return line | |
2550 |
|
2550 | |||
2551 |
force_auto = isinstance(obj, |
|
2551 | force_auto = isinstance(obj, ipapi.IPyAutocall) | |
2552 | auto_rewrite = True |
|
2552 | auto_rewrite = True | |
2553 |
|
2553 | |||
2554 | if pre == self.ESC_QUOTE: |
|
2554 | if pre == self.ESC_QUOTE: |
@@ -27,7 +27,7 b' import sys' | |||||
27 | from twisted.internet.error import ConnectionRefusedError |
|
27 | from twisted.internet.error import ConnectionRefusedError | |
28 |
|
28 | |||
29 | from IPython.ultraTB import _fixed_getinnerframes, findsource |
|
29 | from IPython.ultraTB import _fixed_getinnerframes, findsource | |
30 | from IPython import ipapi |
|
30 | from IPython.core import ipapi | |
31 |
|
31 | |||
32 | from IPython.kernel import error |
|
32 | from IPython.kernel import error | |
33 |
|
33 | |||
@@ -108,7 +108,7 b' class RemoteContextBase(object):' | |||||
108 | return strip_whitespace(wsource) |
|
108 | return strip_whitespace(wsource) | |
109 |
|
109 | |||
110 | def _findsource_ipython(self,f): |
|
110 | def _findsource_ipython(self,f): | |
111 | from IPython import ipapi |
|
111 | from IPython.core import ipapi | |
112 | self.ip = ipapi.get() |
|
112 | self.ip = ipapi.get() | |
113 | buf = self.ip.IP.input_hist_raw[-1].splitlines()[1:] |
|
113 | buf = self.ip.IP.input_hist_raw[-1].splitlines()[1:] | |
114 | wsource = [l+'\n' for l in buf ] |
|
114 | wsource = [l+'\n' for l in buf ] |
@@ -29,7 +29,7 b' from IPython.external.Itpl import ItplNS' | |||||
29 |
|
29 | |||
30 | from IPython.utils import coloransi |
|
30 | from IPython.utils import coloransi | |
31 | from IPython import Release |
|
31 | from IPython import Release | |
32 | from IPython.ipapi import TryNext |
|
32 | from IPython.core.ipapi import TryNext | |
33 | from IPython.utils.genutils import * |
|
33 | from IPython.utils.genutils import * | |
34 | import IPython.utils.generics |
|
34 | import IPython.utils.generics | |
35 |
|
35 |
@@ -312,7 +312,7 b' class InteractiveMultiEngineClient(object):' | |||||
312 | return strip_whitespace(wsource) |
|
312 | return strip_whitespace(wsource) | |
313 |
|
313 | |||
314 | def findsource_ipython(self,f): |
|
314 | def findsource_ipython(self,f): | |
315 | from IPython import ipapi |
|
315 | from IPython.core import ipapi | |
316 | self.ip = ipapi.get() |
|
316 | self.ip = ipapi.get() | |
317 | wsource = [l+'\n' for l in |
|
317 | wsource = [l+'\n' for l in | |
318 | self.ip.IP.input_hist_raw[-1].splitlines()[1:]] |
|
318 | self.ip.IP.input_hist_raw[-1].splitlines()[1:]] |
@@ -7,10 +7,10 b'' | |||||
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 |
|
|
10 | from IPython.core import ipapi | |
11 |
|
11 | |||
12 | from IPython.utils.genutils import Term |
|
12 | from IPython.utils.genutils import Term | |
13 | from IPython.ipapi import IPyAutocall |
|
13 | from IPython.core.ipapi import IPyAutocall | |
14 |
|
14 | |||
15 | class Macro(IPyAutocall): |
|
15 | class Macro(IPyAutocall): | |
16 | """Simple class to store the value of macros as strings. |
|
16 | """Simple class to store the value of macros as strings. |
@@ -8,7 +8,7 b' transforming work.' | |||||
8 | __docformat__ = "restructuredtext en" |
|
8 | __docformat__ = "restructuredtext en" | |
9 |
|
9 | |||
10 | import re |
|
10 | import re | |
11 |
|
|
11 | from IPython.core import ipapi | |
12 |
|
12 | |||
13 | class LineInfo(object): |
|
13 | class LineInfo(object): | |
14 | """A single line of input and associated info. |
|
14 | """A single line of input and associated info. | |
@@ -178,7 +178,7 b' def checkEmacs(l_info,ip):' | |||||
178 | def checkIPyAutocall(l_info,ip): |
|
178 | def checkIPyAutocall(l_info,ip): | |
179 | "Instances of IPyAutocall in user_ns get autocalled immediately" |
|
179 | "Instances of IPyAutocall in user_ns get autocalled immediately" | |
180 | obj = ip.user_ns.get(l_info.iFun, None) |
|
180 | obj = ip.user_ns.get(l_info.iFun, None) | |
181 |
if isinstance(obj, |
|
181 | if isinstance(obj, ipapi.IPyAutocall): | |
182 | obj.set_ip(ip.api) |
|
182 | obj.set_ip(ip.api) | |
183 | return ip.handle_auto |
|
183 | return ip.handle_auto | |
184 | else: |
|
184 | else: |
@@ -62,8 +62,8 b' import unittest' | |||||
62 |
|
62 | |||
63 | from doctest import * |
|
63 | from doctest import * | |
64 |
|
64 | |||
65 | # Our own imports |
|
|||
66 | from IPython.tools import utils |
|
65 | from IPython.tools import utils | |
|
66 | from IPython.core import ipapi | |||
67 |
|
67 | |||
68 | ########################################################################### |
|
68 | ########################################################################### | |
69 | # |
|
69 | # | |
@@ -85,7 +85,7 b' sys.displayhook = sys.__displayhook__' | |||||
85 | sys.excepthook = sys.__excepthook__ |
|
85 | sys.excepthook = sys.__excepthook__ | |
86 |
|
86 | |||
87 | # So that ipython magics and aliases can be doctested |
|
87 | # So that ipython magics and aliases can be doctested | |
88 |
__builtin__._ip = |
|
88 | __builtin__._ip = ipapi.get() | |
89 |
|
89 | |||
90 | # for debugging only!!! |
|
90 | # for debugging only!!! | |
91 | #from IPython.Shell import IPShellEmbed;ipshell=IPShellEmbed(['--noterm_title']) # dbg |
|
91 | #from IPython.Shell import IPShellEmbed;ipshell=IPShellEmbed(['--noterm_title']) # dbg |
@@ -164,7 +164,8 b' def start_ipython():' | |||||
164 | import new |
|
164 | import new | |
165 |
|
165 | |||
166 | import IPython |
|
166 | import IPython | |
167 |
|
167 | from IPython.core import ipapi | ||
|
168 | ||||
168 | def xsys(cmd): |
|
169 | def xsys(cmd): | |
169 | """Execute a command and print its output. |
|
170 | """Execute a command and print its output. | |
170 |
|
171 | |||
@@ -183,7 +184,7 b' def start_ipython():' | |||||
183 | argv = default_argv() |
|
184 | argv = default_argv() | |
184 |
|
185 | |||
185 | # Start IPython instance. We customize it to start with minimal frills. |
|
186 | # Start IPython instance. We customize it to start with minimal frills. | |
186 |
user_ns,global_ns = |
|
187 | user_ns,global_ns = ipapi.make_user_namespaces(ipnsdict(),dict()) | |
187 | IPython.Shell.IPShell(argv,user_ns,global_ns) |
|
188 | IPython.Shell.IPShell(argv,user_ns,global_ns) | |
188 |
|
189 | |||
189 | # Deactivate the various python system hooks added by ipython for |
|
190 | # Deactivate the various python system hooks added by ipython for |
@@ -18,7 +18,7 b' test_magic.py calls it.' | |||||
18 | #----------------------------------------------------------------------------- |
|
18 | #----------------------------------------------------------------------------- | |
19 | import sys |
|
19 | import sys | |
20 |
|
20 | |||
21 | from IPython import ipapi |
|
21 | from IPython.core import ipapi | |
22 |
|
22 | |||
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 | # Globals |
|
24 | # Globals |
@@ -13,7 +13,8 b' import tempfile' | |||||
13 | import nose.tools as nt |
|
13 | import nose.tools as nt | |
14 |
|
14 | |||
15 | # our own packages |
|
15 | # our own packages | |
16 |
from IPython import |
|
16 | from IPython import iplib | |
|
17 | from IPython.core import ipapi | |||
17 |
|
18 | |||
18 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
19 | # Globals |
|
20 | # Globals |
@@ -15,7 +15,7 b' Here is an example from genutils.py:' | |||||
15 | can use the niftier decorator syntax introduced in Python 2.4). |
|
15 | can use the niftier decorator syntax introduced in Python 2.4). | |
16 | ''' |
|
16 | ''' | |
17 |
|
17 | |||
18 | from IPython.ipapi import TryNext |
|
18 | from IPython.core.ipapi import TryNext | |
19 | from IPython.external.simplegeneric import generic |
|
19 | from IPython.external.simplegeneric import generic | |
20 |
|
20 | |||
21 | def result_display(result): |
|
21 | def result_display(result): |
@@ -50,7 +50,7 b' from IPython.Itpl import Itpl,itpl,printpl' | |||||
50 | from IPython import platutils |
|
50 | from IPython import platutils | |
51 | from IPython.utils import DPyGetOpt |
|
51 | from IPython.utils import DPyGetOpt | |
52 | from IPython.utils.generics import result_display |
|
52 | from IPython.utils.generics import result_display | |
53 |
|
|
53 | from IPython.core import ipapi | |
54 | from IPython.external.path import path |
|
54 | from IPython.external.path import path | |
55 | if os.name == "nt": |
|
55 | if os.name == "nt": | |
56 | from IPython.winconsole import get_console_size |
|
56 | from IPython.winconsole import get_console_size | |
@@ -1625,12 +1625,12 b' def page(strng,start=0,screen_lines=0,pager_cmd = None):' | |||||
1625 | start = max(0,start) |
|
1625 | start = max(0,start) | |
1626 |
|
1626 | |||
1627 | # first, try the hook |
|
1627 | # first, try the hook | |
1628 |
ip = |
|
1628 | ip = ipapi.get() | |
1629 | if ip: |
|
1629 | if ip: | |
1630 | try: |
|
1630 | try: | |
1631 | ip.IP.hooks.show_in_pager(strng) |
|
1631 | ip.IP.hooks.show_in_pager(strng) | |
1632 | return |
|
1632 | return | |
1633 |
except |
|
1633 | except ipapi.TryNext: | |
1634 | pass |
|
1634 | pass | |
1635 |
|
1635 | |||
1636 | # Ugly kludge, but calling curses.initscr() flat out crashes in emacs |
|
1636 | # Ugly kludge, but calling curses.initscr() flat out crashes in emacs |
General Comments 0
You need to be logged in to leave comments.
Login now