Skip to content

Commit

Permalink
MAINT: Remove unnecessary 'from __future__ import ...' statements
Browse files Browse the repository at this point in the history
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
  • Loading branch information
jdufresne committed Jan 3, 2020
1 parent f30b256 commit ed1e965
Show file tree
Hide file tree
Showing 385 changed files with 3 additions and 765 deletions.
4 changes: 2 additions & 2 deletions azure-steps-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
- script: python -m pip install -r test_requirements.txt
displayName: 'Install dependencies; some are optional to avoid test skips'
- powershell: |
$pyversion = python -c "from __future__ import print_function; import sys; print(sys.version.split()[0])"
$pyversion = python -c "import sys; print(sys.version.split()[0])"
Write-Host "Python Version: $pyversion"
$target = "C:\\hostedtoolcache\\windows\\Python\\$pyversion\\$(PYTHON_ARCH)\\lib\\openblas$env:OPENBLAS_SUFFIX.a"
Write-Host "target path: $target"
Expand Down Expand Up @@ -53,4 +53,4 @@ steps:
inputs:
testResultsFiles: '**/test-*.xml'
failTaskOnFailedTests: true
testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows'
testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows'
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from __future__ import absolute_import, division, print_function

from . import common
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/benchmarks/bench_avx.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down Expand Up @@ -31,4 +29,3 @@ def setup(self, ufuncname, stride, dtype):

def time_ufunc(self, ufuncname, stride, dtype):
self.f(self.arr[::stride])

2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_function_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_import.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from subprocess import call
from sys import executable
from timeit import default_timer
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_indexing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark, get_squares_, get_indexes_, get_indexes_rand_

from os.path import join as pjoin
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark, get_squares

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_lib.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Benchmarks for `numpy.lib`."""


from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_linalg.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark, get_squares_, get_indexes_rand, TYPES1

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_ma.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_overrides.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

try:
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_random.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmarks/bench_records.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, division, print_function
import os

from .common import Benchmark
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_reduce.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark, TYPES1, get_squares

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_shape_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/bench_ufunc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

from .common import Benchmark, get_squares_

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/benchmarks/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

import numpy
import random

Expand Down
3 changes: 0 additions & 3 deletions doc/DISTUTILS.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,6 @@ The header of a typical SciPy ``__init__.py`` is::
Package docstring, typically with a brief description and function listing.
"""

# py3k related imports
from __future__ import division, print_function, absolute_import

