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>
This commit is contained in:
Gavin Mak
2023-09-25 17:13:00 +00:00
committed by LUCI CQ
parent c5505889cf
commit f936d540e1
41 changed files with 0 additions and 85 deletions

View File

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

View File

@@ -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 sync Chrome, to platform-specific locations. This script knows how to locate
those tools, assuming the script is invoked from inside a Chromium checkout.""" those tools, assuming the script is invoked from inside a Chromium checkout."""
from __future__ import print_function
import gclient_paths import gclient_paths
import os import os
import subprocess import subprocess

View File

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

View File

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

View File

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

View File

@@ -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. These parameters will be passed through to the config's main method.
""" """
from __future__ import print_function
import json import json
import argparse import argparse
import os import os

View File

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

View File

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

2
gn.py
View File

@@ -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 the chrome source tree, so users can just type "gn" on the command line
(normally depot_tools is on the path).""" (normally depot_tools is on the path)."""
from __future__ import print_function
import gclient_paths import gclient_paths
import os import os
import subprocess import subprocess

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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. # check those details to determine if there was activity in the given period.
# This means that query time scales mostly with (today() - begin). # This means that query time scales mostly with (today() - begin).
from __future__ import print_function
import collections import collections
import contextlib import contextlib
from datetime import datetime from datetime import datetime

View File

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

View File

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

View File

@@ -3,8 +3,6 @@
# found in the LICENSE file. # found in the LICENSE file.
"""Generic presubmit checks that can be reused by other presubmit checks.""" """Generic presubmit checks that can be reused by other presubmit checks."""
from __future__ import print_function
import io as _io import io as _io
import os as _os import os as _os
import zlib 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)) 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'): if env.get('PYTHONPATH'):
backpath.append(env.get('PYTHONPATH')) backpath.append(env.get('PYTHONPATH'))
env['PYTHONPATH'] = input_api.os_path.pathsep.join((backpath)) env['PYTHONPATH'] = input_api.os_path.pathsep.join((backpath))

View File

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

View File

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

View File

@@ -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. copy of repo in the checkout.
""" """
from __future__ import print_function
import datetime import datetime
import os import os
import platform import platform

View File

@@ -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. always roll to the tip of to origin/main.
""" """
from __future__ import print_function
import argparse import argparse
import itertools import itertools
import os import os

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

2
weekly
View File

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

View File

@@ -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. won't be properly maintained. See http://crbug.com/323300.
""" """
from __future__ import print_function
import argparse import argparse
from contextlib import closing from contextlib import closing
import hashlib import hashlib

View File

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

2
wtf
View File

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