##// END OF EJS Templates
the __future__ is now.
Paul Ivanov -
Show More
@@ -18,7 +18,6 b' http://ipython.org'
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Imports
19 # Imports
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 from __future__ import absolute_import
22
21
23 import os
22 import os
24 import sys
23 import sys
@@ -25,7 +25,6 b' Authors'
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26 # Imports
26 # Imports
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28 from __future__ import print_function
29
28
30 # Stdlib imports
29 # Stdlib imports
31 import __future__
30 import __future__
@@ -13,7 +13,6 b' upstream and were accepted as of Python 2.3,'
13 # Some of this code originated from rlcompleter in the Python standard library
13 # Some of this code originated from rlcompleter in the Python standard library
14 # Copyright (C) 2001 Python Software Foundation, www.python.org
14 # Copyright (C) 2001 Python Software Foundation, www.python.org
15
15
16 from __future__ import print_function
17
16
18 import __main__
17 import __main__
19 import glob
18 import glob
@@ -14,7 +14,6 b' These are all loaded by default by IPython.'
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15 # Imports
15 # Imports
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17 from __future__ import print_function
18
17
19 # Stdlib imports
18 # Stdlib imports
20 import glob
19 import glob
@@ -18,7 +18,6 b' Authors:'
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Imports
19 # Imports
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 from __future__ import print_function
22
21
23 import os
22 import os
24 import sys
23 import sys
@@ -24,7 +24,6 b' http://www.python.org/2.2.3/license.html"""'
24 #
24 #
25 #
25 #
26 #*****************************************************************************
26 #*****************************************************************************
27 from __future__ import print_function
28
27
29 import bdb
28 import bdb
30 import functools
29 import functools
@@ -4,7 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function
8
7
9 try:
8 try:
10 from base64 import encodebytes as base64_encode
9 from base64 import encodebytes as base64_encode
@@ -7,7 +7,6 b' This defines a callable class that IPython uses for `sys.displayhook`.'
7 # Copyright (c) IPython Development Team.
7 # Copyright (c) IPython Development Team.
8 # Distributed under the terms of the Modified BSD License.
8 # Distributed under the terms of the Modified BSD License.
9
9
10 from __future__ import print_function
11
10
12 import sys
11 import sys
13 import io as _io
12 import io as _io
@@ -15,7 +15,6 b' spec.'
15 # Copyright (c) IPython Development Team.
15 # Copyright (c) IPython Development Team.
16 # Distributed under the terms of the Modified BSD License.
16 # Distributed under the terms of the Modified BSD License.
17
17
18 from __future__ import print_function
19
18
20 import sys
19 import sys
21
20
@@ -12,7 +12,6 b' events and the arguments which will be passed to them.'
12
12
13 This API is experimental in IPython 2.0, and may be revised in future versions.
13 This API is experimental in IPython 2.0, and may be revised in future versions.
14 """
14 """
15 from __future__ import print_function
16
15
17 class EventManager(object):
16 class EventManager(object):
18 """Manage a collection of events and a sequence of callbacks for each.
17 """Manage a collection of events and a sequence of callbacks for each.
@@ -3,7 +3,6 b''
3 # Copyright (c) IPython Development Team.
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
4 # Distributed under the terms of the Modified BSD License.
5
5
6 from __future__ import print_function
7
6
8 import atexit
7 import atexit
9 import datetime
8 import datetime
@@ -4,7 +4,6 b' An application for managing IPython history.'
4
4
5 To be invoked as the `ipython history` subcommand.
5 To be invoked as the `ipython history` subcommand.
6 """
6 """
7 from __future__ import print_function
8
7
9 import os
8 import os
10 import sqlite3
9 import sqlite3
@@ -10,7 +10,6 b''
10 # the file COPYING, distributed as part of this software.
10 # the file COPYING, distributed as part of this software.
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12
12
13 from __future__ import absolute_import, print_function
14
13
15 import __future__
14 import __future__
16 import abc
15 import abc
@@ -1,6 +1,5 b''
1 """Logger class for IPython's logging facilities.
1 """Logger class for IPython's logging facilities.
2 """
2 """
3 from __future__ import print_function
4
3
5 #*****************************************************************************
4 #*****************************************************************************
6 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
5 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -1,7 +1,6 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3 """
3 """
4 from __future__ import print_function
5
4
6 #-----------------------------------------------------------------------------
5 #-----------------------------------------------------------------------------
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
6 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -1,7 +1,5 b''
1 """Implementation of magic functions that control various automatic behaviors.
1 """Implementation of magic functions that control various automatic behaviors.
2 """
2 """
3 from __future__ import print_function
4 from __future__ import absolute_import
5 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
6 # Copyright (c) 2012 The IPython Development Team.
4 # Copyright (c) 2012 The IPython Development Team.
7 #
5 #
@@ -1,7 +1,5 b''
1 """Implementation of basic magic functions."""
1 """Implementation of basic magic functions."""
2
2
3 from __future__ import print_function
4 from __future__ import absolute_import
5
3
6 import argparse
4 import argparse
7 import io
5 import io
@@ -1,7 +1,5 b''
1 """Implementation of code management magic functions.
1 """Implementation of code management magic functions.
2 """
2 """
3 from __future__ import print_function
4 from __future__ import absolute_import
5 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
6 # Copyright (c) 2012 The IPython Development Team.
4 # Copyright (c) 2012 The IPython Development Team.
7 #
5 #
@@ -1,7 +1,5 b''
1 """Implementation of configuration-related magic functions.
1 """Implementation of configuration-related magic functions.
2 """
2 """
3 from __future__ import print_function
4 from __future__ import absolute_import
5 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
6 # Copyright (c) 2012 The IPython Development Team.
4 # Copyright (c) 2012 The IPython Development Team.
7 #
5 #
@@ -4,8 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function
8 from __future__ import absolute_import
9
7
10 import ast
8 import ast
11 import bdb
9 import bdb
@@ -1,6 +1,5 b''
1 """Implementation of magic functions for the extension machinery.
1 """Implementation of magic functions for the extension machinery.
2 """
2 """
3 from __future__ import print_function
4 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
5 # Copyright (c) 2012 The IPython Development Team.
4 # Copyright (c) 2012 The IPython Development Team.
6 #
5 #
@@ -11,7 +11,6 b''
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 from __future__ import print_function
15
14
16 # Stdlib
15 # Stdlib
17 import os
16 import os
@@ -1,6 +1,5 b''
1 """Implementation of namespace-related magic functions.
1 """Implementation of namespace-related magic functions.
2 """
2 """
3 from __future__ import print_function
4 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
5 # Copyright (c) 2012 The IPython Development Team.
4 # Copyright (c) 2012 The IPython Development Team.
6 #
5 #
@@ -3,7 +3,6 b''
3 Note: this module is named 'osm' instead of 'os' to avoid a collision with the
3 Note: this module is named 'osm' instead of 'os' to avoid a collision with the
4 builtin.
4 builtin.
5 """
5 """
6 from __future__ import print_function
7 #-----------------------------------------------------------------------------
6 #-----------------------------------------------------------------------------
8 # Copyright (c) 2012 The IPython Development Team.
7 # Copyright (c) 2012 The IPython Development Team.
9 #
8 #
@@ -1,6 +1,5 b''
1 """Implementation of magic functions for matplotlib/pylab support.
1 """Implementation of magic functions for matplotlib/pylab support.
2 """
2 """
3 from __future__ import print_function
4 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
5 # Copyright (c) 2012 The IPython Development Team.
4 # Copyright (c) 2012 The IPython Development Team.
6 #
5 #
@@ -1,5 +1,4 b''
1 """Magic functions for running cells in various scripts."""
1 """Magic functions for running cells in various scripts."""
2 from __future__ import print_function
3
2
4 # Copyright (c) IPython Development Team.
3 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
4 # Distributed under the terms of the Modified BSD License.
@@ -10,8 +10,6 b' reference the name under which an object is being read.'
10 # Copyright (c) IPython Development Team.
10 # Copyright (c) IPython Development Team.
11 # Distributed under the terms of the Modified BSD License.
11 # Distributed under the terms of the Modified BSD License.
12
12
13 from __future__ import print_function
14
15 __all__ = ['Inspector','InspectColors']
13 __all__ = ['Inspector','InspectColors']
16
14
17 # stdlib modules
15 # stdlib modules
@@ -13,7 +13,6 b' rid of that dependency, we could move it there.'
13 # Copyright (c) IPython Development Team.
13 # Copyright (c) IPython Development Team.
14 # Distributed under the terms of the Modified BSD License.
14 # Distributed under the terms of the Modified BSD License.
15
15
16 from __future__ import print_function
17
16
18 import os
17 import os
19 import re
18 import re
@@ -9,7 +9,6 b' Authors:'
9 * Min RK
9 * Min RK
10
10
11 """
11 """
12 from __future__ import print_function
13
12
14 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
15 # Copyright (C) 2008 The IPython Development Team
14 # Copyright (C) 2008 The IPython Development Team
@@ -1,6 +1,5 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Pylab (matplotlib) support utilities."""
2 """Pylab (matplotlib) support utilities."""
3 from __future__ import print_function
4
3
5 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
6 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
@@ -7,9 +7,6 b' launch InteractiveShell instances, load extensions, etc.'
7 # Copyright (c) IPython Development Team.
7 # Copyright (c) IPython Development Team.
8 # Distributed under the terms of the Modified BSD License.
8 # Distributed under the terms of the Modified BSD License.
9
9
10 from __future__ import absolute_import
11 from __future__ import print_function
12
13 import glob
10 import glob
14 import os
11 import os
15 import sys
12 import sys
@@ -1,5 +1,4 b''
1 # coding: iso-8859-5
1 # coding: iso-8859-5
2 # (Unlikely to be the default encoding for most testers.)
2 # (Unlikely to be the default encoding for most testers.)
3 # ������������������� <- Cyrillic characters
3 # ������������������� <- Cyrillic characters
4 from __future__ import unicode_literals
5 u = '����'
4 u = '����'
@@ -1,3 +1,2 b''
1 from __future__ import print_function
2 import sys
1 import sys
3 print(sys.argv[1:])
2 print(sys.argv[1:])
@@ -12,7 +12,6 b' This script is meant to be called by other parts of the test suite that call it'
12 via %run as if it were executed interactively by the user. As of 2011-05-29,
12 via %run as if it were executed interactively by the user. As of 2011-05-29,
13 test_run.py calls it.
13 test_run.py calls it.
14 """
14 """
15 from __future__ import print_function
16
15
17 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
18 # Module imports
17 # Module imports
@@ -2,7 +2,6 b''
2
2
3 See test_run for details."""
3 See test_run for details."""
4
4
5 from __future__ import print_function
6
5
7 import sys
6 import sys
8
7
@@ -12,7 +12,6 b''
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13 # Imports
13 # Imports
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15 from __future__ import print_function
16
15
17 # Stdlib imports
16 # Stdlib imports
18 import linecache
17 import linecache
@@ -2,7 +2,6 b''
2 """Tests for completerlib.
2 """Tests for completerlib.
3
3
4 """
4 """
5 from __future__ import absolute_import
6
5
7 #-----------------------------------------------------------------------------
6 #-----------------------------------------------------------------------------
8 # Imports
7 # Imports
@@ -1,6 +1,5 b''
1 """Tests for debugging machinery.
1 """Tests for debugging machinery.
2 """
2 """
3 from __future__ import print_function
4
3
5 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
6 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
@@ -1,7 +1,6 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Tests for CommandChainDispatcher."""
2 """Tests for CommandChainDispatcher."""
3
3
4 from __future__ import absolute_import
5
4
6 #-----------------------------------------------------------------------------
5 #-----------------------------------------------------------------------------
7 # Imports
6 # Imports
@@ -1,7 +1,6 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Tests for the inputsplitter module."""
2 """Tests for the inputsplitter module."""
3
3
4 from __future__ import print_function
5
4
6 # Copyright (c) IPython Development Team.
5 # Copyright (c) IPython Development Team.
7 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
@@ -143,7 +143,6 b' class InteractiveShellTestCase(unittest.TestCase):'
143
143
144 def test_future_flags(self):
144 def test_future_flags(self):
145 """Check that future flags are used for parsing code (gh-777)"""
145 """Check that future flags are used for parsing code (gh-777)"""
146 ip.run_cell('from __future__ import print_function')
147 try:
146 try:
148 ip.run_cell('prfunc_return_val = print(1,2, sep=" ")')
147 ip.run_cell('prfunc_return_val = print(1,2, sep=" ")')
149 assert 'prfunc_return_val' in ip.user_ns
148 assert 'prfunc_return_val' in ip.user_ns
@@ -151,18 +150,6 b' class InteractiveShellTestCase(unittest.TestCase):'
151 # Reset compiler flags so we don't mess up other tests.
150 # Reset compiler flags so we don't mess up other tests.
152 ip.compile.reset_compiler_flags()
151 ip.compile.reset_compiler_flags()
153
152
154 def test_future_unicode(self):
155 """Check that unicode_literals is imported from __future__ (gh #786)"""
156 try:
157 ip.run_cell(u'byte_str = "a"')
158 assert isinstance(ip.user_ns['byte_str'], str) # string literals are byte strings by default
159 ip.run_cell('from __future__ import unicode_literals')
160 ip.run_cell(u'unicode_str = "a"')
161 assert isinstance(ip.user_ns['unicode_str'], unicode_type) # strings literals are now unicode
162 finally:
163 # Reset compiler flags so we don't mess up other tests.
164 ip.compile.reset_compiler_flags()
165
166 def test_can_pickle(self):
153 def test_can_pickle(self):
167 "Can we pickle objects defined interactively (GH-29)"
154 "Can we pickle objects defined interactively (GH-29)"
168 ip = get_ipython()
155 ip = get_ipython()
@@ -3,7 +3,6 b''
3
3
4 Needs to be run by nose (to make ipython session available).
4 Needs to be run by nose (to make ipython session available).
5 """
5 """
6 from __future__ import absolute_import
7
6
8 import io
7 import io
9 import os
8 import os
@@ -2,7 +2,6 b''
2
2
3 Needs to be run by nose (to make ipython session available).
3 Needs to be run by nose (to make ipython session available).
4 """
4 """
5 from __future__ import absolute_import
6
5
7 #-----------------------------------------------------------------------------
6 #-----------------------------------------------------------------------------
8 # Imports
7 # Imports
@@ -4,7 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function
8
7
9 import os
8 import os
10 import re
9 import re
@@ -15,7 +15,6 b' Authors'
15 * MinRK
15 * MinRK
16
16
17 """
17 """
18 from __future__ import absolute_import
19
18
20 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
21 # Imports
20 # Imports
@@ -4,7 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function
8
7
9 from io import UnsupportedOperation, BytesIO
8 from io import UnsupportedOperation, BytesIO
10
9
@@ -11,7 +11,6 b' and we do so in a common test_magic file.'
11 # Copyright (c) IPython Development Team.
11 # Copyright (c) IPython Development Team.
12 # Distributed under the terms of the Modified BSD License.
12 # Distributed under the terms of the Modified BSD License.
13
13
14 from __future__ import absolute_import
15
14
16
15
17 import functools
16 import functools
@@ -88,9 +88,6 b' Inheritance diagram:'
88 # the file COPYING, distributed as part of this software.
88 # the file COPYING, distributed as part of this software.
89 #*****************************************************************************
89 #*****************************************************************************
90
90
91 from __future__ import absolute_import
92 from __future__ import unicode_literals
93 from __future__ import print_function
94
91
95 import dis
92 import dis
96 import inspect
93 import inspect
@@ -87,7 +87,6 b' Some of the known remaining caveats are:'
87
87
88 - C extension modules cannot be reloaded, and so cannot be autoreloaded.
88 - C extension modules cannot be reloaded, and so cannot be autoreloaded.
89 """
89 """
90 from __future__ import print_function
91
90
92 skip_doctest = True
91 skip_doctest = True
93
92
@@ -9,7 +9,6 b' To automatically restore stored variables at startup, add this to your'
9
9
10 c.StoreMagics.autorestore = True
10 c.StoreMagics.autorestore = True
11 """
11 """
12 from __future__ import print_function
13
12
14 # Copyright (c) IPython Development Team.
13 # Copyright (c) IPython Development Team.
15 # Distributed under the terms of the Modified BSD License.
14 # Distributed under the terms of the Modified BSD License.
@@ -21,7 +21,6 b' separate implementation).'
21 An example notebook is provided in our documentation illustrating interactive
21 An example notebook is provided in our documentation illustrating interactive
22 use of the system.
22 use of the system.
23 """
23 """
24 from __future__ import print_function
25
24
26 #*****************************************************************************
25 #*****************************************************************************
27 # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu>
26 # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu>
@@ -25,7 +25,6 b' A reference to the original :func:`python:reload` is stored in this module as'
25 This code is almost entirely based on knee.py, which is a Python
25 This code is almost entirely based on knee.py, which is a Python
26 re-implementation of hierarchical module import.
26 re-implementation of hierarchical module import.
27 """
27 """
28 from __future__ import print_function
29 #*****************************************************************************
28 #*****************************************************************************
30 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
29 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
31 #
30 #
@@ -170,7 +170,6 b' The following is a very simple example of a valid demo file.'
170 ################### END EXAMPLE DEMO <ex_demo.py> ############################
170 ################### END EXAMPLE DEMO <ex_demo.py> ############################
171 """
171 """
172
172
173 from __future__ import unicode_literals
174
173
175 #*****************************************************************************
174 #*****************************************************************************
176 # Copyright (C) 2005-2006 Fernando Perez. <Fernando.Perez@colorado.edu>
175 # Copyright (C) 2005-2006 Fernando Perez. <Fernando.Perez@colorado.edu>
@@ -179,7 +178,6 b' from __future__ import unicode_literals'
179 # the file COPYING, distributed as part of this software.
178 # the file COPYING, distributed as part of this software.
180 #
179 #
181 #*****************************************************************************
180 #*****************************************************************************
182 from __future__ import print_function
183
181
184 import os
182 import os
185 import re
183 import re
@@ -4,7 +4,6 b' They should honor the line number argument, at least.'
4
4
5 Contributions are *very* welcome.
5 Contributions are *very* welcome.
6 """
6 """
7 from __future__ import print_function
8
7
9 import os
8 import os
10 import pipes
9 import pipes
@@ -2,7 +2,6 b''
2 """
2 """
3 GLUT Inputhook support functions
3 GLUT Inputhook support functions
4 """
4 """
5 from __future__ import print_function
6
5
7 #-----------------------------------------------------------------------------
6 #-----------------------------------------------------------------------------
8 # Copyright (C) 2008-2011 The IPython Development Team
7 # Copyright (C) 2008-2011 The IPython Development Team
@@ -77,7 +77,6 b' Inheritance diagram:'
77 Portions (c) 2009 by Robert Kern.
77 Portions (c) 2009 by Robert Kern.
78 :license: BSD License.
78 :license: BSD License.
79 """
79 """
80 from __future__ import print_function
81 from contextlib import contextmanager
80 from contextlib import contextmanager
82 import sys
81 import sys
83 import types
82 import types
@@ -11,7 +11,6 b''
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 from __future__ import print_function
15
14
16 # Stdlib imports
15 # Stdlib imports
17 import time
16 import time
@@ -12,7 +12,6 b''
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13 # Imports
13 # Imports
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15 from __future__ import print_function
16 from tempfile import NamedTemporaryFile, mkdtemp
15 from tempfile import NamedTemporaryFile, mkdtemp
17 from os.path import split, join as pjoin, dirname
16 from os.path import split, join as pjoin, dirname
18
17
@@ -4,7 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function
8
7
9 from collections import Counter, defaultdict, deque, OrderedDict
8 from collections import Counter, defaultdict, deque, OrderedDict
10 import types, string
9 import types, string
@@ -119,7 +119,6 b' Authors'
119 - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations.
119 - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations.
120 - Skipper Seabold, refactoring, cleanups, pure python addition
120 - Skipper Seabold, refactoring, cleanups, pure python addition
121 """
121 """
122 from __future__ import print_function
123
122
124 #-----------------------------------------------------------------------------
123 #-----------------------------------------------------------------------------
125 # Imports
124 # Imports
@@ -5,8 +5,6 b' An embedded IPython shell.'
5 # Copyright (c) IPython Development Team.
5 # Copyright (c) IPython Development Team.
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7
7
8 from __future__ import with_statement
9 from __future__ import print_function
10
8
11 import sys
9 import sys
12 import warnings
10 import warnings
@@ -1,5 +1,4 b''
1 """IPython terminal interface using prompt_toolkit"""
1 """IPython terminal interface using prompt_toolkit"""
2 from __future__ import print_function
3
2
4 import os
3 import os
5 import sys
4 import sys
@@ -8,8 +8,6 b' line :command:`ipython` program.'
8 # Copyright (c) IPython Development Team.
8 # Copyright (c) IPython Development Team.
9 # Distributed under the terms of the Modified BSD License.
9 # Distributed under the terms of the Modified BSD License.
10
10
11 from __future__ import absolute_import
12 from __future__ import print_function
13
11
14 import logging
12 import logging
15 import os
13 import os
@@ -3,7 +3,6 b''
3 # Copyright (c) IPython Development Team.
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
4 # Distributed under the terms of the Modified BSD License.
5
5
6 from __future__ import print_function
7
6
8 from logging import error
7 from logging import error
9 import os
8 import os
@@ -1,5 +1,4 b''
1 """Terminal input and output prompts."""
1 """Terminal input and output prompts."""
2 from __future__ import print_function
3
2
4 from pygments.token import Token
3 from pygments.token import Token
5 import sys
4 import sys
@@ -1,6 +1,5 b''
1 """GLUT Input hook for interactive use with prompt_toolkit
1 """GLUT Input hook for interactive use with prompt_toolkit
2 """
2 """
3 from __future__ import print_function
4
3
5
4
6 # GLUT is quite an old library and it is difficult to ensure proper
5 # GLUT is quite an old library and it is difficult to ensure proper
@@ -35,7 +35,6 b' PyGTK input hook for prompt_toolkit.'
35 Listens on the pipe prompt_toolkit sets up for a notification that it should
35 Listens on the pipe prompt_toolkit sets up for a notification that it should
36 return control to the terminal event loop.
36 return control to the terminal event loop.
37 """
37 """
38 from __future__ import absolute_import
39
38
40 import gtk, gobject
39 import gtk, gobject
41
40
@@ -1,6 +1,5 b''
1 """Enable pyglet to be used interacively with prompt_toolkit
1 """Enable pyglet to be used interacively with prompt_toolkit
2 """
2 """
3 from __future__ import absolute_import
4
3
5 import os
4 import os
6 import sys
5 import sys
@@ -1,6 +1,5 b''
1 """Enable wxPython to be used interacively in prompt_toolkit
1 """Enable wxPython to be used interacively in prompt_toolkit
2 """
2 """
3 from __future__ import absolute_import
4
3
5 import sys
4 import sys
6 import signal
5 import signal
@@ -24,7 +24,6 b' from IPython.testing.decorators import skip_win32'
24
24
25
25
26 _sample_embed = b"""
26 _sample_embed = b"""
27 from __future__ import print_function
28 import IPython
27 import IPython
29
28
30 a = 3
29 a = 3
@@ -74,7 +73,6 b' def test_nest_embed():'
74 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor'],
73 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor'],
75 env=env)
74 env=env)
76 child.expect(ipy_prompt)
75 child.expect(ipy_prompt)
77 child.sendline("from __future__ import print_function")
78 child.expect(ipy_prompt)
76 child.expect(ipy_prompt)
79 child.sendline("import IPython")
77 child.sendline("import IPython")
80 child.expect(ipy_prompt)
78 child.expect(ipy_prompt)
@@ -5,8 +5,6 b" modifications IPython makes to system behavior don't send the doctest machinery"
5 into a fit. This code should be considered a gross hack, but it gets the job
5 into a fit. This code should be considered a gross hack, but it gets the job
6 done.
6 done.
7 """
7 """
8 from __future__ import absolute_import
9 from __future__ import print_function
10
8
11 # Copyright (c) IPython Development Team.
9 # Copyright (c) IPython Development Team.
12 # Distributed under the terms of the Modified BSD License.
10 # Distributed under the terms of the Modified BSD License.
@@ -17,7 +17,6 b' itself from the command line. There are two ways of running this script:'
17 # Copyright (c) IPython Development Team.
17 # Copyright (c) IPython Development Team.
18 # Distributed under the terms of the Modified BSD License.
18 # Distributed under the terms of the Modified BSD License.
19
19
20 from __future__ import print_function
21
20
22 import glob
21 import glob
23 from io import BytesIO
22 from io import BytesIO
@@ -9,7 +9,6 b' test suite.'
9 # Copyright (c) IPython Development Team.
9 # Copyright (c) IPython Development Team.
10 # Distributed under the terms of the Modified BSD License.
10 # Distributed under the terms of the Modified BSD License.
11
11
12 from __future__ import print_function
13
12
14 import argparse
13 import argparse
15 import json
14 import json
@@ -22,7 +22,6 b' Authors'
22 - Fernando Perez <Fernando.Perez@berkeley.edu>
22 - Fernando Perez <Fernando.Perez@berkeley.edu>
23 """
23 """
24
24
25 from __future__ import absolute_import
26
25
27 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
28 # Copyright (C) 2009-2011 The IPython Development Team
27 # Copyright (C) 2009-2011 The IPython Development Team
@@ -3,7 +3,6 b''
3 This file just contains doctests both using plain python and IPython prompts.
3 This file just contains doctests both using plain python and IPython prompts.
4 All tests should be loaded by nose.
4 All tests should be loaded by nose.
5 """
5 """
6 from __future__ import print_function
7
6
8 def pyfunc():
7 def pyfunc():
9 """Some pure python tests...
8 """Some pure python tests...
@@ -1,7 +1,6 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Nose-based test runner.
2 """Nose-based test runner.
3 """
3 """
4 from __future__ import print_function
5
4
6 from nose.core import main
5 from nose.core import main
7 from nose.plugins.builtin import plugins
6 from nose.plugins.builtin import plugins
@@ -2,7 +2,6 b''
2
2
3 This is used by a companion test case.
3 This is used by a companion test case.
4 """
4 """
5 from __future__ import print_function
6
5
7 import gc
6 import gc
8
7
@@ -3,7 +3,6 b''
3 This file just contains doctests both using plain python and IPython prompts.
3 This file just contains doctests both using plain python and IPython prompts.
4 All tests should be loaded by nose.
4 All tests should be loaded by nose.
5 """
5 """
6 from __future__ import print_function
7
6
8 def pyfunc():
7 def pyfunc():
9 """Some pure python tests...
8 """Some pure python tests...
@@ -1,3 +1,2 b''
1 from __future__ import print_function
2 x = 1
1 x = 1
3 print('x is:',x)
2 print('x is:',x)
@@ -1,6 +1,5 b''
1 """Tests for the decorators we've created for IPython.
1 """Tests for the decorators we've created for IPython.
2 """
2 """
3 from __future__ import print_function
4
3
5 # Module imports
4 # Module imports
6 # Std lib
5 # Std lib
@@ -13,8 +13,6 b' Tests for testing.tools'
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 # Imports
14 # Imports
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16 from __future__ import with_statement
17 from __future__ import print_function
18
16
19 import os
17 import os
20 import unittest
18 import unittest
@@ -110,8 +108,7 b' class Test_ipexec_validate(unittest.TestCase, tt.TempFileMixin):'
110 def test_exception_path(self):
108 def test_exception_path(self):
111 """Test exception path in exception_validate.
109 """Test exception path in exception_validate.
112 """
110 """
113 self.mktmp("from __future__ import print_function\n"
111 self.mktmp("import sys\n"
114 "import sys\n"
115 "print('A')\n"
112 "print('A')\n"
116 "print('B')\n"
113 "print('B')\n"
117 "print('C', file=sys.stderr)\n"
114 "print('C', file=sys.stderr)\n"
@@ -123,8 +120,7 b' class Test_ipexec_validate(unittest.TestCase, tt.TempFileMixin):'
123 def test_exception_path2(self):
120 def test_exception_path2(self):
124 """Test exception path in exception_validate, expecting windows line endings.
121 """Test exception path in exception_validate, expecting windows line endings.
125 """
122 """
126 self.mktmp("from __future__ import print_function\n"
123 self.mktmp("import sys\n"
127 "import sys\n"
128 "print('A')\n"
124 "print('A')\n"
129 "print('B')\n"
125 "print('B')\n"
130 "print('C', file=sys.stderr)\n"
126 "print('C', file=sys.stderr)\n"
@@ -5,7 +5,6 b' Authors'
5 - Fernando Perez <Fernando.Perez@berkeley.edu>
5 - Fernando Perez <Fernando.Perez@berkeley.edu>
6 """
6 """
7
7
8 from __future__ import absolute_import
9
8
10 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
11 # Copyright (C) 2009 The IPython Development Team
10 # Copyright (C) 2009 The IPython Development Team
@@ -28,9 +28,6 b' It shows how to use the built-in keyword, token and tokenize modules to'
28 scan Python source code and re-emit it with no changes to its original
28 scan Python source code and re-emit it with no changes to its original
29 formatting (which is the hard part).
29 formatting (which is the hard part).
30 """
30 """
31 from __future__ import print_function
32 from __future__ import absolute_import
33 from __future__ import unicode_literals
34
31
35 __all__ = ['ANSICodeColors','Parser']
32 __all__ = ['ANSICodeColors','Parser']
36
33
@@ -13,7 +13,6 b' This file is only meant to be imported by process.py, not by end-users.'
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 # Imports
14 # Imports
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16 from __future__ import print_function
17
16
18 # Stdlib
17 # Stdlib
19 import errno
18 import errno
@@ -13,7 +13,6 b' This file is only meant to be imported by process.py, not by end-users.'
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 # Imports
14 # Imports
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16 from __future__ import print_function
17
16
18 # stdlib
17 # stdlib
19 import os
18 import os
@@ -10,7 +10,6 b' This file is meant to be used by process.py'
10 # the file COPYING, distributed as part of this software.
10 # the file COPYING, distributed as part of this software.
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12
12
13 from __future__ import print_function
14
13
15 # stdlib
14 # stdlib
16 import os, sys, threading
15 import os, sys, threading
@@ -16,7 +16,6 b' modified to be compatible with Python 2.7 and 3.2+.'
16 # the file COPYING, distributed as part of this software.
16 # the file COPYING, distributed as part of this software.
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18
18
19 from __future__ import absolute_import, division, print_function
20 import itertools
19 import itertools
21 import functools
20 import functools
22 import re
21 import re
@@ -4,7 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function, absolute_import
8
7
9 import sys
8 import sys
10
9
@@ -4,7 +4,6 b''
4 # Distributed under the terms of the BSD License. The full license is in
4 # Distributed under the terms of the BSD License. The full license is in
5 # the file COPYING, distributed as part of this software.
5 # the file COPYING, distributed as part of this software.
6 #*****************************************************************************
6 #*****************************************************************************
7 from __future__ import absolute_import
8
7
9 """
8 """
10 Color managing related utilities
9 Color managing related utilities
@@ -1,4 +1,3 b''
1 from __future__ import absolute_import
2
1
3 from warnings import warn
2 from warnings import warn
4
3
@@ -2,7 +2,6 b''
2 """
2 """
3 Utilities for working with stack frames.
3 Utilities for working with stack frames.
4 """
4 """
5 from __future__ import print_function
6
5
7 #-----------------------------------------------------------------------------
6 #-----------------------------------------------------------------------------
8 # Copyright (C) 2008-2011 The IPython Development Team
7 # Copyright (C) 2008-2011 The IPython Development Team
@@ -6,8 +6,6 b' IO related utilities.'
6 # Copyright (c) IPython Development Team.
6 # Copyright (c) IPython Development Team.
7 # Distributed under the terms of the Modified BSD License.
7 # Distributed under the terms of the Modified BSD License.
8
8
9 from __future__ import print_function
10 from __future__ import absolute_import
11
9
12
10
13 import atexit
11 import atexit
@@ -1,4 +1,3 b''
1 from __future__ import absolute_import
2
1
3 from warnings import warn
2 from warnings import warn
4
3
@@ -23,7 +23,6 b' path to module and not an open file object as well.'
23 #-----------------------------------------------------------------------------
23 #-----------------------------------------------------------------------------
24 # Imports
24 # Imports
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26 from __future__ import print_function
27
26
28 # Stdlib imports
27 # Stdlib imports
29 import imp
28 import imp
@@ -4,7 +4,6 b' as per PEP 263.'
4
4
5 Much of the code is taken from the tokenize module in Python 3.2.
5 Much of the code is taken from the tokenize module in Python 3.2.
6 """
6 """
7 from __future__ import absolute_import
8
7
9 import io
8 import io
10 from io import TextIOWrapper, BytesIO
9 from io import TextIOWrapper, BytesIO
@@ -6,7 +6,6 b' Utilities for working with external processes.'
6 # Copyright (c) IPython Development Team.
6 # Copyright (c) IPython Development Team.
7 # Distributed under the terms of the Modified BSD License.
7 # Distributed under the terms of the Modified BSD License.
8
8
9 from __future__ import print_function
10
9
11 import os
10 import os
12 import sys
11 import sys
@@ -2,7 +2,6 b''
2
2
3 This is copied from the stdlib and will be standard in Python 3.2 and onwards.
3 This is copied from the stdlib and will be standard in Python 3.2 and onwards.
4 """
4 """
5 from __future__ import print_function
6
5
7 import os as _os
6 import os as _os
8 import warnings as _warnings
7 import warnings as _warnings
@@ -12,7 +12,6 b''
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from __future__ import print_function
16
15
17 import sys
16 import sys
18
17
@@ -4,8 +4,6 b''
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7 from __future__ import print_function
8 from __future__ import absolute_import
9
7
10 import io as stdlib_io
8 import io as stdlib_io
11 import os.path
9 import os.path
@@ -12,7 +12,6 b''
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from __future__ import with_statement
16
15
17 import os
16 import os
18 import shutil
17 import shutil
@@ -93,8 +93,7 b' def test_arg_split_win32():'
93 class SubProcessTestCase(TestCase, tt.TempFileMixin):
93 class SubProcessTestCase(TestCase, tt.TempFileMixin):
94 def setUp(self):
94 def setUp(self):
95 """Make a valid python temp file."""
95 """Make a valid python temp file."""
96 lines = ["from __future__ import print_function",
96 lines = [ "import sys",
97 "import sys",
98 "print('on stdout', end='', file=sys.stdout)",
97 "print('on stdout', end='', file=sys.stdout)",
99 "print('on stderr', end='', file=sys.stderr)",
98 "print('on stderr', end='', file=sys.stderr)",
100 "sys.stdout.flush()",
99 "sys.stdout.flush()",
@@ -1,6 +1,5 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """Tests for IPython.utils.text"""
2 """Tests for IPython.utils.text"""
3 from __future__ import print_function
4
3
5 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
6 # Copyright (C) 2011 The IPython Development Team
5 # Copyright (C) 2011 The IPython Development Team
@@ -7,7 +7,6 b' Inheritance diagram:'
7 .. inheritance-diagram:: IPython.utils.text
7 .. inheritance-diagram:: IPython.utils.text
8 :parts: 3
8 :parts: 3
9 """
9 """
10 from __future__ import absolute_import
11
10
12 import os
11 import os
13 import re
12 import re
@@ -34,7 +34,6 b' that it produces COMMENT tokens for comments and gives type OP for all'
34 operators. Additionally, all token lists start with an ENCODING token
34 operators. Additionally, all token lists start with an ENCODING token
35 which tells you which encoding was used to decode the bytes stream.
35 which tells you which encoding was used to decode the bytes stream.
36 """
36 """
37 from __future__ import absolute_import
38
37
39 __author__ = 'Ka-Ping Yee <ping@lfw.org>'
38 __author__ = 'Ka-Ping Yee <ping@lfw.org>'
40 __credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
39 __credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
@@ -3,7 +3,6 b''
3 # Copyright (c) IPython Development Team.
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
4 # Distributed under the terms of the Modified BSD License.
5
5
6 from __future__ import absolute_import, print_function
7
6
8 from collections import namedtuple
7 from collections import namedtuple
9 from io import StringIO
8 from io import StringIO
@@ -1,4 +1,3 b''
1 from __future__ import absolute_import
2
1
3 from warnings import warn
2 from warnings import warn
4
3
@@ -17,7 +17,6 b' NOTE: this is a modified version of a script originally shipped with the'
17 PyMVPA project, which we've adapted for NIPY use. PyMVPA is an MIT-licensed
17 PyMVPA project, which we've adapted for NIPY use. PyMVPA is an MIT-licensed
18 project."""
18 project."""
19
19
20 from __future__ import print_function
21
20
22 # Stdlib imports
21 # Stdlib imports
23 import ast
22 import ast
@@ -8,7 +8,6 b' embedding which you can cut and paste in your code once you understand how'
8 things work.
8 things work.
9
9
10 The code in this file is deliberately extra-verbose, meant for learning."""
10 The code in this file is deliberately extra-verbose, meant for learning."""
11 from __future__ import print_function
12
11
13 # The basics to get you going:
12 # The basics to get you going:
14
13
@@ -8,7 +8,6 b' resuming execution later.'
8
8
9 This is a unicode test, åäö
9 This is a unicode test, åäö
10 """
10 """
11 from __future__ import print_function
12
11
13 print('Hello, welcome to an interactive IPython demo.')
12 print('Hello, welcome to an interactive IPython demo.')
14 print('Executing this block should require confirmation before proceeding,')
13 print('Executing this block should require confirmation before proceeding,')
@@ -5,7 +5,6 b' http://docs.python.org/2/distutils/builtdist.html#the-postinstallation-script'
5
5
6 """
6 """
7
7
8 from __future__ import print_function
9
8
10 import os
9 import os
11 import sys
10 import sys
@@ -20,7 +20,6 b' requires utilities which are not available under Windows."""'
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 # Minimal Python version sanity check
21 # Minimal Python version sanity check
22 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
23 from __future__ import print_function
24
23
25 import sys
24 import sys
26
25
@@ -12,7 +12,6 b' This includes:'
12 # Copyright (c) IPython Development Team.
12 # Copyright (c) IPython Development Team.
13 # Distributed under the terms of the Modified BSD License.
13 # Distributed under the terms of the Modified BSD License.
14
14
15 from __future__ import print_function
16
15
17 import re
16 import re
18 import os
17 import os
@@ -26,7 +26,6 b' of that repo.'
26
26
27 """
27 """
28
28
29 from __future__ import print_function
30
29
31 import os
30 import os
32 import re
31 import re
@@ -8,7 +8,6 b' Usage:'
8 It prints summaries and if chosen, line-by-line info of where \\t or \\r
8 It prints summaries and if chosen, line-by-line info of where \\t or \\r
9 characters can be found in our source tree.
9 characters can be found in our source tree.
10 """
10 """
11 from __future__ import print_function
12
11
13 # Config
12 # Config
14 # If true, all lines that have tabs are printed, with line number
13 # If true, all lines that have tabs are printed, with line number
@@ -9,7 +9,6 b''
9 #
9 #
10 # The original mapping of latex symbols to unicode comes from the `latex_symbols.jl` files from Julia.
10 # The original mapping of latex symbols to unicode comes from the `latex_symbols.jl` files from Julia.
11
11
12 from __future__ import print_function
13 import os, sys
12 import os, sys
14
13
15 if not sys.version_info[0] == 3:
14 if not sys.version_info[0] == 3:
@@ -1,5 +1,4 b''
1 """Functions for Github API requests."""
1 """Functions for Github API requests."""
2 from __future__ import print_function
3
2
4 try:
3 try:
5 input = raw_input
4 input = raw_input
@@ -7,7 +7,6 b' Usage:'
7 Type `git mpr -h` for details.
7 Type `git mpr -h` for details.
8 """
8 """
9
9
10 from __future__ import print_function
11
10
12 import io, os
11 import io, os
13 import argparse
12 import argparse
@@ -9,7 +9,6 b' To generate a report for IPython 2.0, run:'
9 # Imports
9 # Imports
10 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
11
11
12 from __future__ import print_function
13
12
14 import codecs
13 import codecs
15 import sys
14 import sys
@@ -7,7 +7,6 b' Python, and posts the results to Gist if any tests fail.'
7 Usage:
7 Usage:
8 python test_pr.py 1657
8 python test_pr.py 1657
9 """
9 """
10 from __future__ import print_function
11
10
12 import errno
11 import errno
13 from glob import glob
12 from glob import glob
@@ -1,5 +1,4 b''
1 """This tests that future compiler flags are passed to the embedded IPython."""
1 """This tests that future compiler flags are passed to the embedded IPython."""
2 from __future__ import division
3 from IPython import embed
2 from IPython import embed
4 embed(banner1='', header='check 1/2 == 0.5 in Python 2')
3 embed(banner1='', header='check 1/2 == 0.5 in Python 2')
5 embed(banner1='', header='check 1/2 = 0 in Python 2', compile_flags=0)
4 embed(banner1='', header='check 1/2 = 0 in Python 2', compile_flags=0)
@@ -1,6 +1,5 b''
1 """Various utilities common to IPython release and maintenance tools.
1 """Various utilities common to IPython release and maintenance tools.
2 """
2 """
3 from __future__ import print_function
4
3
5 # Library imports
4 # Library imports
6 import os
5 import os
General Comments 0
You need to be logged in to leave comments. Login now