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