ulinecache.py 684 Bytes
Newer Older
Stelios Karozis's avatar
Stelios Karozis committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
"""
This module has been deprecated since IPython 6.0.

Wrapper around linecache which decodes files to unicode according to PEP 263.
"""
import functools
import linecache
from warnings import warn

getline = linecache.getline

# getlines has to be looked up at runtime, because doctests monkeypatch it.
@functools.wraps(linecache.getlines)
def getlines(filename, module_globals=None):
    """
    Deprecated since IPython 6.0
    """
    warn(("`IPython.utils.ulinecache.getlines` is deprecated since"
          " IPython 6.0 and will be removed in future versions."),
         DeprecationWarning, stacklevel=2)
    return linecache.getlines(filename, module_globals=module_globals)