Parcourir la source

Remove __future__ imports

All __future__ imports (unicode_literals, print_function) are already
mandatory in py3. Also remove an outdated py2 comment in
presubmit_canned_checks.py

Bug: 1475402
Change-Id: I27cf6a8268f6dd1081f22af782c4c29a975376ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4867135
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Gavin Mak il y a 1 an
Parent
commit
f936d540e1

+ 0 - 2
auth.py

@@ -3,8 +3,6 @@
 # found in the LICENSE file.
 """Google OAuth2 related functions."""
 
-from __future__ import print_function
-
 import collections
 import datetime
 import functools

+ 0 - 2
clang_format.py

@@ -8,8 +8,6 @@ clang-format binaries are pulled down from Google Cloud Storage whenever you
 sync Chrome, to platform-specific locations. This script knows how to locate
 those tools, assuming the script is invoked from inside a Chromium checkout."""
 
-from __future__ import print_function
-
 import gclient_paths
 import os
 import subprocess

+ 0 - 2
compile_single_file.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import argparse
 import os
 import subprocess

+ 0 - 2
detect_host_arch.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Outputs host CPU architecture in format recognized by gyp."""
 
-from __future__ import print_function
-
 import platform
 import re
 

+ 0 - 2
download_from_google_storage.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Download files from Google Storage based on SHA1 sums."""
 
-from __future__ import print_function
-
 import hashlib
 import optparse
 import os

+ 0 - 2
fetch.py

@@ -17,8 +17,6 @@ Optional arguments may be passed on the command line in key-value pairs.
 These parameters will be passed through to the config's main method.
 """
 
-from __future__ import print_function
-
 import json
 import argparse
 import os

+ 0 - 2
fetch_configs/config_util.py

@@ -3,8 +3,6 @@
 # found in the LICENSE file.
 """This module holds utilities which make writing configs easier."""
 
-from __future__ import print_function
-
 import json
 
 

+ 0 - 2
fix_encoding.py

@@ -5,8 +5,6 @@
 multiple platforms with python.
 """
 
-from __future__ import print_function
-
 import codecs
 import locale
 import os

+ 0 - 2
gn.py

@@ -11,8 +11,6 @@ binary. It will also automatically try to find the gn binary when run inside
 the chrome source tree, so users can just type "gn" on the command line
 (normally depot_tools is on the path)."""
 
-from __future__ import print_function
-
 import gclient_paths
 import os
 import subprocess

+ 0 - 2
gsutil.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Run a pinned gsutil."""
 
-from __future__ import print_function
-
 import argparse
 import base64
 import contextlib

+ 0 - 2
lockfile.py

@@ -3,8 +3,6 @@
 # found in the LICENSE file.
 """Exclusive filelocking for all supported platforms."""
 
-from __future__ import print_function
-
 import contextlib
 import logging
 import os

+ 0 - 2
man/src/filter_demo_output.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import collections
 import os
 import re

+ 0 - 2
metadata/scan.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import argparse
 from collections import defaultdict
 import os

+ 0 - 2
metrics.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import contextlib
 import functools
 import json

+ 0 - 2
metrics_utils.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import re
 import os
 import scm

+ 0 - 2
my_activity.py

@@ -32,8 +32,6 @@ To add additional gerrit instances, one can pass a JSON file as parameter:
 # check those details to determine if there was activity in the given period.
 # This means that query time scales mostly with (today() - begin).
 
-from __future__ import print_function
-
 import collections
 import contextlib
 from datetime import datetime

+ 0 - 2
ninjalog_uploader_wrapper.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import json
 import os
 import platform

+ 0 - 2
owners_finder.py

@@ -3,8 +3,6 @@
 # found in the LICENSE file.
 """Interactive tool for finding reviewers/owners for a change."""
 
-from __future__ import print_function
-
 import os
 import copy
 

+ 0 - 5
presubmit_canned_checks.py

@@ -3,8 +3,6 @@
 # found in the LICENSE file.
 """Generic presubmit checks that can be reused by other presubmit checks."""
 
-from __future__ import print_function
-
 import io as _io
 import os as _os
 import zlib
@@ -1123,9 +1121,6 @@ def GetPythonUnitTests(input_api, output_api, unit_tests, python3=False):
                 '.',
                 input_api.os_path.pathsep.join(['..'] * (cwd.count('/') + 1))
             ]
-            # We convert to str, since on Windows on Python 2 only strings are
-            # allowed as environment variables, but literals are unicode since
-            # we're importing unicode_literals from __future__.
             if env.get('PYTHONPATH'):
                 backpath.append(env.get('PYTHONPATH'))
             env['PYTHONPATH'] = input_api.os_path.pathsep.join((backpath))

+ 0 - 2
presubmit_support.py

@@ -5,8 +5,6 @@
 """Enables directory-specific presubmit checks to run at upload and/or commit.
 """
 
-from __future__ import print_function
-
 __version__ = '2.0.0'
 
 # TODO(joi) Add caching where appropriate/needed. The API is designed to allow

+ 0 - 2
pylint_main.py

@@ -7,8 +7,6 @@
 This will be executed by vpython with the right pylint versions.
 """
 
