Replace all import of IPython.utils.warn module
Pierre Gerold -
r22092:c4935968
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -29,7 +29,7 from IPython.core.error import UsageError
29
29
30 from IPython.utils.py3compat import string_types
30 from IPython.utils.py3compat import string_types
31 from traitlets import List, Instance
31 from traitlets import List, Instance
32 from IPython.utils.warn import error
32 from logging import error
33
33
34 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
35 # Utilities
35 # Utilities
@@ -18,7 +18,7 from traitlets.config.configurable import Configurable
18 from IPython.utils import io
18 from IPython.utils import io
19 from IPython.utils.py3compat import builtin_mod, cast_unicode_py2
19 from IPython.utils.py3compat import builtin_mod, cast_unicode_py2
20 from traitlets import Instance, Float
20 from traitlets import Instance, Float
21 from IPython.utils.warn import warn
21 from warnings import warn
22
22
23 # TODO: Move the various attributes (cache_size, [others now moved]). Some
23 # TODO: Move the various attributes (cache_size, [others now moved]). Some
24 # of these are also attributes of InteractiveShell. They should be on ONE object
24 # of these are also attributes of InteractiveShell. They should be on ONE object
@@ -293,4 +293,3 class DisplayHook(Configurable):
293 # IronPython blocks here forever
293 # IronPython blocks here forever
294 if sys.platform != "cli":
294 if sys.platform != "cli":
295 gc.collect()
295 gc.collect()
296
@@ -35,7 +35,7 from IPython.utils import py3compat
35 from traitlets import (
35 from traitlets import (
36 Any, Bool, Dict, Instance, Integer, List, Unicode, TraitError,
36 Any, Bool, Dict, Instance, Integer, List, Unicode, TraitError,
37 )
37 )
38 from IPython.utils.warn import warn
38 from warnings import warn
39
39
40 #-----------------------------------------------------------------------------
40 #-----------------------------------------------------------------------------
41 # Classes and functions
41 # Classes and functions
@@ -879,5 +879,3 def _format_lineno(session, line):
879 if session == 0:
879 if session == 0:
880 return str(line)
880 return str(line)
881 return "%s#%s" % (session, line)
881 return "%s#%s" % (session, line)
882
883
@@ -77,7 +77,8 from IPython.utils.text import (format_screen, LSString, SList,
77 DollarFormatter)
77 DollarFormatter)
78 from traitlets import (Integer, Bool, CBool, CaselessStrEnum, Enum,
78 from traitlets import (Integer, Bool, CBool, CaselessStrEnum, Enum,
79 List, Dict, Unicode, Instance, Type)
79 List, Dict, Unicode, Instance, Type)
80 from IPython.utils.warn import warn, error
80 from warnings import warn
81 from logging import error
81 import IPython.core.hooks
82 import IPython.core.hooks
82
83
83 #-----------------------------------------------------------------------------
84 #-----------------------------------------------------------------------------
@@ -33,7 +33,7 from IPython.utils.process import arg_split
33 from IPython.utils.py3compat import string_types, iteritems
33 from IPython.utils.py3compat import string_types, iteritems
34 from IPython.utils.text import dedent
34 from IPython.utils.text import dedent
35 from traitlets import Bool, Dict, Instance
35 from traitlets import Bool, Dict, Instance
36 from IPython.utils.warn import error
36 from logging import error
37
37
38 #-----------------------------------------------------------------------------
38 #-----------------------------------------------------------------------------
39 # Globals
39 # Globals
@@ -16,7 +16,7 from __future__ import print_function
16 # Our own packages
16 # Our own packages
17 from IPython.core.magic import Bunch, Magics, magics_class, line_magic
17 from IPython.core.magic import Bunch, Magics, magics_class, line_magic
18 from IPython.testing.skipdoctest import skip_doctest
18 from IPython.testing.skipdoctest import skip_doctest
19 from IPython.utils.warn import error
19 from logging import error
20
20
21 #-----------------------------------------------------------------------------
21 #-----------------------------------------------------------------------------
22 # Magic implementation classes
22 # Magic implementation classes
@@ -14,7 +14,8 from IPython.testing.skipdoctest import skip_doctest
14 from IPython.utils.ipstruct import Struct
14 from IPython.utils.ipstruct import Struct
15 from IPython.utils.path import unquote_filename
15 from IPython.utils.path import unquote_filename
16 from IPython.utils.py3compat import unicode_type
16 from IPython.utils.py3compat import unicode_type
17 from IPython.utils.warn import warn, error
17 from warnings import warn
18 from logging import error
18
19
19
20
20 class MagicsDisplay(object):
21 class MagicsDisplay(object):
@@ -32,7 +32,8 from IPython.utils import py3compat
32 from IPython.utils.py3compat import string_types
32 from IPython.utils.py3compat import string_types
33 from IPython.utils.contexts import preserve_keys
33 from IPython.utils.contexts import preserve_keys
34 from IPython.utils.path import get_py_filename, unquote_filename
34 from IPython.utils.path import get_py_filename, unquote_filename
35 from IPython.utils.warn import warn, error
35 from warnings import warn
36 from logging import error
36 from IPython.utils.text import get_text_list
37 from IPython.utils.text import get_text_list
37
38
38 #-----------------------------------------------------------------------------
39 #-----------------------------------------------------------------------------
@@ -19,7 +19,7 import re
19 # Our own packages
19 # Our own packages
20 from IPython.core.error import UsageError
20 from IPython.core.error import UsageError
21 from IPython.core.magic import Magics, magics_class, line_magic
21 from IPython.core.magic import Magics, magics_class, line_magic
22 from IPython.utils.warn import error
22 from logging import error
23
23
24 #-----------------------------------------------------------------------------
24 #-----------------------------------------------------------------------------
25 # Magic implementation classes
25 # Magic implementation classes
@@ -43,7 +43,8 from IPython.utils.ipstruct import Struct
43 from IPython.utils.module_paths import find_mod
43 from IPython.utils.module_paths import find_mod
44 from IPython.utils.path import get_py_filename, unquote_filename, shellglob
44 from IPython.utils.path import get_py_filename, unquote_filename, shellglob
45 from IPython.utils.timing import clock, clock2
45 from IPython.utils.timing import clock, clock2
46 from IPython.utils.warn import warn, error
46 from warnings import warn
47 from logging import error
47
48
48 if PY3:
49 if PY3:
49 from io import StringIO
50 from io import StringIO
@@ -18,7 +18,7 import sys
18
18
19 # Our own packages
19 # Our own packages
20 from IPython.core.magic import Magics, magics_class, line_magic
20 from IPython.core.magic import Magics, magics_class, line_magic
21 from IPython.utils.warn import warn
21 from warnings import warn
22 from IPython.utils.py3compat import str_to_unicode
22 from IPython.utils.py3compat import str_to_unicode
23
23
24 #-----------------------------------------------------------------------------
24 #-----------------------------------------------------------------------------
@@ -18,7 +18,7 from traitlets.config.application import Application
18 from IPython.core import magic_arguments
18 from IPython.core import magic_arguments
19 from IPython.core.magic import Magics, magics_class, line_magic
19 from IPython.core.magic import Magics, magics_class, line_magic
20 from IPython.testing.skipdoctest import skip_doctest
20 from IPython.testing.skipdoctest import skip_doctest
21 from IPython.utils.warn import warn
21 from warnings import warn
22 from IPython.core.pylabtools import backends
22 from IPython.core.pylabtools import backends
23
23
24 #-----------------------------------------------------------------------------
24 #-----------------------------------------------------------------------------
@@ -118,7 +118,7 from IPython.utils import path as util_path
118 from IPython.utils import py3compat
118 from IPython.utils import py3compat
119 from IPython.utils import ulinecache
119 from IPython.utils import ulinecache
120 from IPython.utils.data import uniq_stable
120 from IPython.utils.data import uniq_stable
121 from IPython.utils.warn import info, error
121 from logging import info, error
122
122
123 # Globals
123 # Globals
124 # amount of space to put line numbers before verbose tracebacks
124 # amount of space to put line numbers before verbose tracebacks
@@ -36,7 +36,7 import threading
36
36
37 from IPython import get_ipython
37 from IPython import get_ipython
38 from IPython.core.ultratb import AutoFormattedTB
38 from IPython.core.ultratb import AutoFormattedTB
39 from IPython.utils.warn import error
39 from logging import error
40 from IPython.utils.py3compat import string_types
40 from IPython.utils.py3compat import string_types
41
41
42
42
@@ -17,7 +17,7 import platform
17 import sys
17 import sys
18 from distutils.version import LooseVersion as V
18 from distutils.version import LooseVersion as V
19
19
20 from IPython.utils.warn import warn
20 from warnings import warn
21
21
22 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
23 # Constants
23 # Constants
@@ -22,7 +22,8 from IPython.utils.encoding import get_stream_enc
22 from IPython.utils import py3compat
22 from IPython.utils import py3compat
23 from IPython.utils.terminal import toggle_set_term_title, set_term_title
23 from IPython.utils.terminal import toggle_set_term_title, set_term_title
24 from IPython.utils.process import abbrev_cwd
24 from IPython.utils.process import abbrev_cwd
25 from IPython.utils.warn import warn, error
25 from warnings import warn
26 from logging import error
26 from IPython.utils.text import num_ini_spaces, SList, strip_email_quotes
27 from IPython.utils.text import num_ini_spaces, SList, strip_email_quotes
27 from traitlets import Integer, CBool, Unicode
28 from traitlets import Integer, CBool, Unicode
28
29
@@ -212,7 +212,7 test_group_names.append('autoreload')
212
212
213 def check_exclusions_exist():
213 def check_exclusions_exist():
214 from IPython.paths import get_ipython_package_dir
214 from IPython.paths import get_ipython_package_dir
215 from IPython.utils.warn import warn
215 from warnings import warn
216 parent = os.path.dirname(get_ipython_package_dir())
216 parent = os.path.dirname(get_ipython_package_dir())
217 for sec in test_sections:
217 for sec in test_sections:
218 for pattern in sec.exclusions:
218 for pattern in sec.exclusions:
@@ -439,4 +439,3 def run_iptest():
439
439
440 if __name__ == '__main__':
440 if __name__ == '__main__':
441 run_iptest()
441 run_iptest()
442
@@ -12,7 +12,7 import sys
12
12
13 from IPython.utils import io
13 from IPython.utils import io
14
14
15 from warning import warn
15 from warnings import warn
16
16
17 warn("The module IPython.utils.warn is deprecated, use the standard warnings module instead", DeprecationWarning)
17 warn("The module IPython.utils.warn is deprecated, use the standard warnings module instead", DeprecationWarning)
18
18
Comments 0
You need to be logged in to leave comments. Login now