From ed935cf29b137570407aece33158c787720fbf1e Mon Sep 17 00:00:00 2001 From: Aravind Vasudevan Date: Thu, 24 Aug 2023 23:52:20 +0000 Subject: [PATCH] Remove deadcode from depot_tools scripts Removing some deadcode from depot_tools scripts. More follow-up CLs will be made after this to remove more dead code. R=sokcevic,gavinmak Change-Id: Iad20e9e1737e49c1370248d32c6317cf2be63de4 Bug: 1475776 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811216 Commit-Queue: Aravind Vasudevan Reviewed-by: Gavin Mak --- fetch.py | 2 -- gclient.py | 8 ++------ gclient_scm.py | 2 +- git_map_branches.py | 1 - metrics.py | 1 - tests/metrics_test.py | 2 -- 6 files changed, 3 insertions(+), 13 deletions(-) diff --git a/fetch.py b/fetch.py index a804f095c..39268f358 100755 --- a/fetch.py +++ b/fetch.py @@ -24,10 +24,8 @@ import json import argparse import os import pipes -import re import subprocess import sys -import textwrap import git_common diff --git a/gclient.py b/gclient.py index 8afbcf413..eb8a25e3d 100755 --- a/gclient.py +++ b/gclient.py @@ -128,12 +128,8 @@ class GNException(Exception): pass -def ToGNString(value, allow_dicts = True): - """Returns a stringified GN equivalent of the Python value. - - allow_dicts indicates if this function will allow converting dictionaries - to GN scopes. This is only possible at the top level, you can't nest a - GN scope in a list, so this should be set to False for recursive calls.""" +def ToGNString(value): + """Returns a stringified GN equivalent of the Python value.""" if isinstance(value, str): if value.find('\n') >= 0: raise GNException("Trying to print a string with a newline in it.") diff --git a/gclient_scm.py b/gclient_scm.py index 69ccc5fe6..0bbc940e6 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1359,7 +1359,7 @@ class GitWrapper(SCMWrapper): os.path.isdir(os.path.join(g, "rebase-merge")) or os.path.isdir(os.path.join(g, "rebase-apply"))) - def _CheckClean(self, revision, fixup=False): + def _CheckClean(self, revision): lockfile = os.path.join(self.checkout_path, ".git", "index.lock") if os.path.exists(lockfile): raise gclient_utils.Error( diff --git a/git_map_branches.py b/git_map_branches.py index d06a4ceb9..046e7951b 100755 --- a/git_map_branches.py +++ b/git_map_branches.py @@ -29,7 +29,6 @@ from __future__ import print_function import argparse import collections import metrics -import os import subprocess2 import sys diff --git a/metrics.py b/metrics.py index de8d8bc4f..71bcb6d62 100644 --- a/metrics.py +++ b/metrics.py @@ -10,7 +10,6 @@ import functools import json import os import sys -import tempfile import threading import time import traceback diff --git a/tests/metrics_test.py b/tests/metrics_test.py index 3e07e302d..359f2ff1c 100644 --- a/tests/metrics_test.py +++ b/tests/metrics_test.py @@ -56,8 +56,6 @@ class MetricsCollectorTest(unittest.TestCase): # Patch the methods used to get the system information, so we have a known # environment. - mock.patch('metrics.tempfile.mkstemp', - lambda: (None, '/tmp/metrics.json')).start() mock.patch('metrics.time.time', TimeMock()).start() mock.patch('metrics.metrics_utils.get_python_version',