Show More
@@ -22,13 +22,11 b' import __future__' | |||
|
22 | 22 | import abc |
|
23 | 23 | import atexit |
|
24 | 24 | import codeop |
|
25 | import exceptions | |
|
26 | import new | |
|
27 | 25 | import os |
|
28 | 26 | import re |
|
29 | import string | |
|
30 | 27 | import sys |
|
31 | 28 | import tempfile |
|
29 | import types | |
|
32 | 30 | from contextlib import nested |
|
33 | 31 | |
|
34 | 32 | from IPython.config.configurable import Configurable |
@@ -104,7 +102,7 b' def softspace(file, newvalue):' | |||
|
104 | 102 | |
|
105 | 103 | def no_op(*a, **kw): pass |
|
106 | 104 | |
|
107 |
class SpaceInInput( |
|
|
105 | class SpaceInInput(Exception): pass | |
|
108 | 106 | |
|
109 | 107 | class Bunch: pass |
|
110 | 108 | |
@@ -521,7 +519,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
521 | 519 | def restore_sys_module_state(self): |
|
522 | 520 | """Restore the state of the sys module.""" |
|
523 | 521 | try: |
|
524 | for k, v in self._orig_sys_module_state.items(): | |
|
522 | for k, v in self._orig_sys_module_state.iteritems(): | |
|
525 | 523 | setattr(sys, k, v) |
|
526 | 524 | except AttributeError: |
|
527 | 525 | pass |
@@ -559,7 +557,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
559 | 557 | # accepts it. Probably at least check that the hook takes the number |
|
560 | 558 | # of args it's supposed to. |
|
561 | 559 | |
|
562 |
f = |
|
|
560 | f = types.MethodType(hook,self) | |
|
563 | 561 | |
|
564 | 562 | # check if the hook is for strdispatcher first |
|
565 | 563 | if str_key is not None: |
@@ -1313,7 +1311,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1313 | 1311 | # The return value must be |
|
1314 | 1312 | return structured_traceback |
|
1315 | 1313 | |
|
1316 |
This will be made into an instance method (via |
|
|
1314 | This will be made into an instance method (via types.MethodType) | |
|
1317 | 1315 | of IPython itself, and it will be called if any of the exceptions |
|
1318 | 1316 | listed in the exc_tuple are caught. If the handler is None, an |
|
1319 | 1317 | internal basic one is used, which just prints basic info. |
@@ -1334,7 +1332,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1334 | 1332 | |
|
1335 | 1333 | if handler is None: handler = dummy_handler |
|
1336 | 1334 | |
|
1337 |
self.CustomTB = |
|
|
1335 | self.CustomTB = types.MethodType(handler,self) | |
|
1338 | 1336 | self.custom_exceptions = exc_tuple |
|
1339 | 1337 | |
|
1340 | 1338 | def excepthook(self, etype, value, tb): |
@@ -1538,8 +1536,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1538 | 1536 | # Remove some chars from the delimiters list. If we encounter |
|
1539 | 1537 | # unicode chars, discard them. |
|
1540 | 1538 | delims = readline.get_completer_delims().encode("ascii", "ignore") |
|
1541 |
delims = delims.translate( |
|
|
1542 | self.readline_remove_delims) | |
|
1539 | delims = delims.translate(None, self.readline_remove_delims) | |
|
1543 | 1540 | delims = delims.replace(ESC_MAGIC, '') |
|
1544 | 1541 | readline.set_completer_delims(delims) |
|
1545 | 1542 | # otherwise we end up with a monster history after a while: |
@@ -1676,8 +1673,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1676 | 1673 | The position argument (defaults to 0) is the index in the completers |
|
1677 | 1674 | list where you want the completer to be inserted.""" |
|
1678 | 1675 | |
|
1679 |
newcomp = |
|
|
1680 | self.Completer.__class__) | |
|
1676 | newcomp = types.MethodType(completer,self.Completer) | |
|
1681 | 1677 | self.Completer.matchers.insert(pos,newcomp) |
|
1682 | 1678 | |
|
1683 | 1679 | def set_readline_completer(self): |
@@ -1753,7 +1749,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1753 | 1749 | """ |
|
1754 | 1750 | |
|
1755 | 1751 | import new |
|
1756 |
im = |
|
|
1752 | im = types.MethodType(func,self) | |
|
1757 | 1753 | old = getattr(self, "magic_" + magicname, None) |
|
1758 | 1754 | setattr(self, "magic_" + magicname, im) |
|
1759 | 1755 | return old |
@@ -2112,8 +2108,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
2112 | 2108 | list.append(self, val) |
|
2113 | 2109 | |
|
2114 | 2110 | import new |
|
2115 |
self.input_hist.append = |
|
|
2116 | list) | |
|
2111 | self.input_hist.append = types.MethodType(myapp, self.input_hist) | |
|
2117 | 2112 | # End dbg |
|
2118 | 2113 | |
|
2119 | 2114 | # All user code execution must happen with our context managers active |
@@ -22,7 +22,6 b' import StringIO' | |||
|
22 | 22 | import inspect |
|
23 | 23 | import linecache |
|
24 | 24 | import os |
|
25 | import string | |
|
26 | 25 | import sys |
|
27 | 26 | import types |
|
28 | 27 | from collections import namedtuple |
@@ -450,7 +449,7 b' class Inspector:' | |||
|
450 | 449 | if not detail_level and len(ostr)>string_max: |
|
451 | 450 | ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:] |
|
452 | 451 | ostr = ("\n" + " " * len(str_head.expandtabs())).\ |
|
453 |
join( |
|
|
452 | join(q.strip() for q in ostr.split("\n")) | |
|
454 | 453 | if ostr.find('\n') > -1: |
|
455 | 454 | # Print multi-line strings starting at the next line. |
|
456 | 455 | str_sep = '\n' |
@@ -675,7 +674,7 b' class Inspector:' | |||
|
675 | 674 | if not detail_level and len(ostr)>string_max: |
|
676 | 675 | ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:] |
|
677 | 676 | ostr = ("\n" + " " * len(str_head.expandtabs())).\ |
|
678 |
join( |
|
|
677 | join(q.strip() for q in ostr.split("\n")) | |
|
679 | 678 | if ostr.find('\n') > -1: |
|
680 | 679 | # Print multi-line strings starting at the next line. |
|
681 | 680 | str_sep = '\n' |
@@ -77,7 +77,6 b' import linecache' | |||
|
77 | 77 | import os |
|
78 | 78 | import pydoc |
|
79 | 79 | import re |
|
80 | import string | |
|
81 | 80 | import sys |
|
82 | 81 | import time |
|
83 | 82 | import tokenize |
@@ -719,7 +718,7 b' class VerboseTB(TBTools):' | |||
|
719 | 718 | |
|
720 | 719 | if self.long_header: |
|
721 | 720 | # Header with the exception type, python version, and date |
|
722 |
pyver = 'Python ' + s |
|
|
721 | pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable | |
|
723 | 722 | date = time.ctime(time.time()) |
|
724 | 723 | |
|
725 | 724 | head = '%s%s%s\n%s%s%s\n%s' % (Colors.topline, '-'*75, ColorsNormal, |
@@ -75,7 +75,6 b' each time the instance is evaluated with str(instance). For example:' | |||
|
75 | 75 | __author__ = 'Ka-Ping Yee <ping@lfw.org>' |
|
76 | 76 | __license__ = 'MIT' |
|
77 | 77 | |
|
78 | import string | |
|
79 | 78 | import sys |
|
80 | 79 | from tokenize import tokenprog |
|
81 | 80 |
@@ -66,7 +66,6 b' $Id: pexpect.py 507 2007-12-27 02:40:52Z noah $' | |||
|
66 | 66 | try: |
|
67 | 67 | import os, sys, time |
|
68 | 68 | import select |
|
69 | import string | |
|
70 | 69 | import re |
|
71 | 70 | import struct |
|
72 | 71 | import resource |
@@ -1778,8 +1777,7 b' def which (filename):' | |||
|
1778 | 1777 | |
|
1779 | 1778 | # Oddly enough this was the one line that made Pexpect |
|
1780 | 1779 | # incompatible with Python 1.5.2. |
|
1781 |
|
|
|
1782 | pathlist = string.split (p, os.pathsep) | |
|
1780 | pathlist = p.split(os.pathsep) | |
|
1783 | 1781 | |
|
1784 | 1782 | for path in pathlist: |
|
1785 | 1783 | f = os.path.join(path, filename) |
General Comments 0
You need to be logged in to leave comments.
Login now