Skip to content

Commit a4b7a48

Browse files
sashkombr0wn
authored andcommitted
python: Remove unnecessary 'from __future__ import'
All of the removed `from __future__ import` were needed in older versions of Python (mostly 2.5.x and below) but later became mandatory in most versions of Python 3 hence are not necessary anymore. More specifically, according to __future__.py[1]: - unicode_literals is part of Python since versions 2.6.0 and 3.0.0; - print_function is part of Python since versions 2.6.0 and 3.0.0; - absolute_import is part of Python since versions 2.5.0 and 3.0.0; - division is part of Python since versions 2.2.0 and 3.0.0; Get rid of those unnecessary imports to slightly clean up the codebase. [1] https://github.com/python/cpython/blob/master/Lib/__future__.py
1 parent f25a971 commit a4b7a48

File tree

450 files changed

+1
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

450 files changed

+1
-832
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ ENDIF()
340340

341341
execute_process(
342342
COMMAND "${PYTHON_EXECUTABLE}" -c
343-
"from __future__ import print_function\ntry:\n import numpy\n import os\n inc_path = numpy.get_include()\n if os.path.exists(os.path.join(inc_path, 'numpy', 'arrayobject.h')):\n print(inc_path, end='')\nexcept:\n pass"
343+
"try:\n import numpy\n import os\n inc_path = numpy.get_include()\n if os.path.exists(os.path.join(inc_path, 'numpy', 'arrayobject.h')):\n print(inc_path, end='')\nexcept:\n pass"
344344
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR)
345345

346346
include(GrComponent)

docs/doxygen/doxyxml/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
u'Outputs the vital aadvark statistics.'
5252
5353
"""
54-
from __future__ import unicode_literals
5554

5655
from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
5756

docs/doxygen/doxyxml/base.py

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
to the doxygen xml docs than the generated classes provide.
1414
"""
1515

16-
from __future__ import print_function
17-
from __future__ import unicode_literals
1816

1917
import os
2018
import pdb

docs/doxygen/doxyxml/doxyindex.py

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
Classes providing more user-friendly interfaces to the doxygen xml
1111
docs than the generated classes provide.
1212
"""
13-
from __future__ import unicode_literals
1413

1514
import os
1615

docs/doxygen/doxyxml/generated/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
resultant classes are not very friendly to navigate so the rest of the
66
doxyxml module processes them further.
77
"""
8-
from __future__ import unicode_literals

docs/doxygen/doxyxml/generated/compound.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
55
"""
6-
from __future__ import unicode_literals
76

87

98
from xml.dom import minidom

docs/doxygen/doxyxml/generated/compoundsuper.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
55
#
66

7-
from __future__ import print_function
8-
from __future__ import unicode_literals
97

108
import sys
119

docs/doxygen/doxyxml/generated/index.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
55
"""
6-
from __future__ import unicode_literals
76

87
from xml.dom import minidom
98

docs/doxygen/doxyxml/generated/indexsuper.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
55
#
66

7-
from __future__ import print_function
8-
from __future__ import unicode_literals
97

108
import sys
119

docs/doxygen/doxyxml/text.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"""
1010
Utilities for extracting text from generated classes.
1111
"""
12-
from __future__ import unicode_literals
1312

1413
def is_string(txt):
1514
if isinstance(txt, str):

docs/doxygen/other/doxypy.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python
22

3-
from __future__ import print_function
4-
from __future__ import unicode_literals
53

64
__applicationName__ = "doxypy"
75
__blurb__ = """

docs/doxygen/update_pydoc.py

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
python docstrings.
1616
1717
"""
18-
from __future__ import unicode_literals
1918

2019
import os, sys, time, glob, re, json
2120
from argparse import ArgumentParser

gnuradio-runtime/apps/evaluation_random_numbers.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
12-
from __future__ import division
13-
from __future__ import unicode_literals
1411
from gnuradio import gr
1512
import numpy as np
1613
from scipy.stats import norm, laplace, rayleigh

gnuradio-runtime/examples/mp-sched/affinity_set.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Title: Affinity Set Test
55
##################################################
66

7-
from __future__ import print_function
8-
from __future__ import unicode_literals
97
from gnuradio import eng_notation
108
from gnuradio import gr
119
from gnuradio import blocks

