##// END OF EJS Templates
Cosmetic cleanups: put all imports in a single line, and sort them...
fperez -
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Configuration loader
3 3
4 $Id: ConfigLoader.py 525 2005-02-19 10:53:12Z fperez $"""
4 $Id: ConfigLoader.py 958 2005-12-27 23:17:51Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -14,9 +14,9 b' from IPython import Release'
14 14 __author__ = '%s <%s>' % Release.authors['Fernando']
15 15 __license__ = Release.license
16 16
17 import exceptions
17 18 import os
18 19 from pprint import pprint
19 import exceptions
20 20
21 21 from IPython import ultraTB
22 22 from IPython.Struct import Struct
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """sys.excepthook for IPython itself, leaves a detailed report on disk.
3 3
4 $Id: CrashHandler.py 951 2005-12-25 00:57:24Z fperez $"""
4 $Id: CrashHandler.py 958 2005-12-27 23:17:51Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -19,7 +19,8 b' __version__ = Release.version'
19 19 # Required modules
20 20
21 21 # From the standard library
22 import os,sys
22 import os
23 import sys
23 24 from pprint import pprint,pformat
24 25
25 26 # Homebrewed
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """DPyGetOpt -- Demiurge Python GetOptions Module
3 3
4 $Id: DPyGetOpt.py 389 2004-10-09 07:59:30Z fperez $
4 $Id: DPyGetOpt.py 958 2005-12-27 23:17:51Z fperez $
5 5
6 6 This module is modeled after perl's Getopt::Long module-- which
7 7 is, in turn, modeled after GNU's extended getopt() function.
@@ -33,7 +33,7 b' and -baz options that appear on within the parsed argument list'
33 33 must have a real number argument and that the accumulated list
34 34 of values will be available under the name 'foo'
35 35
36 $Id: DPyGetOpt.py 389 2004-10-09 07:59:30Z fperez $"""
36 $Id: DPyGetOpt.py 958 2005-12-27 23:17:51Z fperez $"""
37 37
38 38 #*****************************************************************************
39 39 #
@@ -69,8 +69,8 b" __version__ = '1.2'"
69 69 # Modified to use re instead of regex and regsub modules.
70 70 # 2001/5/7, Jonathan Hogg <jonathan@onegoodidea.com>
71 71
72 import string
73 72 import re
73 import string
74 74 import sys
75 75 import types
76 76
@@ -15,13 +15,19 b' details on the PSF (Python Software Foundation) standard license, see:'
15 15
16 16 http://www.python.org/2.2.3/license.html
17 17
18 $Id: Debugger.py 951 2005-12-25 00:57:24Z fperez $"""
18 $Id: Debugger.py 958 2005-12-27 23:17:51Z fperez $"""
19 19
20 20 from IPython import Release
21 21 __author__ = '%s <%s>' % Release.authors['Fernando']
22 22 __license__ = 'Python'
23 23
24 import pdb,bdb,cmd,os,sys,linecache
24 import bdb
25 import cmd
26 import linecache
27 import os
28 import pdb
29 import sys
30
25 31 from IPython import PyColorize, ColorANSI
26 32 from IPython.genutils import Term
27 33 from IPython.excolors import ExceptionColors
@@ -13,14 +13,19 b' Gnuplot, so it should be safe to do:'
13 13
14 14 import IPython.Gnuplot2 as Gnuplot
15 15
16 $Id: Gnuplot2.py 392 2004-10-09 22:01:51Z fperez $"""
16 $Id: Gnuplot2.py 958 2005-12-27 23:17:51Z fperez $"""
17 17
18 import string,os,time,types
19 18 import cStringIO
19 import os
20 import string
20 21 import sys
21 22 import tempfile
22 import Numeric
23 import time
24 import types
25
23 26 import Gnuplot as Gnuplot_ori
27 import Numeric
28
24 29 from IPython.genutils import popkey,xsys
25 30
26 31 # needed by hardcopy():
@@ -44,7 +44,7 b' each time the instance is evaluated with str(instance). For example:'
44 44 foo = "bar"
45 45 print str(s)
46 46
47 $Id: Itpl.py 638 2005-07-18 03:01:41Z fperez $
47 $Id: Itpl.py 958 2005-12-27 23:17:51Z fperez $
48 48 """ # ' -> close an open quote for stupid emacs
49 49
50 50 #*****************************************************************************
@@ -77,9 +77,10 b' $Id: Itpl.py 638 2005-07-18 03:01:41Z fperez $'
77 77 __author__ = 'Ka-Ping Yee <ping@lfw.org>'
78 78 __license__ = 'MIT'
79 79
80 import sys, string
81 from types import StringType
80 import string
81 import sys
82 82 from tokenize import tokenprog
83 from types import StringType
83 84
84 85 class ItplError(ValueError):
85 86 def __init__(self, text, pos):
@@ -2,7 +2,7 b''
2 2 """
3 3 Logger class for IPython's logging facilities.
4 4
5 $Id: Logger.py 430 2004-11-30 08:52:05Z fperez $
5 $Id: Logger.py 958 2005-12-27 23:17:51Z fperez $
6 6 """
7 7
8 8 #*****************************************************************************
@@ -22,7 +22,9 b" __author__ = '%s <%s>\\n%s <%s>' % \\"
22 22 __license__ = Release.license
23 23
24 24 # Python standard modules
25 import os,sys,glob
25 import glob
26 import os
27 import sys
26 28
27 29 # Homebrewed
28 30 from IPython.genutils import *
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 951 2005-12-25 00:57:24Z fperez $"""
4 $Id: Magic.py 958 2005-12-27 23:17:51Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -21,11 +21,18 b' __license__ = Release.license'
21 21
22 22 # Python standard modules
23 23 import __builtin__
24 import os,sys,inspect,pydoc,re,tempfile,pdb,bdb,time
25 import Debugger
24 import bdb
25 import inspect
26 import os
27 import pdb
28 import pydoc
29 import sys
30 import re
31 import tempfile
32 import time
33 from cStringIO import StringIO
26 34 from getopt import getopt
27 35 from pprint import pprint, pformat
28 from cStringIO import StringIO
29 36
30 37 # profile isn't bundled by default in Debian for license reasons
31 38 try:
@@ -34,12 +41,11 b' except ImportError:'
34 41 profile = pstats = None
35 42
36 43 # Homebrewed
37 from IPython.Struct import Struct
38 from IPython.Itpl import Itpl, itpl, printpl,itplns
44 from IPython import Debugger, OInspect, wildcard
39 45 from IPython.FakeModule import FakeModule
46 from IPython.Itpl import Itpl, itpl, printpl,itplns
40 47 from IPython.PyColorize import Parser
41 from IPython import OInspect
42 from IPython import wildcard
48 from IPython.Struct import Struct
43 49 from IPython.genutils import *
44 50
45 51 # Globals to be set later by Magic constructor
@@ -6,7 +6,7 b' Uses syntax highlighting for presenting the various information elements.'
6 6 Similar in spirit to the inspect module, but all calls take a name argument to
7 7 reference the name under which an object is being read.
8 8
9 $Id: OInspect.py 923 2005-11-15 08:51:15Z fperez $
9 $Id: OInspect.py 958 2005-12-27 23:17:51Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
@@ -24,13 +24,17 b" __all__ = ['Inspector','InspectColors']"
24 24
25 25 # stdlib modules
26 26 import __builtin__
27 import inspect,linecache,types,StringIO,string
27 import inspect
28 import linecache
29 import string
30 import StringIO
31 import types
28 32
29 33 # IPython's own
30 34 from IPython import PyColorize
35 from IPython.genutils import page,indent,Term,mkdict
31 36 from IPython.Itpl import itpl
32 37 from IPython.wildcard import list_namespace
33 from IPython.genutils import page,indent,Term,mkdict
34 38 from IPython.ColorANSI import *
35 39
36 40 #****************************************************************************
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Class to trap stdout and stderr and log them separately.
3 3
4 $Id: OutputTrap.py 542 2005-03-18 09:16:04Z fperez $"""
4 $Id: OutputTrap.py 958 2005-12-27 23:17:51Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -14,7 +14,8 b' from IPython import Release'
14 14 __author__ = '%s <%s>' % Release.authors['Fernando']
15 15 __license__ = Release.license
16 16
17 import exceptions,sys
17 import exceptions
18 import sys
18 19 from cStringIO import StringIO
19 20
20 21 class OutputTrapError(exceptions.Exception):
@@ -2,7 +2,7 b''
2 2 """
3 3 Classes for handling input/output prompts.
4 4
5 $Id: Prompts.py 951 2005-12-25 00:57:24Z fperez $"""
5 $Id: Prompts.py 958 2005-12-27 23:17:51Z fperez $"""
6 6
7 7 #*****************************************************************************
8 8 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -19,7 +19,9 b' __version__ = Release.version'
19 19 #****************************************************************************
20 20 # Required modules
21 21 import __builtin__
22 import os,sys,socket
22 import os
23 import socket
24 import sys
23 25 import time
24 26 from pprint import pprint,pformat
25 27
@@ -28,15 +28,20 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 485 2005-01-27 19:15:39Z fperez $"""
31 $Id: PyColorize.py 958 2005-12-27 23:17:51Z fperez $"""
32 32
33 33 __all__ = ['ANSICodeColors','Parser']
34 34
35 35 _scheme_default = 'Linux'
36 36
37 37 # Imports
38 import string, sys, os, cStringIO
39 import keyword, token, tokenize
38 import cStringIO
39 import keyword
40 import os
41 import string
42 import sys
43 import token
44 import tokenize
40 45
41 46 from IPython.ColorANSI import *
42 47
@@ -4,7 +4,7 b''
4 4 All the matplotlib support code was co-developed with John Hunter,
5 5 matplotlib's author.
6 6
7 $Id: Shell.py 952 2005-12-26 17:51:33Z fperez $"""
7 $Id: Shell.py 958 2005-12-27 23:17:51Z fperez $"""
8 8
9 9 #*****************************************************************************
10 10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -20,19 +20,18 b' __license__ = Release.license'
20 20 # Code begins
21 21 import __main__
22 22 import __builtin__
23 import sys
24 23 import os
25 import code
26 import threading
24 import sys
27 25 import signal
26 import threading
28 27
29 28 import IPython
29 from IPython import ultraTB
30 from IPython.genutils import Term,warn,error,flag_calls
30 31 from IPython.iplib import InteractiveShell
31 32 from IPython.ipmaker import make_IPython
32 from IPython.genutils import Term,warn,error,flag_calls
33 from IPython.Struct import Struct
34 33 from IPython.Magic import Magic
35 from IPython import ultraTB
34 from IPython.Struct import Struct
36 35
37 36 # global flag to pass around information about Ctrl-C without exceptions
38 37 KBINT = False
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Mimic C structs with lots of extra functionality.
3 3
4 $Id: Struct.py 638 2005-07-18 03:01:41Z fperez $"""
4 $Id: Struct.py 958 2005-12-27 23:17:51Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -17,6 +17,7 b' __license__ = Release.license'
17 17 __all__ = ['Struct']
18 18
19 19 import types
20
20 21 from IPython.genutils import list2dict2
21 22
22 23 class Struct:
@@ -18,7 +18,7 b' http://folk.uio.no/hpl/scripting'
18 18 (although ultimately no code from this text was used, as IPython's system is a
19 19 separate implementation).
20 20
21 $Id: background_jobs.py 638 2005-07-18 03:01:41Z fperez $
21 $Id: background_jobs.py 958 2005-12-27 23:17:51Z fperez $
22 22 """
23 23
24 24 #*****************************************************************************
@@ -33,7 +33,8 b" __author__ = '%s <%s>' % Release.authors['Fernando']"
33 33 __license__ = Release.license
34 34
35 35 # Code begins
36 import threading,sys
36 import sys
37 import threading
37 38
38 39 from IPython.ultraTB import AutoFormattedTB
39 40 from IPython.genutils import warn,error
@@ -77,10 +77,10 b' from IPython.genutils import shlex_split'
77 77
78 78 __all__ = ['Completer','IPCompleter']
79 79
80 def get_class_members(klass):
81 ret = dir(klass)
82 if hasattr(klass,'__bases__'):
83 for base in klass.__bases__:
80 def get_class_members(cls):
81 ret = dir(cls)
82 if hasattr(cls,'__bases__'):
83 for base in cls.__bases__:
84 84 ret.extend(get_class_members(base))
85 85 return ret
86 86
@@ -12,7 +12,7 b' Alternatively, you can add a dreload builtin alongside normal reload with:'
12 12
13 13 This code is almost entirely based on knee.py from the standard library.
14 14
15 $Id: deep_reload.py 410 2004-11-04 07:58:17Z fperez $"""
15 $Id: deep_reload.py 958 2005-12-27 23:17:51Z fperez $"""
16 16
17 17 #*****************************************************************************
18 18 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
@@ -27,7 +27,9 b' __license__ = Release.license'
27 27 __version__ = "0.5"
28 28 __date__ = "21 August 2001"
29 29
30 import sys, imp, __builtin__
30 import __builtin__
31 import imp
32 import sys
31 33
32 34 # Replacement for __import__()
33 35 def deep_import_hook(name, globals=None, locals=None, fromlist=None):
@@ -107,9 +107,9 b' environments.'
107 107 #
108 108 #*****************************************************************************
109 109
110 import sys
111 110 import exceptions
112 111 import re
112 import sys
113 113
114 114 from IPython.PyColorize import Parser
115 115 from IPython.genutils import marquee, shlex_split, file_read
@@ -5,7 +5,7 b' General purpose utilities.'
5 5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 6 these things are also convenient when working at the command line.
7 7
8 $Id: genutils.py 908 2005-09-26 16:05:48Z fperez $"""
8 $Id: genutils.py 958 2005-12-27 23:17:51Z fperez $"""
9 9
10 10 #*****************************************************************************
11 11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -21,11 +21,19 b" __author__ = '%s <%s>' % Release.authors['Fernando']"
21 21 __license__ = Release.license
22 22
23 23 #****************************************************************************
24 # required modules
24 # required modules from the Python standard library
25 25 import __main__
26 import types,commands,time,sys,os,re,shutil
26 import commands
27 import os
28 import re
27 29 import shlex
30 import shutil
31 import sys
28 32 import tempfile
33 import time
34 import types
35
36 # Other IPython utilities
29 37 from IPython.Itpl import Itpl,itpl,printpl
30 38 from IPython import DPyGetOpt
31 39
@@ -6,7 +6,7 b' Requires Python 2.1 or newer.'
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 957 2005-12-27 22:33:22Z fperez $
9 $Id: iplib.py 958 2005-12-27 23:17:51Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
@@ -64,18 +64,15 b' from pprint import pprint, pformat'
64 64 import IPython
65 65 from IPython import OInspect,PyColorize,ultraTB
66 66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.FakeModule import FakeModule
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 69 from IPython.Logger import Logger
68 70 from IPython.Magic import Magic,magic2python
69 from IPython.usage import cmd_line_usage,interactive_usage
70 71 from IPython.Struct import Struct
71 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
72 from IPython.FakeModule import FakeModule
73 72 from IPython.background_jobs import BackgroundJobManager
74 from IPython.PyColorize import Parser
73 from IPython.usage import cmd_line_usage,interactive_usage
75 74 from IPython.genutils import *
76 75
77 # Global pointer to the running
78
79 76 # store the builtin raw_input globally, and use this always, in case user code
80 77 # overwrites it (like wx.py.PyShell does)
81 78 raw_input_original = raw_input
@@ -396,12 +393,12 b' class InteractiveShell(Logger, Magic):'
396 393 __builtin__.jobs = self.jobs
397 394
398 395 # escapes for automatic behavior on the command line
399 self.ESC_SHELL = '!'
400 self.ESC_HELP = '?'
401 self.ESC_MAGIC = '%'
402 self.ESC_QUOTE = ','
396 self.ESC_SHELL = '!'
397 self.ESC_HELP = '?'
398 self.ESC_MAGIC = '%'
399 self.ESC_QUOTE = ','
403 400 self.ESC_QUOTE2 = ';'
404 self.ESC_PAREN = '/'
401 self.ESC_PAREN = '/'
405 402
406 403 # And their associated handlers
407 404 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
@@ -421,7 +418,7 b' class InteractiveShell(Logger, Magic):'
421 418 Magic.set_shell(self,self)
422 419
423 420 # Python source parser/formatter for syntax highlighting
424 pyformat = Parser().format
421 pyformat = PyColorize.Parser().format
425 422 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
426 423
427 424 # hooks holds pointers used for user-side customizations
@@ -553,9 +550,9 b' class InteractiveShell(Logger, Magic):'
553 550 self.set_custom_exc(*custom_exceptions)
554 551
555 552 # Object inspector
556 ins_colors = OInspect.InspectColors
557 code_colors = PyColorize.ANSICodeColors
558 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
553 self.inspector = OInspect.Inspector(OInspect.InspectColors,
554 PyColorize.ANSICodeColors,
555 'NoColor')
559 556 self.autoindent = False
560 557
561 558 # Make some aliases automatically
@@ -1440,8 +1437,7 b' want to merge them back into the new files.""" % locals()'
1440 1437
1441 1438 """
1442 1439 self.buffer.append(line)
1443 source = "\n".join(self.buffer)
1444 more = self.runsource(source, self.filename)
1440 more = self.runsource('\n'.join(self.buffer), self.filename)
1445 1441 if not more:
1446 1442 self.resetbuffer()
1447 1443 return more
@@ -6,7 +6,7 b' Requires Python 2.1 or better.'
6 6
7 7 This file contains the main make_IPython() starter function.
8 8
9 $Id: ipmaker.py 925 2005-11-15 20:39:39Z fperez $"""
9 $Id: ipmaker.py 958 2005-12-27 23:17:51Z fperez $"""
10 10
11 11 #*****************************************************************************
12 12 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -36,8 +36,12 b' All Rights Reserved."""'
36 36 # Required modules
37 37
38 38 # From the standard library
39 import __main__, __builtin__
40 import os,sys,types,re
39 import __main__
40 import __builtin__
41 import os
42 import re
43 import sys
44 import types
41 45 from pprint import pprint,pformat
42 46
43 47 # Our own
@@ -5,7 +5,7 b' A set of convenient utilities for numerical work.'
5 5 Most of this module requires Numerical Python or is meant to be used with it.
6 6 See http://www.pfdubois.com/numpy for details.
7 7
8 $Id: numutils.py 486 2005-01-27 19:34:21Z fperez $"""
8 $Id: numutils.py 958 2005-12-27 23:17:51Z fperez $"""
9 9
10 10 #*****************************************************************************
11 11 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
@@ -29,8 +29,10 b" __all__ = ['sum_flat','mean_flat','rms_flat','base_repr','binary_repr',"
29 29 #****************************************************************************
30 30 # required modules
31 31 import __main__
32 import sys,operator
33 32 import math
33 import operator
34 import sys
35
34 36 import Numeric
35 37 from Numeric import *
36 38
@@ -60,7 +60,7 b' You can implement other color schemes easily, the syntax is fairly'
60 60 self-explanatory. Please send back new schemes you develop to the author for
61 61 possible inclusion in future releases.
62 62
63 $Id: ultraTB.py 954 2005-12-26 19:40:50Z fperez $"""
63 $Id: ultraTB.py 958 2005-12-27 23:17:51Z fperez $"""
64 64
65 65 #*****************************************************************************
66 66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
@@ -76,17 +76,24 b" __author__ = '%s <%s>\\n%s <%s>' % (Release.authors['Nathan']+"
76 76 __license__ = Release.license
77 77
78 78 # Required modules
79 import sys, os, traceback, types, string, time
80 import keyword, tokenize, linecache, inspect, pydoc
81 from UserDict import UserDict
79 import inspect
80 import keyword
81 import linecache
82 import os
83 import pydoc
84 import string
85 import sys
86 import time
87 import tokenize
88 import traceback
89 import types
82 90
83 91 # IPython's own modules
84 92 # Modified pdb which doesn't damage IPython's readline handling
85 93 from IPython import Debugger
86
87 94 from IPython.Struct import Struct
88 from IPython.genutils import Term,uniq_stable,error,info
89 95 from IPython.excolors import ExceptionColors
96 from IPython.genutils import Term,uniq_stable,error,info
90 97
91 98 #---------------------------------------------------------------------------
92 99 # Code begins
@@ -16,11 +16,11 b' __author__ = "J\xc3\xb6rgen Stenarson <jorgen.stenarson@bostream.nu>"'
16 16 __license__ = Release.license
17 17
18 18 import __builtin__
19 import types
20 import re
21 import pprint
22 19 import exceptions
23 20 import pdb
21 import pprint
22 import re
23 import types
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
General Comments 0
You need to be logged in to leave comments. Login now