Show More
@@ -92,15 +92,16 b' class Config(dict):' | |||
|
92 | 92 | else: |
|
93 | 93 | return False |
|
94 | 94 | |
|
95 | # .has_key is deprecated for dictionaries. | |
|
95 | 96 | def has_key(self, key): |
|
96 | 97 | if self._is_section_key(key): |
|
97 | 98 | return True |
|
98 | 99 | else: |
|
99 |
return |
|
|
100 | return key in self | |
|
100 | 101 | |
|
101 | 102 | def _has_section(self, key): |
|
102 | 103 | if self._is_section_key(key): |
|
103 |
if |
|
|
104 | if key in self: | |
|
104 | 105 | return True |
|
105 | 106 | return False |
|
106 | 107 |
@@ -22,13 +22,12 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 | 27 | import string |
|
30 | 28 | import sys |
|
31 | 29 | import tempfile |
|
30 | import types | |
|
32 | 31 | from contextlib import nested |
|
33 | 32 | |
|
34 | 33 | from IPython.config.configurable import Configurable |
@@ -102,7 +101,7 b' def softspace(file, newvalue):' | |||
|
102 | 101 | |
|
103 | 102 | def no_op(*a, **kw): pass |
|
104 | 103 | |
|
105 |
class SpaceInInput( |
|
|
104 | class SpaceInInput(Exception): pass | |
|
106 | 105 | |
|
107 | 106 | class Bunch: pass |
|
108 | 107 | |
@@ -550,7 +549,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
550 | 549 | # accepts it. Probably at least check that the hook takes the number |
|
551 | 550 | # of args it's supposed to. |
|
552 | 551 | |
|
553 |
f = |
|
|
552 | f = types.MethodType(hook, self) | |
|
554 | 553 | |
|
555 | 554 | # check if the hook is for strdispatcher first |
|
556 | 555 | if str_key is not None: |
@@ -1249,7 +1248,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1249 | 1248 | def init_shadow_hist(self): |
|
1250 | 1249 | try: |
|
1251 | 1250 | self.db = pickleshare.PickleShareDB(self.ipython_dir + "/db") |
|
1252 |
except |
|
|
1251 | except UnicodeDecodeError: | |
|
1253 | 1252 | print "Your ipython_dir can't be decoded to unicode!" |
|
1254 | 1253 | print "Please set HOME environment variable to something that" |
|
1255 | 1254 | print r"only has ASCII characters, e.g. c:\home" |
@@ -1414,7 +1413,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1414 | 1413 | |
|
1415 | 1414 | if handler is None: handler = dummy_handler |
|
1416 | 1415 | |
|
1417 |
self.CustomTB = |
|
|
1416 | self.CustomTB = types.MethodType(handler, self) | |
|
1418 | 1417 | self.custom_exceptions = exc_tuple |
|
1419 | 1418 | |
|
1420 | 1419 | def excepthook(self, etype, value, tb): |
@@ -1756,8 +1755,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
1756 | 1755 | The position argument (defaults to 0) is the index in the completers |
|
1757 | 1756 | list where you want the completer to be inserted.""" |
|
1758 | 1757 | |
|
1759 |
newcomp = |
|
|
1760 | self.Completer.__class__) | |
|
1758 | newcomp = types.MethodType(completer, self.Completer) | |
|
1761 | 1759 | self.Completer.matchers.insert(pos,newcomp) |
|
1762 | 1760 | |
|
1763 | 1761 | def set_readline_completer(self): |
@@ -1828,12 +1826,11 b' class InteractiveShell(Configurable, Magic):' | |||
|
1828 | 1826 | print 'Magic function. Passed parameter is between < >:' |
|
1829 | 1827 | print '<%s>' % parameter_s |
|
1830 | 1828 | print 'The self object is:',self |
|
1831 | ||
|
1829 | newcomp = types.MethodType(completer, self.Completer) | |
|
1832 | 1830 | self.define_magic('foo',foo_impl) |
|
1833 | 1831 | """ |
|
1834 | 1832 | |
|
1835 | import new | |
|
1836 | im = new.instancemethod(func,self, self.__class__) | |
|
1833 | im = types.MethodType(func, self) | |
|
1837 | 1834 | old = getattr(self, "magic_" + magicname, None) |
|
1838 | 1835 | setattr(self, "magic_" + magicname, im) |
|
1839 | 1836 | return old |
General Comments 0
You need to be logged in to leave comments.
Login now