##// END OF EJS Templates
genutils.py => utils/genutils.py and updated imports and tests.
Brian Granger -
Show More
@@ -50,7 +50,7 b' del InteractiveShell,prefilter_shell'
50 50
51 51 # Provide pysh and further shell-oriented services
52 52 import os,sys,shutil
53 from IPython.genutils import system,shell,getoutput,getoutputerror
53 from IPython.utils.genutils import system,shell,getoutput,getoutputerror
54 54
55 55 # Short aliases for getting shell output as a string and a list
56 56 sout = getoutput
@@ -9,7 +9,7 b' var = !ls'
9 9 """
10 10
11 11 import IPython.ipapi
12 from IPython.genutils import *
12 from IPython.utils.genutils import *
13 13
14 14 ip = IPython.ipapi.get()
15 15
@@ -133,7 +133,7 b' from IPython.external import simplegeneric'
133 133 from IPython.external import path
134 134
135 135 try:
136 from IPython import genutils
136 from IPython.utils import genutils
137 137 from IPython.utils import generics
138 138 except ImportError:
139 139 genutils = None
@@ -11,7 +11,7 b' do the same in default completer.'
11 11 """
12 12 from IPython import ipapi
13 13 from IPython.utils import generics
14 from IPython.genutils import dir2
14 from IPython.utils.genutils import dir2
15 15
16 16 def attr_matches(self, text):
17 17 """Compute matches when text contains a dot.
@@ -14,7 +14,7 b' ip = IPython.ipapi.get()'
14 14
15 15 import os,sys
16 16
17 from IPython.genutils import *
17 from IPython.utils.genutils import *
18 18
19 19 # use rehashx
20 20
@@ -17,7 +17,7 b' for numpy dtype objects, add the following to your ipy_user_conf.py::'
17 17 """
18 18
19 19 import IPython.ipapi
20 from IPython.genutils import Term
20 from IPython.utils.genutils import Term
21 21
22 22 from IPython.external import pretty
23 23
@@ -156,9 +156,9 b' def slash_prefilter_f(self,line):'
156 156
157 157 Removes the need for doing !./foo, !~/foo or !/bin/foo
158 158 """
159 import IPython.genutils
159 from IPython.utils import genutils
160 160 if re.match('(?:[.~]|/[a-zA-Z_0-9]+)/', line):
161 return "_ip.system(" + IPython.genutils.make_quoted_expr(line)+")"
161 return "_ip.system(" + genutils.make_quoted_expr(line)+")"
162 162 raise ipapi.TryNext
163 163
164 164 # XXX You do not need to understand the next function!
@@ -1,6 +1,6 b''
1 1 import inspect
2 2 import IPython.ipapi
3 from IPython.genutils import arg_split
3 from IPython.utils.genutils import arg_split
4 4 ip = IPython.ipapi.get()
5 5
6 6 from IPython.core import debugger
@@ -53,7 +53,7 b' from enthought.traits import api as T'
53 53
54 54 # IPython imports
55 55 from IPython.ipapi import TryNext, get as ipget
56 from IPython.genutils import dir2
56 from IPython.utils.genutils import dir2
57 57 try:
58 58 set
59 59 except:
@@ -45,7 +45,7 b' from subprocess import *'
45 45 import os,shlex,sys,time
46 46 import threading,Queue
47 47
48 from IPython import genutils
48 from IPython.utils import genutils
49 49
50 50 import IPython.ipapi
51 51
@@ -25,7 +25,7 b' import types'
25 25 import Gnuplot as Gnuplot_ori
26 26 import Numeric
27 27
28 from IPython.genutils import popkey,xsys
28 from IPython.utils.genutils import popkey,xsys
29 29
30 30 # needed by hardcopy():
31 31 gp = Gnuplot_ori.gp
@@ -16,7 +16,7 b" __all__ = ['Gnuplot','gp','gp_new','plot','plot2','splot','replot',"
16 16 'gphelp']
17 17
18 18 import IPython.GnuplotRuntime as GRun
19 from IPython.genutils import page,warn
19 from IPython.utils.genutils import page,warn
20 20
21 21 # Set global names for interactive use
22 22 Gnuplot = GRun.Gnuplot
@@ -53,7 +53,7 b" __all__ = ['Gnuplot','gp','gp_new','Data','File','Func','GridData',"
53 53 'pm3d_config','eps_fix_bbox']
54 54
55 55 import os,tempfile,sys
56 from IPython.genutils import getoutput
56 from IPython.utils.genutils import getoutput
57 57
58 58 #---------------------------------------------------------------------------
59 59 # Notes on mouse support for Gnuplot.py
@@ -50,7 +50,7 b' from IPython.Itpl import Itpl, itpl, printpl,itplns'
50 50 from IPython.PyColorize import Parser
51 51 from IPython.ipstruct import Struct
52 52 from IPython.macro import Macro
53 from IPython.genutils import *
53 from IPython.utils.genutils import *
54 54 from IPython import platutils
55 55 import IPython.utils.generics
56 56 import IPython.ipapi
@@ -28,7 +28,7 b' import types'
28 28
29 29 # IPython's own
30 30 from IPython import PyColorize
31 from IPython.genutils import page,indent,Term
31 from IPython.utils.genutils import page,indent,Term
32 32 from IPython.Itpl import itpl
33 33 from IPython.wildcard import list_namespace
34 34 from IPython.utils.coloransi import *
@@ -28,7 +28,7 b' from IPython.ipstruct import Struct'
28 28 from IPython.macro import Macro
29 29 import IPython.utils.generics
30 30
31 from IPython.genutils import *
31 from IPython.utils.genutils import *
32 32
33 33 #****************************************************************************
34 34 #Color schemes for Prompts.
@@ -36,7 +36,7 b' except ImportError:'
36 36 import IPython
37 37 from IPython import ultraTB, ipapi
38 38 from IPython.Magic import Magic
39 from IPython.genutils import Term,warn,error,flag_calls, ask_yes_no
39 from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no
40 40 from IPython.iplib import InteractiveShell
41 41 from IPython.ipmaker import make_IPython
42 42 from IPython.ipstruct import Struct
@@ -504,9 +504,9 b' import_mod'
504 504
505 505 # Example:
506 506
507 # import_some IPython.genutils timing timings
507 # import_some IPython.utils.genutils timing timings
508 508 # will produce internally the statement
509 # from IPython.genutils import timing, timings
509 # from IPython.utils.genutils import timing, timings
510 510
511 511 # timing() and timings() are two IPython utilities for timing the execution of
512 512 # your own functions, which you may find useful. Just commment out the above
@@ -18,7 +18,7 b' __docformat__ = "restructuredtext en"'
18 18 import os
19 19 from os.path import join as pjoin
20 20
21 from IPython.genutils import get_home_dir, get_ipython_dir
21 from IPython.utils.genutils import get_home_dir, get_ipython_dir
22 22 from IPython.external.configobj import ConfigObj
23 23
24 24
@@ -15,7 +15,7 b' from pprint import pprint'
15 15
16 16 from IPython import ultraTB
17 17 from IPython.ipstruct import Struct
18 from IPython.genutils import *
18 from IPython.utils.genutils import *
19 19
20 20 class ConfigLoaderError(exceptions.Exception):
21 21 """Exception for ConfigLoader class."""
@@ -83,7 +83,7 b' try:'
83 83 except NameError:
84 84 from sets import Set as set
85 85
86 from IPython.genutils import debugx, dir2
86 from IPython.utils.genutils import debugx, dir2
87 87
88 88 __all__ = ['Completer','IPCompleter']
89 89
@@ -28,7 +28,7 b' from IPython import Release'
28 28 from IPython import ultraTB
29 29 from IPython.Itpl import itpl
30 30
31 from IPython.genutils import *
31 from IPython.utils.genutils import *
32 32
33 33 #****************************************************************************
34 34 class CrashHandler:
@@ -33,7 +33,7 b' import sys'
33 33
34 34 from IPython import PyColorize, ipapi
35 35 from IPython.utils import coloransi
36 from IPython.genutils import Term
36 from IPython.utils.genutils import Term
37 37 from IPython.core.excolors import exception_colors
38 38
39 39 # See if we can use pydb.
@@ -213,7 +213,7 b' def main():'
213 213 print "\n".join(expand(sys.argv[1:])),
214 214
215 215 def mglob_f(self, arg):
216 from IPython.genutils import SList
216 from IPython.utils.genutils import SList
217 217 if arg.strip():
218 218 return SList(expand(arg))
219 219 print "Please specify pattern!"
@@ -33,7 +33,7 b' from IPython.kernel.core.redirector_output_trap import RedirectorOutputTrap'
33 33
34 34 from IPython.kernel.core.sync_traceback_trap import SyncTracebackTrap
35 35
36 from IPython.genutils import Term
36 from IPython.utils.genutils import Term
37 37
38 38 from linefrontendbase import LineFrontEndBase, common_prefix
39 39
@@ -25,6 +25,7 b' from thread_ex import ThreadEx'
25 25
26 26 try:
27 27 import IPython
28 from IPython.utils import genutils
28 29 except Exception,e:
29 30 print "Error importing IPython (%s)" % str(e)
30 31 raise Exception, e
@@ -143,11 +144,11 b' class NonBlockingIPShell(object):'
143 144 #only one instance can be instanciated else tehre will be
144 145 #cin/cout/cerr clash...
145 146 if cin:
146 IPython.genutils.Term.cin = cin
147 genutils.Term.cin = cin
147 148 if cout:
148 IPython.genutils.Term.cout = cout
149 genutils.Term.cout = cout
149 150 if cerr:
150 IPython.genutils.Term.cerr = cerr
151 genutils.Term.cerr = cerr
151 152
152 153 excepthook = sys.excepthook
153 154
@@ -5,8 +5,7 b''
5 5 import fnmatch
6 6 import os
7 7
8 # IPython imports
9 from IPython.genutils import Term, ask_yes_no, warn
8 from IPython.utils.genutils import Term, ask_yes_no, warn
10 9 import IPython.ipapi
11 10
12 11 def magic_history(self, parameter_s = ''):
@@ -44,7 +44,7 b' somewhere in your configuration files or ipython command line.'
44 44 from IPython import ipapi
45 45
46 46 import os,bisect
47 from genutils import Term,shell
47 from IPython.utils.genutils import Term,shell
48 48 from pprint import PrettyPrinter
49 49
50 50 # List here all the default hooks. For now it's just the editor functions
@@ -55,7 +55,7 b' from IPython.Magic import Magic'
55 55 from IPython.Prompts import CachedOutput
56 56 from IPython.ipstruct import Struct
57 57 from IPython.lib.backgroundjobs import BackgroundJobManager
58 from IPython.genutils import *
58 from IPython.utils.genutils import *
59 59 from IPython.strdispatch import StrDispatch
60 60 import IPython.ipapi
61 61 import IPython.history
@@ -51,7 +51,7 b' from IPython.OutputTrap import OutputTrap'
51 51 from IPython.config.configloader import ConfigLoader
52 52 from IPython.iplib import InteractiveShell
53 53 from IPython.usage import cmd_line_usage,interactive_usage
54 from IPython.genutils import *
54 from IPython.utils.genutils import *
55 55
56 56 def force_import(modname,force_reload=False):
57 57 if modname in sys.modules and force_reload:
@@ -14,7 +14,7 b" __all__ = ['Struct']"
14 14 import types
15 15 import pprint
16 16
17 from IPython.genutils import list2dict2
17 from IPython.utils.genutils import list2dict2
18 18
19 19 class Struct:
20 20 """Class to mimic C structs but also provide convenient dictionary-like
@@ -20,7 +20,7 b' from os.path import join as pjoin'
20 20
21 21 from IPython.external.configobj import ConfigObj
22 22 from IPython.config.api import ConfigObjManager
23 from IPython.genutils import get_ipython_dir, get_security_dir
23 from IPython.utils.genutils import get_ipython_dir, get_security_dir
24 24
25 25 default_kernel_config = ConfigObj()
26 26
@@ -50,7 +50,7 b' from IPython.kernel.engineservice import \\'
50 50 IEngineSerialized, \
51 51 IEngineQueued
52 52
53 from IPython.genutils import get_ipython_dir
53 from IPython.utils.genutils import get_ipython_dir
54 54 from IPython.kernel import codeutil
55 55
56 56 #-------------------------------------------------------------------------------
@@ -30,7 +30,7 b' from IPython.external.Itpl import ItplNS'
30 30 from IPython.utils import coloransi
31 31 from IPython import Release
32 32 from IPython.ipapi import TryNext
33 from IPython.genutils import *
33 from IPython.utils.genutils import *
34 34 import IPython.utils.generics
35 35
36 36 #****************************************************************************
@@ -94,7 +94,7 b' from IPython import PyColorize'
94 94 from IPython.core import debugger
95 95 from IPython.ipstruct import Struct
96 96 from IPython.core.excolors import exception_colors
97 from IPython.genutils import Term,uniq_stable,error,info
97 from IPython.utils.genutils import Term,uniq_stable,error,info
98 98
99 99 # Globals
100 100 # amount of space to put line numbers before verbose tracebacks
@@ -21,7 +21,7 b' __docformat__ = "restructuredtext en"'
21 21
22 22 import types
23 23
24 from IPython.genutils import flatten as genutil_flatten
24 from IPython.utils.genutils import flatten as genutil_flatten
25 25
26 26 #-------------------------------------------------------------------------------
27 27 # Figure out which array packages are present and their array types
@@ -29,7 +29,7 b' from twisted.python import failure, log'
29 29
30 30 from IPython.external import argparse
31 31 from IPython.external import Itpl
32 from IPython.genutils import (
32 from IPython.utils.genutils import (
33 33 get_ipython_dir,
34 34 get_log_dir,
35 35 get_security_dir,
@@ -42,7 +42,7 b' from IPython.kernel.fcutil import check_furl_file_security'
42 42 # Create various ipython directories if they don't exist.
43 43 # This must be done before IPython.kernel.config is imported.
44 44 from IPython.iplib import user_setup
45 from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir
45 from IPython.utils.genutils import get_ipython_dir, get_log_dir, get_security_dir
46 46 if os.name == 'posix':
47 47 rc_suffix = ''
48 48 else:
@@ -37,7 +37,7 b' from IPython.kernel.engineservice import EngineService'
37 37 # Create various ipython directories if they don't exist.
38 38 # This must be done before IPython.kernel.config is imported.
39 39 from IPython.iplib import user_setup
40 from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir
40 from IPython.utils.genutils import get_ipython_dir, get_log_dir, get_security_dir
41 41 if os.name == 'posix':
42 42 rc_suffix = ''
43 43 else:
@@ -31,7 +31,7 b' import sys'
31 31 import threading
32 32
33 33 from IPython.ultraTB import AutoFormattedTB
34 from IPython.genutils import warn,error
34 from IPython.utils.genutils import warn,error
35 35
36 36 class BackgroundJobManager:
37 37 """Class to manage a pool of backgrounded threaded jobs.
@@ -169,7 +169,7 b' import shlex'
169 169 import sys
170 170
171 171 from IPython.PyColorize import Parser
172 from IPython.genutils import marquee, file_read, file_readlines
172 from IPython.utils.genutils import marquee, file_read, file_readlines
173 173
174 174 __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError']
175 175
@@ -9,7 +9,7 b''
9 9
10 10 import IPython.ipapi
11 11
12 from IPython.genutils import Term
12 from IPython.utils.genutils import Term
13 13 from IPython.ipapi import IPyAutocall
14 14
15 15 class Macro(IPyAutocall):
@@ -16,7 +16,7 b' except ImportError:'
16 16 HAS_CTYPES = False
17 17
18 18 # our own
19 from IPython.genutils import Term,warn,error,flag_calls, ask_yes_no
19 from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no
20 20
21 21 #-----------------------------------------------------------------------------
22 22 # Globals
@@ -38,7 +38,7 b' import tempfile'
38 38
39 39 # IPython-specific libraries
40 40 from IPython import irunner
41 from IPython.genutils import fatal
41 from IPython.utils.genutils import fatal
42 42
43 43 class IndentOut(object):
44 44 """A simple output stream that indents all output by a fixed amount.
@@ -82,7 +82,7 b' class py_file_finder(object):'
82 82 self.test_filename = test_filename
83 83
84 84 def __call__(self,name):
85 from IPython.genutils import get_py_filename
85 from IPython.utils.genutils import get_py_filename
86 86 try:
87 87 return get_py_filename(name)
88 88 except IOError:
@@ -11,7 +11,7 b' from IPython.iplib import InteractiveShell'
11 11 from IPython.ipstruct import Struct
12 12 import Queue,thread,threading,signal
13 13 from signal import signal, SIGINT
14 from IPython.genutils import Term,warn,error,flag_calls, ask_yes_no
14 from IPython.utils.genutils import Term,warn,error,flag_calls, ask_yes_no
15 15 import shellglobals
16 16
17 17 def install_gtk2():
@@ -94,7 +94,7 b' from IPython import PyColorize'
94 94 from IPython.core import debugger
95 95 from IPython.ipstruct import Struct
96 96 from IPython.core.excolors import exception_colors
97 from IPython.genutils import Term,uniq_stable,error,info
97 from IPython.utils.genutils import Term,uniq_stable,error,info
98 98
99 99 # Globals
100 100 # amount of space to put line numbers before verbose tracebacks
1 NO CONTENT: file renamed from IPython/genutils.py to IPython/utils/genutils.py
@@ -31,7 +31,7 b' from nose.tools import raises'
31 31
32 32 # Our own
33 33 import IPython
34 from IPython import genutils
34 from IPython.utils import genutils
35 35 from IPython.testing.decorators import skipif, skip_if_not_win32
36 36
37 37 # Platform-dependent imports
@@ -10,3 +10,8 b' def test_import_DPyGetOpt():'
10 10 def test_import_generics():
11 11 from IPython.utils import generics
12 12
13 def test_import_genutils():
14 from IPython.utils import genutils
15
16
17
@@ -20,7 +20,7 b' import pprint'
20 20 import re
21 21 import types
22 22
23 from IPython.genutils import dir2
23 from IPython.utils.genutils import dir2
24 24
25 25 def create_typestr2type_dicts(dont_include_in_type2type2str=["lambda"]):
26 26 """Return dictionaries mapping lower case typename to type objects, from
@@ -114,6 +114,8 b' Where things will be moved'
114 114
115 115 * :file:`generics.py`. Move to :file:`IPython.python`.
116 116
117 * :file:`genutils.py`. Move to :file:`IPython.utils`.
118
117 119 * :file:`Extensions`. This needs to be gone through separately. Minimally,
118 120 the package should be renamed to :file:`extensions`.
119 121
@@ -158,8 +160,6 b' Where things will be moved'
158 160 * :file:`frontend`. Good where it is!
159 161
160 162
161 * :file:`genutils.py`. Move to :file:`IPython.python` and break up into different
162 modules.
163 163
164 164 * :file:`gui`. Eventually this should be moved to a subdir of
165 165 :file:`IPython.frontend`.
General Comments 0
You need to be logged in to leave comments. Login now