##// END OF EJS Templates
Remove uses of compatibility builtin_mod and builtin_mod_name
Thomas Kluyver -
Show More
@@ -1,31 +1,14 b''
1 1 """
2 A context manager for managing things injected into :mod:`__builtin__`.
3
4 Authors:
5
6 * Brian Granger
7 * Fernando Perez
2 A context manager for managing things injected into :mod:`builtins`.
8 3 """
9 #-----------------------------------------------------------------------------
10 # Copyright (C) 2010-2011 The IPython Development Team.
11 #
12 # Distributed under the terms of the BSD License.
13 #
14 # Complete license in the file COPYING.txt, distributed with this software.
15 #-----------------------------------------------------------------------------
16
17 #-----------------------------------------------------------------------------
18 # Imports
19 #-----------------------------------------------------------------------------
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
6 import builtins as builtin_mod
20 7
21 8 from traitlets.config.configurable import Configurable
22 9
23 from IPython.utils.py3compat import builtin_mod
24 10 from traitlets import Instance
25 11
26 #-----------------------------------------------------------------------------
27 # Classes and functions
28 #-----------------------------------------------------------------------------
29 12
30 13 class __BuiltinUndefined(object): pass
31 14 BuiltinUndefined = __BuiltinUndefined()
@@ -15,6 +15,7 b' upstream and were accepted as of Python 2.3,'
15 15
16 16
17 17 import __main__
18 import builtins as builtin_mod
18 19 import glob
19 20 import inspect
20 21 import itertools
@@ -35,7 +36,7 b' from IPython.utils import generics'
35 36 from IPython.utils.decorators import undoc
36 37 from IPython.utils.dir2 import dir2, get_real_method
37 38 from IPython.utils.process import arg_split
38 from IPython.utils.py3compat import builtin_mod, cast_unicode_py2
39 from IPython.utils.py3compat import cast_unicode_py2
39 40 from traitlets import Bool, Enum, observe
40 41
41 42 from functools import wraps
@@ -7,13 +7,13 b' This defines a callable class that IPython uses for `sys.displayhook`.'
7 7 # Copyright (c) IPython Development Team.
8 8 # Distributed under the terms of the Modified BSD License.
9 9
10
10 import builtins as builtin_mod
11 11 import sys
12 12 import io as _io
13 13 import tokenize
14 14
15 15 from traitlets.config.configurable import Configurable
16 from IPython.utils.py3compat import builtin_mod, cast_unicode_py2
16 from IPython.utils.py3compat import cast_unicode_py2
17 17 from traitlets import Instance, Float
18 18 from warnings import warn
19 19
@@ -15,6 +15,7 b' import __future__'
15 15 import abc
16 16 import ast
17 17 import atexit
18 import builtins as builtin_mod
18 19 import functools
19 20 import os
20 21 import re
@@ -67,7 +68,6 b' from IPython.utils.ipstruct import Struct'
67 68 from IPython.paths import get_ipython_dir
68 69 from IPython.utils.path import get_home_dir, get_py_filename, ensure_dir_exists
69 70 from IPython.utils.process import system, getoutput
70 from IPython.utils.py3compat import builtin_mod
71 71 from IPython.utils.strdispatch import StrDispatch
72 72 from IPython.utils.syspathcontext import prepended_to_syspath
73 73 from IPython.utils.text import format_screen, LSString, SList, DollarFormatter
@@ -7,6 +7,7 b''
7 7
8 8 import ast
9 9 import bdb
10 import builtins as builtin_mod
10 11 import gc
11 12 import itertools
12 13 import os
@@ -35,8 +36,6 b' from IPython.core.macro import Macro'
35 36 from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic,
36 37 line_cell_magic, on_off, needs_local_scope)
37 38 from IPython.testing.skipdoctest import skip_doctest
38 from IPython.utils import py3compat
39 from IPython.utils.py3compat import builtin_mod
40 39 from IPython.utils.contexts import preserve_keys
41 40 from IPython.utils.capture import capture_output
42 41 from IPython.utils.ipstruct import Struct
@@ -32,6 +32,7 b' re-implementation of hierarchical module import.'
32 32 # the file COPYING, distributed as part of this software.
33 33 #*****************************************************************************
34 34
35 import builtins as builtin_mod
35 36 from contextlib import contextmanager
36 37 import imp
37 38 import sys
@@ -39,8 +40,6 b' import sys'
39 40 from types import ModuleType
40 41 from warnings import warn
41 42
42 from IPython.utils.py3compat import builtin_mod, builtin_mod_name
43
44 43 original_import = builtin_mod.__import__
45 44
46 45 @contextmanager
@@ -320,13 +319,10 b' def deep_reload_hook(m):'
320 319 return newm
321 320
322 321 # Save the original hooks
323 try:
324 original_reload = builtin_mod.reload
325 except AttributeError:
326 322 original_reload = imp.reload # Python 3
327 323
328 324 # Replacement for reload()
329 def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__',
325 def reload(module, exclude=('sys', 'os.path', 'builtins', '__main__',
330 326 'numpy', 'numpy._globals')):
331 327 """Recursively reload all modules used in the given module. Optionally
332 328 takes a list of modules to exclude from reloading. The default exclude
@@ -9,6 +9,7 b' done.'
9 9 # Copyright (c) IPython Development Team.
10 10 # Distributed under the terms of the Modified BSD License.
11 11
12 import builtins as builtin_mod
12 13 import sys
13 14 import warnings
14 15
@@ -17,7 +18,6 b' from . import tools'
17 18 from IPython.core import page
18 19 from IPython.utils import io
19 20 from IPython.utils import py3compat
20 from IPython.utils.py3compat import builtin_mod
21 21 from IPython.terminal.interactiveshell import TerminalInteractiveShell
22 22
23 23
@@ -19,6 +19,7 b' Limitations:'
19 19 # Module imports
20 20
21 21 # From the standard library
22 import builtins as builtin_mod
22 23 import doctest
23 24 import inspect
24 25 import logging
@@ -45,9 +46,6 b' from doctest import (REPORTING_FLAGS, REPORT_ONLY_FIRST_FAILURE,'
45 46 from nose.plugins import doctests, Plugin
46 47 from nose.util import anyp, tolist
47 48
48 # Our own imports
49 from IPython.utils.py3compat import builtin_mod
50
51 49 #-----------------------------------------------------------------------------
52 50 # Module globals and other constants
53 51 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now