##// END OF EJS Templates
Fix contextlib imports for python3 as per @takluyver's review.
Fernando Perez -
Show More
@@ -28,8 +28,13 b' import runpy'
28 import sys
28 import sys
29 import tempfile
29 import tempfile
30 import types
30 import types
31 import urllib
31
32 from io import open as io_open
32 # We need to use nested to support python 2.6, once we move to >=2.7, we can
33 # use the with keyword's new builtin support for nested managers
34 try:
35 from contextlib import nested
36 except:
37 from IPython.utils.nested_context import nested
33
38
34 from IPython.config.configurable import SingletonConfigurable
39 from IPython.config.configurable import SingletonConfigurable
35 from IPython.core import debugger, oinspect
40 from IPython.core import debugger, oinspect
@@ -25,9 +25,15 b' Notes'
25 from __future__ import with_statement
25 from __future__ import with_statement
26
26
27 import sys
27 import sys
28 from contextlib import nested
29 import warnings
28 import warnings
30
29
30 # We need to use nested to support python 2.6, once we move to >=2.7, we can
31 # use the with keyword's new builtin support for nested managers
32 try:
33 from contextlib import nested
34 except:
35 from IPython.utils.nested_context import nested
36
31 from IPython.core import ultratb
37 from IPython.core import ultratb
32 from IPython.core.magic import Magics, magics_class, line_magic
38 from IPython.core.magic import Magics, magics_class, line_magic
33 from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
39 from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
@@ -20,7 +20,12 b' import re'
20 import sys
20 import sys
21 import textwrap
21 import textwrap
22
22
23 from contextlib import nested
23 # We need to use nested to support python 2.6, once we move to >=2.7, we can
24 # use the with keyword's new builtin support for nested managers
25 try:
26 from contextlib import nested
27 except:
28 from IPython.utils.nested_context import nested
24
29
25 from IPython.core.error import TryNext, UsageError
30 from IPython.core.error import TryNext, UsageError
26 from IPython.core.usage import interactive_usage, default_banner
31 from IPython.core.usage import interactive_usage, default_banner
General Comments 0
You need to be logged in to leave comments. Login now