##// END OF EJS Templates
Remove import indirection and deprecated private function....
Matthias Bussonnier -
Show More
@@ -116,13 +116,14 b' from IPython.core import debugger'
116 116 from IPython.core.display_trap import DisplayTrap
117 117 from IPython.core.excolors import exception_colors
118 118 from IPython.utils import PyColorize
119 from IPython.utils import openpy
120 119 from IPython.utils import path as util_path
121 120 from IPython.utils import py3compat
122 121 from IPython.utils.data import uniq_stable
123 122 from IPython.utils.terminal import get_terminal_size
124 123 from logging import info, error, debug
125 124
125 from importlib.util import source_from_cache
126
126 127 import IPython.utils.colorable as colorable
127 128
128 129 # Globals
@@ -906,7 +907,7 b' class VerboseTB(TBTools):'
906 907 elif file.endswith(('.pyc', '.pyo')):
907 908 # Look up the corresponding source file.
908 909 try:
909 file = openpy.source_from_cache(file)
910 file = source_from_cache(file)
910 911 except ValueError:
911 912 # Failed to get the source file for some reason
912 913 # E.g. https://github.com/ipython/ipython/issues/9486
@@ -116,10 +116,9 b' import traceback'
116 116 import types
117 117 import weakref
118 118 from importlib import import_module
119 from importlib.util import source_from_cache
119 120 from imp import reload
120 121
121 from IPython.utils import openpy
122
123 122 #------------------------------------------------------------------------------
124 123 # Autoreload functionality
125 124 #------------------------------------------------------------------------------
@@ -195,7 +194,7 b' class ModuleReloader(object):'
195 194 py_filename = filename
196 195 else:
197 196 try:
198 py_filename = openpy.source_from_cache(filename)
197 py_filename = source_from_cache(filename)
199 198 except ValueError:
200 199 return None, None
201 200
@@ -103,15 +103,3 b" def read_py_url(url, errors='replace', skip_encoding_cookie=True):"
103 103 response = urlopen(url)
104 104 buffer = io.BytesIO(response.read())
105 105 return source_to_unicode(buffer, errors, skip_encoding_cookie)
106
107 def _list_readline(x):
108 """Given a list, returns a readline() function that returns the next element
109 with each call.
110 """
111 x = iter(x)
112 def readline():
113 return next(x)
114 return readline
115
116 # Code for going between .py files and cached .pyc files ----------------------
117 from importlib.util import source_from_cache, cache_from_source
@@ -29,11 +29,3 b' def test_source_to_unicode():'
29 29
30 30 source_no_cookie = openpy.source_to_unicode(source_bytes, skip_encoding_cookie=True)
31 31 nt.assert_not_in(u'coding: iso-8859-5', source_no_cookie)
32
33 def test_list_readline():
34 l = ['a', 'b']
35 readline = openpy._list_readline(l)
36 nt.assert_equal(readline(), 'a')
37 nt.assert_equal(readline(), 'b')
38 with nt.assert_raises(StopIteration):
39 readline() No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now