-from __future__ import print_function
-
 import os
 import sys
 

+ 0 - 2
repo_launcher

@@ -22,8 +22,6 @@ It is used to get an initial repo client checkout, and after that it runs the
 copy of repo in the checkout.
 """
 
-from __future__ import print_function
-
 import datetime
 import os
 import platform

+ 0 - 2
roll_dep.py

@@ -8,8 +8,6 @@ Works only with git checkout and git dependencies. Currently this script will
 always roll to the tip of to origin/main.
 """
 
-from __future__ import print_function
-
 import argparse
 import itertools
 import os

+ 0 - 2
setup_color.py

@@ -3,8 +3,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import ctypes
 import platform
 import subprocess

+ 0 - 2
split_cl.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Splits a branch into smaller branches and uploads CLs."""
 
-from __future__ import print_function
-
 import collections
 import os
 import re

+ 0 - 2
testing_support/coverage_utils.py

@@ -2,8 +2,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import distutils.version
 import os
 import sys

+ 0 - 2
testing_support/fake_repos.py

@@ -5,8 +5,6 @@
 # found in the LICENSE file.
 """Generate fake repositories for testing."""
 
-from __future__ import print_function
-
 import atexit
 import datetime
 import errno

+ 0 - 2
testing_support/test_case_utils.py

@@ -3,8 +3,6 @@
 # found in the LICENSE file.
 """Simplify unit tests based on pymox."""
 
-from __future__ import print_function
-
 import os
 import random
 import string

+ 0 - 2
testing_support/trial_dir.py

@@ -2,8 +2,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from __future__ import print_function
-
 import atexit
 import logging
 import os

+ 0 - 2
tests/download_from_google_storage_unittest.py

@@ -5,8 +5,6 @@
 # pylint: disable=protected-access
 """Unit tests for download_from_google_storage.py."""
 
-from __future__ import print_function
-
 import optparse
 import os
 import queue

+ 0 - 2
tests/fix_encoding_test.py

@@ -5,8 +5,6 @@
 # found in the LICENSE file.
 """Unit tests for fix_encoding.py."""
 
-from __future__ import print_function
-
 import os
 import sys
 import unittest

+ 0 - 2
tests/gclient_scm_test.py

@@ -6,8 +6,6 @@
 
 # pylint: disable=E1103
 
-from __future__ import unicode_literals
-
 from io import StringIO
 import json
 import logging

+ 0 - 2
tests/gsutil_test.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Test gsutil.py."""
 
-from __future__ import unicode_literals
-
 import base64
 import hashlib
 import io

+ 0 - 2
tests/presubmit_unittest.py

@@ -6,8 +6,6 @@
 
 # pylint: disable=no-member,E1103
 
-from __future__ import unicode_literals
-
 import functools
 import io
 import itertools

+ 0 - 2
tests/rdb_wrapper_test.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Unit tests for rdb_wrapper.py"""
 
-from __future__ import print_function
-
 import contextlib
 import json
 import logging

+ 0 - 2
upload_to_google_storage.py

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Uploads files to Google Storage content addressed."""
 
-from __future__ import print_function
-
 import hashlib
 import optparse
 import os

+ 0 - 2
watchlists.py

@@ -17,8 +17,6 @@ the watchers for files given on the command line. This is useful to verify
 changes to WATCHLISTS files.
 """
 
-from __future__ import print_function
-
 import logging
 import os
 import re

+ 0 - 2
weekly

@@ -5,8 +5,6 @@
 """Display log of checkins of one particular developer since a particular
 date. Only works on git dependencies at the moment."""
 
-from __future__ import print_function
-
 import gclient_utils
 import optparse
 import os

+ 0 - 2
win_toolchain/get_toolchain_if_necessary.py

@@ -17,8 +17,6 @@ the toolchain. This is likely to be a poorly tested code path that probably
 won't be properly maintained. See http://crbug.com/323300.
 """
 
-from __future__ import print_function
-
 import argparse
 from contextlib import closing
 import hashlib

+ 0 - 2
win_toolchain/package_from_installed.py

@@ -30,8 +30,6 @@ useful as the resulting zip can't be redistributed, and most will presumably
 have a Pro license anyway).
 """
 
-from __future__ import print_function
-
 import collections
 import glob
 import json

+ 0 - 2
wtf

@@ -4,8 +4,6 @@
 # found in the LICENSE file.
 """Display active git branches and code changes in a chromiumos workspace."""
 
-from __future__ import print_function
-
 import gclient_utils
 import os
 import re