Skip to content

Commit 66bf05b

Browse files
dduanshahmishal
authored andcommitted
[NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now, where the 3 specific things are all included [since Python 3.0](https://docs.python.org/3/library/__future__.html): * absolute_import * print_function * unicode_literals * division These import statements are no-ops and are no longer necessary. (cherry picked from commit 3dfc408)
1 parent 609c50a commit 66bf05b

File tree

171 files changed

+104
-347
lines changed

Some content is hidden

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

171 files changed

+104
-347
lines changed

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- Benchmark_DTrace.in ---------------------------------------------===//
44
#

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# ===--- Benchmark_Driver ------------------------------------------------===//

benchmark/scripts/Benchmark_GuardMalloc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- Benchmark_GuardMalloc.in ----------------------------------------===//
44
#

benchmark/scripts/Benchmark_QuickCheck.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- Benchmark_QuickCheck.in -----------------------------------------===//
44
#

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- Benchmark_RuntimeLeaksRunner.in ---------------------------------===//
44
#

benchmark/scripts/build_linux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import argparse
44
import os

benchmark/scripts/build_script_helper.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
3-
from __future__ import print_function
1+
#!/usr/bin/env python3
42

53
import argparse
64
import os

benchmark/scripts/compare_perf_tests.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# ===--- compare_perf_tests.py -------------------------------------------===//
@@ -27,8 +27,6 @@ class `ReportFormatter` creates the test comparison report in specified format.
2727
2828
"""
2929

30-
from __future__ import print_function
31-
3230
import argparse
3331
import functools
3432
import re

benchmark/scripts/create_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import argparse
44
import os

benchmark/scripts/generate_harness/generate_harness.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- generate_harness.py ---------------------------------------------===//
44
#
@@ -14,8 +14,6 @@
1414

1515
# Generate boilerplate, CMakeLists.txt and utils/main.swift from templates.
1616

17-
from __future__ import print_function
18-
1917
import argparse
2018
import os
2119
import subprocess

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- perf_test_driver.py ---------------------------------------------===//
44
#
@@ -12,8 +12,6 @@
1212
#
1313
# ===---------------------------------------------------------------------===//
1414

15-
from __future__ import print_function
16-
1715
import functools
1816
import glob
1917
import multiprocessing

benchmark/scripts/run_smoke_bench

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# ===--- run_smoke_bench -------------------------------------------------===//
@@ -21,8 +21,6 @@
2121
#
2222
# ===---------------------------------------------------------------------===//
2323

24-
from __future__ import print_function
25-
2624
import argparse
2725
import glob
2826
import os

benchmark/scripts/test_Benchmark_Driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# ===--- test_Benchmark_Driver.py ----------------------------------------===//

benchmark/scripts/test_compare_perf_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# ===--- test_compare_perf_tests.py --------------------------------------===//

benchmark/scripts/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
# ===--- test_utils.py ---------------------------------------------------===//

benchmark/utils/convertToJSON.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# ===--- convertToJSON.py ------------------------------------------------===//
44
#
@@ -57,8 +57,6 @@
5757
# ]
5858
# }
5959

60-
from __future__ import print_function
61-
6260
import json
6361
import re
6462
import sys

docs/scripts/ns-html2rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
from __future__ import print_function
3-
1+
#!/usr/bin/env python3
42
import re
53
import subprocess
64
import sys

stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import SwiftShims
1414

1515
%{
16-
from __future__ import division
1716
from SwiftIntTypes import all_integer_types
1817
from SwiftFloatingPointTypes import all_floating_point_types
1918

stdlib/public/core/IntegerTypes.swift.gyb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# Utility code for later in this template
1515
#
1616

17-
from __future__ import division
1817
from SwiftIntTypes import all_integer_types, int_max_bits, should_define_truncating_bit_pattern_init
1918
from SwiftFloatingPointTypes import getFtoIBounds
2019

stdlib/public/core/SIMDConcreteOperations.swift.gyb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
%{
14-
from __future__ import division
1514
from SwiftIntTypes import all_integer_types
1615
word_bits = int(CMAKE_SIZEOF_VOID_P) * 8
1716
storagescalarCounts = [2,4,8,16,32,64]

stdlib/public/core/SIMDVectorTypes.swift.gyb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
%{
14-
from __future__ import division
1514
from SwiftIntTypes import all_integer_types
1615
word_bits = int(CMAKE_SIZEOF_VOID_P) * 8
1716
storagescalarCounts = [2,4,8,16,32,64]

test/CrossImport/Inputs/rewrite-module-triples.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Renames files or directories with "module-triple-here" in their names to use
44
the indicated module triples instead.
55
"""
66

7-
from __future__ import print_function
8-
97
import os
108
import platform
119
import shutil

test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# fake-build-for-bitcode.py - Fake build with -embed-bitcode -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project
@@ -16,8 +16,6 @@
1616
#
1717
# ----------------------------------------------------------------------------
1818

19-
from __future__ import print_function
20-
2119
import os
2220
import sys
2321

test/Driver/Dependencies/Inputs/fake-build-whole-module.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# fake-build-for-whole-module.py - Optimized fake build -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project
@@ -15,8 +15,6 @@
1515
#
1616
# ----------------------------------------------------------------------------
1717

18-
from __future__ import print_function
19-
2018
import os
2119
import sys
2220

test/Driver/Dependencies/Inputs/modify-non-primary-files.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# modify-non-primary-files.py - Fake build while modifying files -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project
@@ -16,8 +16,6 @@
1616
#
1717
# ----------------------------------------------------------------------------
1818

19-
from __future__ import print_function
20-
2119
import os
2220
import sys
2321

test/Driver/Dependencies/Inputs/touch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# touch.py - /bin/touch that writes the LLVM epoch -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project

test/Driver/Dependencies/Inputs/update-dependencies-bad.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# update-dependencies-bad.py - Fails on bad.swift -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project
@@ -17,8 +17,6 @@
1717
#
1818
# ----------------------------------------------------------------------------
1919

20-
from __future__ import print_function
21-
2220
import os
2321
import shutil
2422
import signal

test/Driver/Dependencies/Inputs/update-dependencies.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# update-dependencies.py - Fake build for dependency analysis -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project
@@ -27,8 +27,6 @@
2727
#
2828
# ----------------------------------------------------------------------------
2929

30-
from __future__ import print_function
31-
3230
import os
3331
import shutil
3432
import subprocess

test/Driver/Inputs/crash-after-generating-pch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# crash.py - Sends SIGKILL to self. -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project

test/Driver/Inputs/crash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# crash.py - Sends SIGKILL to self. -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project

test/Driver/Inputs/fail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# fail.py - Just exits with an error code -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project

test/Driver/Inputs/fake-toolchain/clang

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# clang++ - Fake Clang to test finding clang++ in the toolchain path
33
#
44
# This source file is part of the Swift.org open source project
@@ -11,6 +11,4 @@
1111
#
1212
# ----------------------------------------------------------------------------
1313

14-
from __future__ import print_function
15-
1614
print("Sorry, I'm lazy-clang")

test/Driver/Inputs/fake-toolchain/ld

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# ld - Fake ld to test finding the Darwin linker in the toolchain path
33
#
44
# This source file is part of the Swift.org open source project
@@ -11,6 +11,4 @@
1111
#
1212
# ----------------------------------------------------------------------------
1313

14-
from __future__ import print_function
15-
1614
print("Sorry, wrong number!")

test/Driver/Inputs/filelists/check-filelist-abc.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# check-filelist-abc.py - Fake build to test driver-produced -filelists.
33
#
44
# This source file is part of the Swift.org open source project
@@ -11,8 +11,6 @@
1111
#
1212
# ----------------------------------------------------------------------------
1313

14-
from __future__ import print_function
15-
1614
import os
1715
import sys
1816

test/Driver/Inputs/filelists/fake-ld.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# fake-ld.py - Fake Darwin linker to test driver-produced -filelists.
33
#
44
# This source file is part of the Swift.org open source project
@@ -11,8 +11,6 @@
1111
#
1212
# ----------------------------------------------------------------------------
1313

14-
from __future__ import print_function
15-
1614
import sys
1715

1816
filelistFile = sys.argv[sys.argv.index('-filelist') + 1]

test/Incremental/Verifier/gen-output-file-map.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
3-
from __future__ import print_function
1+
#!/usr/bin/env python3
42

53
import argparse
64
import io

test/Inputs/getmtime.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
3-
from __future__ import print_function
1+
#!/usr/bin/env python3
42

53
import os
64
import sys

test/Inputs/symlink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
import os
33
import subprocess
44
import sys

test/Inputs/timeout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/uar/bin/env python
1+
#!/uar/bin/env python3
22

33
import subprocess
44
import sys

test/Misc/you-should-be-using-LLVM_DEBUG.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python
1+
#! /usr/bin/env python3
22
# -*- python -*-
33
# RUN: %{python} %s '%swift_src_root'
44

test/ModuleInterface/ModuleCache/Inputs/check-is-new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# check-is-new.py - a more-legible way to read a timestamp test than test(1)
44
#

test/ModuleInterface/ModuleCache/Inputs/check-is-old.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# check-is-old.py - a more-legible way to read a timestamp test than test(1)
44
#

0 commit comments

Comments
 (0)