# import functions into module namespace
from .subpackage import *
...
Expand Down
2 changes: 0 additions & 2 deletions doc/cdoc/numpyfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
Also, add Doxygen /** and /**< syntax automatically where appropriate.
"""
from __future__ import division, absolute_import, print_function

import sys
import re
import os
Expand Down
2 changes: 0 additions & 2 deletions doc/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
a line by itself, preferably preceded by a blank line.
"""
from __future__ import division, absolute_import, print_function

import os # standard library imports first

# Do NOT import using *, e.g. from numpy import *
Expand Down
2 changes: 0 additions & 2 deletions doc/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
MODE is either 'html' or 'tex'.
"""
from __future__ import division, absolute_import, print_function

import re
import optparse
import io
Expand Down
2 changes: 0 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function

import sys, os, re

# Minimum version, enforced by sphinx
Expand Down
2 changes: 0 additions & 2 deletions doc/source/f2py/setup_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, absolute_import, print_function

from numpy.distutils.core import Extension

ext1 = Extension(name = 'scalar',
Expand Down
4 changes: 0 additions & 4 deletions doc/source/reference/arrays.ndarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,6 @@ Arithmetic:
- Any third argument to :func:`pow()` is silently ignored,
as the underlying :func:`ufunc <power>` takes only two arguments.

- The three division operators are all defined; :obj:`div` is active
by default, :obj:`truediv` is active when
:obj:`__future__` division is in effect.

- Because :class:`ndarray` is a built-in type (written in C), the
``__r{op}__`` special methods are not directly defined.

Expand Down
2 changes: 0 additions & 2 deletions doc/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Show a summary about which NumPy functions are documented and which are not.
"""
from __future__ import division, absolute_import, print_function

import os, glob, re, sys, inspect, optparse
try:
# Accessing collections abstract classes from collections
Expand Down
2 changes: 0 additions & 2 deletions numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@
Exceptions to this rule are documented.
"""
from __future__ import division, absolute_import, print_function

import sys
import warnings

Expand Down
1 change: 0 additions & 1 deletion numpy/_build_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from __future__ import division, absolute_import, print_function
2 changes: 0 additions & 2 deletions numpy/_build_utils/apple_accelerate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, absolute_import, print_function

import os
import sys
import re
Expand Down
2 changes: 0 additions & 2 deletions numpy/_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def foo(arg=np._NoValue):
motivated this module.
"""
from __future__ import division, absolute_import, print_function

__ALL__ = [
'ModuleDeprecationWarning', 'VisibleDeprecationWarning', '_NoValue'
]
Expand Down
2 changes: 0 additions & 2 deletions numpy/_pytesttester.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
simplify circular import issues. For the same reason, it contains no numpy
imports at module scope, instead importing numpy within function calls.
"""
from __future__ import division, absolute_import, print_function

import sys
import os

Expand Down
2 changes: 0 additions & 2 deletions numpy/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* we may only need a small subset of the copied library/module
"""
from __future__ import division, absolute_import, print_function

from . import _inspect
from . import py3k
from ._inspect import getargspec, formatargspec
Expand Down
2 changes: 0 additions & 2 deletions numpy/compat/_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
no overhead.
"""
from __future__ import division, absolute_import, print_function

import types

__all__ = ['getargspec', 'formatargspec']
Expand Down
2 changes: 0 additions & 2 deletions numpy/compat/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration

Expand Down
2 changes: 0 additions & 2 deletions numpy/compat/tests/test_compat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, absolute_import, print_function

from os.path import join

from numpy.compat import isfileobj
Expand Down
2 changes: 0 additions & 2 deletions numpy/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Pytest configuration and fixtures for the Numpy test suite.
"""
from __future__ import division, absolute_import, print_function

import os

import pytest
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"""

from __future__ import division, absolute_import, print_function

from numpy.version import version as __version__

import os
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/_add_newdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
core/fromnumeric.py, core/defmatrix.py up-to-date.
"""
from __future__ import division, absolute_import, print_function

import sys

from numpy.core import numerictypes as _numerictypes
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/_asarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
`require` fits this category despite its name not matching this pattern.
"""
from __future__ import division, absolute_import, print_function

from .overrides import set_module
from .multiarray import array

Expand Down
2 changes: 0 additions & 2 deletions numpy/core/_dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
String handling is much easier to do correctly in python.
"""
from __future__ import division, absolute_import, print_function

import sys

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
Some things are more easily handled Python.
"""
from __future__ import division, absolute_import, print_function

import re
import sys
import platform
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
and the Python code for the NumPy-namespace function
"""
from __future__ import division, absolute_import, print_function

import warnings

from numpy.core import multiarray as mu
Expand Down
4 changes: 0 additions & 4 deletions numpy/core/_ufunc_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
This provides helpers which wrap `umath.geterrobj` and `umath.seterrobj`
"""
from __future__ import division, absolute_import, print_function

try:
# Accessing collections abstract classes from collections
# has been deprecated since Python 3.3
Expand Down Expand Up @@ -431,8 +429,6 @@ class errstate(contextlib.ContextDecorator):
OrderedDict([('divide', 'ignore'), ('invalid', 'ignore'), ('over', 'ignore'), ('under', 'ignore')])
"""
# Note that we don't want to run the above doctests because they will fail
# without a from __future__ import with_statement

def __init__(self, **kwargs):
self.call = kwargs.pop('call', _Unspecified)
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/arrayprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
$Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $
"""
from __future__ import division, absolute_import, print_function

__all__ = ["array2string", "array_str", "array_repr", "set_string_function",
"set_printoptions", "get_printoptions", "printoptions",
"format_float_positional", "format_float_scientific"]
Expand Down
1 change: 0 additions & 1 deletion numpy/core/code_generators/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from __future__ import division, absolute_import, print_function
2 changes: 0 additions & 2 deletions numpy/core/code_generators/genapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
specified.
"""
from __future__ import division, absolute_import, print_function

from numpy.distutils.conv_template import process_file as process_c_file

import sys, os, re
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/code_generators/generate_numpy_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import os
import genapi

Expand Down
2 changes: 0 additions & 2 deletions numpy/core/code_generators/generate_ufunc_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import os
import genapi

Expand Down
2 changes: 0 additions & 2 deletions numpy/core/code_generators/generate_umath.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import os
import re
import struct
Expand Down
2 changes: 0 additions & 2 deletions numpy/core/code_generators/numpy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
exception, so it should hopefully not get unnoticed).
"""
from __future__ import division, absolute_import, print_function

from code_generators.genapi import StealRef, NonNull

# index, type
Expand Down
Loading

0 comments on commit ed1e965

Please sign in to comment.