gnuradio-runtime/examples/mp-sched/plot_flops.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
Reads output from run_synthetic.py and runs gnuplot showing
1313
GFLOPS as f(npipes, nstages)
1414
"""
15-
from __future__ import unicode_literals
1615

1716
import re
1817
import sys

gnuradio-runtime/examples/mp-sched/run_synthetic.py

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
"""
1212
Run synthetic.py for npipes in [1,16], nstages in [1,16]
1313
"""
14-
from __future__ import division
15-
from __future__ import unicode_literals
1614

1715
import re
1816
import sys

gnuradio-runtime/examples/mp-sched/synthetic.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
12-
from __future__ import division
13-
from __future__ import unicode_literals
1411
from gnuradio import gr, eng_notation
1512
from gnuradio import blocks, filter
1613
from gnuradio.eng_arg import eng_float, intx

gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#
99
#
1010

11-
from __future__ import division
12-
from __future__ import unicode_literals
1311
from gnuradio import gr, gru, eng_notation, filter
1412
from gnuradio import audio
1513
from gnuradio import analog

gnuradio-runtime/examples/network/audio_sink.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from gnuradio import gr
1312
from gnuradio import blocks
1413
from argparse import ArgumentParser

gnuradio-runtime/examples/network/audio_source.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from gnuradio import gr
1312
from gnuradio import blocks
1413
from argparse import ArgumentParser

gnuradio-runtime/examples/network/dial_tone_sink.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from gnuradio import gr, audio
1312
from gnuradio import blocks
1413
from argparse import ArgumentParser

gnuradio-runtime/examples/network/dial_tone_source.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from gnuradio import gr
1312
from argparse import ArgumentParser
1413
import sys

gnuradio-runtime/examples/network/vector_sink.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from gnuradio import gr
1312
from gnuradio import blocks
1413
from gnuradio.eng_arg import eng_float, intx

gnuradio-runtime/examples/network/vector_source.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from gnuradio import gr
1312
from gnuradio import blocks
1413
from argparse import ArgumentParser

gnuradio-runtime/examples/volk_benchmark/volk_math.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python
22

3-
from __future__ import print_function
4-
from __future__ import unicode_literals
53
from gnuradio import gr
64
from gnuradio import blocks
75
import argparse

gnuradio-runtime/examples/volk_benchmark/volk_plot.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python
22

3-
from __future__ import division
4-
from __future__ import unicode_literals
53
import sys, math
64
import argparse
75
from volk_test_funcs import (create_connection, list_tables, get_results,

gnuradio-runtime/examples/volk_benchmark/volk_test_funcs.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python
22

3-
from __future__ import print_function
4-
from __future__ import unicode_literals
53
from gnuradio import gr
64
from gnuradio import blocks
75
import math, sys, os, time

gnuradio-runtime/examples/volk_benchmark/volk_types.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python
22

3-
from __future__ import print_function
4-
from __future__ import unicode_literals
53
from gnuradio import gr
64
from gnuradio import blocks
75
import argparse

gnuradio-runtime/lib/math/gen_sine_table.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
import math
1312
import sys
1413

gnuradio-runtime/python/gnuradio/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
GNU Radio is licensed under the GNU General Public License (GPL) version 3. All of the code is copyright of the Free Software Foundation.
99
"""
10-
from __future__ import unicode_literals
1110

1211
# This file makes gnuradio a package
1312
# The docstring will be associated with the top level of the package.

gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
is currently the only supported transport.
1717
1818
"""
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
2119

2220
from gnuradio.ctrlport.RPCConnection import RPCMethods
2321
try:

gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
12-
from __future__ import unicode_literals
1311

1412
from gnuradio import gr
1513
from gnuradio import blocks

gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
options: result of command argument parsing (optparse.Values)
1717
"""
1818

19-
from __future__ import unicode_literals
2019

2120
RPCMethods = {'thrift': 'Apache Thrift',
2221
#'ice': 'Zeroc ICE'

gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import unicode_literals
1211
from thrift import Thrift
1312
from thrift.transport import TSocket
1413
from thrift.transport import TTransport

gnuradio-runtime/python/gnuradio/ctrlport/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
from __future__ import unicode_literals
31
#
42
# Copyright 2012 Free Software Foundation, Inc.
53
#

gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
12-
1311
from argparse import ArgumentParser
1412

1513
import sys, time, re, signal

gnuradio-runtime/python/gnuradio/ctrlport/monitor.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
12-
from __future__ import unicode_literals
1311

1412
import sys, subprocess, re, signal, time, atexit, os
1513
from gnuradio import gr

gnuradio-runtime/python/gnuradio/eng_arg.py

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
'''
1111
Add support for engineering notation to argparse.ArgumentParser
1212
'''
13-
from __future__ import unicode_literals
1413

1514
import argparse
1615
from gnuradio import eng_notation

gnuradio-runtime/python/gnuradio/eng_notation.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"""
1010
Display numbers as strings using engineering notation.
1111
"""
12-
from __future__ import unicode_literals
1312

1413
import six
1514

gnuradio-runtime/python/gnuradio/eng_option.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#
99

1010
'''Add support for engineering notation to optparse.OptionParser'''
11-
from __future__ import absolute_import
12-
from __future__ import unicode_literals
1311

1412
from copy import copy
1513
from optparse import Option, OptionValueError

gnuradio-runtime/python/gnuradio/gr/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
"""
1313
Core contents.
1414
"""
15-
from __future__ import absolute_import
16-
from __future__ import unicode_literals
1715

1816
# This is the main GNU Radio python module.
1917
# We pull the pybind output and the other modules into the gnuradio.gr namespace

gnuradio-runtime/python/gnuradio/gr/exceptions.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import unicode_literals
21
#
32
# Copyright 2004 Free Software Foundation, Inc.
43
#

gnuradio-runtime/python/gnuradio/gr/gateway.py

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#
88
#
99

10-
from __future__ import print_function
11-
from __future__ import unicode_literals
1210

1311

1412
import numpy

gnuradio-runtime/python/gnuradio/gr/hier_block2.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import unicode_literals
21
#
32
# Copyright 2006,2007,2014 Free Software Foundation, Inc.
43
#

gnuradio-runtime/python/gnuradio/gr/packet_utils.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
12-
from __future__ import division
13-
from __future__ import unicode_literals
1411
from gnuradio import gr
1512
import pmt
1613

gnuradio-runtime/python/gnuradio/gr/pubsub.py

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
This is a proof of concept implementation, will likely change significantly.
1515
"""
1616

17-
from __future__ import print_function
18-
from __future__ import unicode_literals
1917

2018
class pubsub(dict):
2119
def __init__(self):

gnuradio-runtime/python/gnuradio/gr/qa_prefs.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
1211

1312

1413
from gnuradio import gr, gr_unittest

gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
#
1010

11-
from __future__ import print_function
1211

1312

1413
from gnuradio import gr, gr_unittest

gnuradio-runtime/python/gnuradio/gr/tag_utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import unicode_literals
21
import pmt
32

43
from . import gr_python as gr

0 commit comments

Comments
 (0)