From 2931c1a0862594e2f6e1bdcfb1f73f6139fff146 Mon Sep 17 00:00:00 2001 From: nednguyen Date: Thu, 23 Apr 2015 08:03:18 -0700 Subject: [PATCH] Enable 'unused-import' and 'import-error' lint check for perf/ BUG=475714 Review URL: https://codereview.chromium.org/1103613002 Cr-Commit-Position: refs/heads/master@{#326520} --- tools/perf/benchmarks/benchmark_unittest.py | 1 - tools/perf/benchmarks/blink_style.py | 1 - tools/perf/benchmarks/oilpan_gc_times.py | 1 - tools/perf/measurements/blink_style.py | 2 -- tools/perf/measurements/oilpan_gc_times.py | 3 --- tools/perf/measurements/oilpan_gc_times_unittest.py | 1 - tools/perf/measurements/rasterize_and_record_micro.py | 1 - tools/perf/measurements/session_restore.py | 3 --- tools/perf/measurements/smoothness_controller.py | 4 ---- tools/perf/measurements/smoothness_unittest.py | 1 - tools/perf/measurements/v8_detached_context_age_in_gc.py | 1 - tools/perf/measurements/v8_detached_context_age_in_gc_unittest.py | 2 -- tools/perf/metrics/speedindex.py | 3 --- tools/perf/metrics/speedindex_unittest.py | 2 -- tools/perf/page_sets/key_hit_test_cases.py | 1 - tools/perf/page_sets/page_reload_cases.py | 1 - tools/perf/page_sets/simple_mobile_sites_fling.py | 1 - tools/perf/page_sets/tough_scrolling_while_zoomed_in_cases.py | 2 -- tools/perf/page_sets/tough_webgl_cases.py | 1 - tools/perf/page_sets/webrtc_cases.py | 1 - tools/perf/profile_creators/cookie_profile_extender.py | 1 - .../profile_creators/fast_navigation_profile_extender_unittest.py | 2 +- tools/perf/profile_creators/history_profile_extender_unittest.py | 2 +- tools/perf/pylintrc | 4 ++-- tools/perf/update_reference_build.py | 2 -- 25 files changed, 4 insertions(+), 40 deletions(-) diff --git a/tools/perf/benchmarks/benchmark_unittest.py b/tools/perf/benchmarks/benchmark_unittest.py index 6d900ce20719..56f76702b64f 100644 --- a/tools/perf/benchmarks/benchmark_unittest.py +++ b/tools/perf/benchmarks/benchmark_unittest.py @@ -5,7 +5,6 @@ """For all the benchmarks that set options, test that the options are valid.""" from collections import defaultdict -import logging import os import unittest diff --git a/tools/perf/benchmarks/blink_style.py b/tools/perf/benchmarks/blink_style.py index 0dae4d153190..4682b4fe5e75 100644 --- a/tools/perf/benchmarks/blink_style.py +++ b/tools/perf/benchmarks/blink_style.py @@ -5,7 +5,6 @@ from telemetry import benchmark from measurements import blink_style -from measurements import smoothness import page_sets @benchmark.Disabled # http://crbug.com/479048 diff --git a/tools/perf/benchmarks/oilpan_gc_times.py b/tools/perf/benchmarks/oilpan_gc_times.py index f1577f9620a2..9606aa7b2f0e 100644 --- a/tools/perf/benchmarks/oilpan_gc_times.py +++ b/tools/perf/benchmarks/oilpan_gc_times.py @@ -5,7 +5,6 @@ import os from telemetry import benchmark -from telemetry import page from benchmarks import blink_perf from benchmarks import silk_flags diff --git a/tools/perf/measurements/blink_style.py b/tools/perf/measurements/blink_style.py index d3d7d648989b..f89ab980085c 100644 --- a/tools/perf/measurements/blink_style.py +++ b/tools/perf/measurements/blink_style.py @@ -5,10 +5,8 @@ from itertools import starmap from collections import defaultdict -from telemetry.core.platform import tracing_options from telemetry.core import util from telemetry.page import page_test -from telemetry.timeline.model import TimelineModel from telemetry.value import scalar from measurements import timeline_controller diff --git a/tools/perf/measurements/oilpan_gc_times.py b/tools/perf/measurements/oilpan_gc_times.py index b4b1c9f1884b..3621241267be 100644 --- a/tools/perf/measurements/oilpan_gc_times.py +++ b/tools/perf/measurements/oilpan_gc_times.py @@ -8,12 +8,9 @@ from telemetry.core.platform import tracing_category_filter from telemetry.core.platform import tracing_options from telemetry.page import action_runner from telemetry.page import page_test -from telemetry.results import results_options from telemetry.timeline.model import TimelineModel -from telemetry.util import statistics from telemetry.value import list_of_scalar_values from telemetry.value import scalar -from telemetry.value import trace _CR_RENDERER_MAIN = 'CrRendererMain' diff --git a/tools/perf/measurements/oilpan_gc_times_unittest.py b/tools/perf/measurements/oilpan_gc_times_unittest.py index 8e9a2cbd9a21..1d9bf5fd3bc5 100644 --- a/tools/perf/measurements/oilpan_gc_times_unittest.py +++ b/tools/perf/measurements/oilpan_gc_times_unittest.py @@ -7,7 +7,6 @@ from measurements import oilpan_gc_times from telemetry.results import page_test_results from telemetry.timeline import model from telemetry.timeline import slice as slice_data -from telemetry.timeline.event import TimelineEvent from telemetry.unittest_util import options_for_unittests from telemetry.unittest_util import page_test_test_case from telemetry.page import page as page_module diff --git a/tools/perf/measurements/rasterize_and_record_micro.py b/tools/perf/measurements/rasterize_and_record_micro.py index 209b04156c01..412e263f5314 100644 --- a/tools/perf/measurements/rasterize_and_record_micro.py +++ b/tools/perf/measurements/rasterize_and_record_micro.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import sys import time from telemetry.core import exceptions diff --git a/tools/perf/measurements/session_restore.py b/tools/perf/measurements/session_restore.py index 99f323d85d0b..a0f93601e64f 100644 --- a/tools/perf/measurements/session_restore.py +++ b/tools/perf/measurements/session_restore.py @@ -2,15 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import collections - from telemetry.core import util from telemetry.value import histogram from telemetry.value import histogram_util from measurements import startup from metrics import cpu -from metrics import startup_metric _HISTOGRAMS = [ diff --git a/tools/perf/measurements/smoothness_controller.py b/tools/perf/measurements/smoothness_controller.py index 95c71df9e478..1aa1fd7c5de5 100644 --- a/tools/perf/measurements/smoothness_controller.py +++ b/tools/perf/measurements/smoothness_controller.py @@ -6,11 +6,7 @@ import sys from telemetry.core.platform import tracing_category_filter from telemetry.core.platform import tracing_options from telemetry.page import action_runner -from telemetry.page import page_test from telemetry.timeline.model import TimelineModel -from telemetry.timeline import trace_data as trace_data_module -from telemetry.value import list_of_scalar_values -from telemetry.value import scalar from telemetry.value import trace from telemetry.web_perf.metrics import smoothness from telemetry.web_perf import smooth_gesture_util diff --git a/tools/perf/measurements/smoothness_unittest.py b/tools/perf/measurements/smoothness_unittest.py index 1a4f4e9d0cd3..dcfcc27661bf 100644 --- a/tools/perf/measurements/smoothness_unittest.py +++ b/tools/perf/measurements/smoothness_unittest.py @@ -3,7 +3,6 @@ # found in the LICENSE file. import sys -from telemetry.core import exceptions from telemetry.core import wpr_modes from telemetry import decorators from telemetry.page import page diff --git a/tools/perf/measurements/v8_detached_context_age_in_gc.py b/tools/perf/measurements/v8_detached_context_age_in_gc.py index 0e0cf82a26a5..d36b16307a33 100644 --- a/tools/perf/measurements/v8_detached_context_age_in_gc.py +++ b/tools/perf/measurements/v8_detached_context_age_in_gc.py @@ -5,7 +5,6 @@ import json from telemetry.page import page_test -from telemetry.value import histogram from telemetry.value import histogram_util from telemetry.value import scalar from telemetry.value import skip diff --git a/tools/perf/measurements/v8_detached_context_age_in_gc_unittest.py b/tools/perf/measurements/v8_detached_context_age_in_gc_unittest.py index 4ae6f8d960f6..79962a6f51ab 100644 --- a/tools/perf/measurements/v8_detached_context_age_in_gc_unittest.py +++ b/tools/perf/measurements/v8_detached_context_age_in_gc_unittest.py @@ -4,11 +4,9 @@ from telemetry.core import wpr_modes from telemetry.page import page as page_module -from telemetry.page import page_test from telemetry.results import page_test_results from telemetry.unittest_util import options_for_unittests from telemetry.unittest_util import page_test_test_case -from telemetry.value import skip from measurements import v8_detached_context_age_in_gc diff --git a/tools/perf/metrics/speedindex.py b/tools/perf/metrics/speedindex.py index 634c8bda389b..a069cd1688ac 100644 --- a/tools/perf/metrics/speedindex.py +++ b/tools/perf/metrics/speedindex.py @@ -2,9 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import collections -import logging - from telemetry.image_processing import image_util from telemetry.image_processing import rgba_color from telemetry.value import scalar diff --git a/tools/perf/metrics/speedindex_unittest.py b/tools/perf/metrics/speedindex_unittest.py index 760ff73f1b4a..26e8412ba931 100644 --- a/tools/perf/metrics/speedindex_unittest.py +++ b/tools/perf/metrics/speedindex_unittest.py @@ -5,8 +5,6 @@ # These tests access private methods in the speedindex module. # pylint: disable=W0212 -import json -import os import unittest from telemetry.image_processing import histogram diff --git a/tools/perf/page_sets/key_hit_test_cases.py b/tools/perf/page_sets/key_hit_test_cases.py index e308de934877..a0dd0ce123b6 100644 --- a/tools/perf/page_sets/key_hit_test_cases.py +++ b/tools/perf/page_sets/key_hit_test_cases.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module from page_sets import polymer diff --git a/tools/perf/page_sets/page_reload_cases.py b/tools/perf/page_sets/page_reload_cases.py index 25eeb24a6169..00765a7bfa09 100644 --- a/tools/perf/page_sets/page_reload_cases.py +++ b/tools/perf/page_sets/page_reload_cases.py @@ -1,7 +1,6 @@ # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module from page_sets import top_pages diff --git a/tools/perf/page_sets/simple_mobile_sites_fling.py b/tools/perf/page_sets/simple_mobile_sites_fling.py index bc44765db30c..7619944a677d 100644 --- a/tools/perf/page_sets/simple_mobile_sites_fling.py +++ b/tools/perf/page_sets/simple_mobile_sites_fling.py @@ -3,7 +3,6 @@ # found in the LICENSE file. from page_sets import fling_gesture_supported_shared_state -from telemetry.page import shared_page_state from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module diff --git a/tools/perf/page_sets/tough_scrolling_while_zoomed_in_cases.py b/tools/perf/page_sets/tough_scrolling_while_zoomed_in_cases.py index 243e25a75bf8..bc8f5a4cb2a4 100644 --- a/tools/perf/page_sets/tough_scrolling_while_zoomed_in_cases.py +++ b/tools/perf/page_sets/tough_scrolling_while_zoomed_in_cases.py @@ -3,10 +3,8 @@ # found in the LICENSE file. from page_sets import diagonal_scrolling_supported_shared_state -from telemetry.page import shared_page_state from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module -from telemetry.core.backends.chrome_inspector import devtools_client_backend class ToughScrollingWhileZoomedInCasesPage(page_module.Page): diff --git a/tools/perf/page_sets/tough_webgl_cases.py b/tools/perf/page_sets/tough_webgl_cases.py index 099fb9a3b7b9..843f9b24d91a 100644 --- a/tools/perf/page_sets/tough_webgl_cases.py +++ b/tools/perf/page_sets/tough_webgl_cases.py @@ -4,7 +4,6 @@ from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module -from telemetry.page import shared_page_state from page_sets import webgl_supported_shared_state diff --git a/tools/perf/page_sets/webrtc_cases.py b/tools/perf/page_sets/webrtc_cases.py index 6c09634f0f82..41010b843845 100644 --- a/tools/perf/page_sets/webrtc_cases.py +++ b/tools/perf/page_sets/webrtc_cases.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os -import tempfile from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module diff --git a/tools/perf/profile_creators/cookie_profile_extender.py b/tools/perf/profile_creators/cookie_profile_extender.py index ad9e85d8c9aa..cb53363be0db 100644 --- a/tools/perf/profile_creators/cookie_profile_extender.py +++ b/tools/perf/profile_creators/cookie_profile_extender.py @@ -8,7 +8,6 @@ import sqlite3 import page_sets from profile_creators import fast_navigation_profile_extender -from profile_creators import profile_safe_url_list class CookieProfileExtender( fast_navigation_profile_extender.FastNavigationProfileExtender): diff --git a/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py b/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py index c514947c635d..86e6c81a82d4 100644 --- a/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py +++ b/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py @@ -9,7 +9,7 @@ from telemetry.core import util from telemetry.unittest_util import options_for_unittests util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'mock') -import mock +import mock # pylint: disable=import-error class FakeTab(object): diff --git a/tools/perf/profile_creators/history_profile_extender_unittest.py b/tools/perf/profile_creators/history_profile_extender_unittest.py index 46997cdc2354..022e95789478 100644 --- a/tools/perf/profile_creators/history_profile_extender_unittest.py +++ b/tools/perf/profile_creators/history_profile_extender_unittest.py @@ -12,7 +12,7 @@ from telemetry import decorators from telemetry.unittest_util import options_for_unittests util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'mock') -import mock +import mock # pylint: disable=import-error # Testing private method. diff --git a/tools/perf/pylintrc b/tools/perf/pylintrc index b112c527fb12..8ba763a579dc 100644 --- a/tools/perf/pylintrc +++ b/tools/perf/pylintrc @@ -1,8 +1,8 @@ [MESSAGES CONTROL] # Disable the message, report, category or checker with the given id(s). -# TODO(nednguyen): Remove unusued-argument and unused-import from this list. -disable=I0010,I0011,abstract-class-little-used,abstract-class-not-used,anomalous-backslash-in-string,bad-builtin,bad-context-manager,bad-continuation,bad-indentation,bad-str-strip-call,bad-whitespace,broad-except,cell-var-from-loop,deprecated-lambda,deprecated-module,duplicate-code,eval-used,exec-used,fixme,function-redefined,global-statement,import-error,interface-not-implemented,invalid-name,locally-enabled,logging-not-lazy,missing-docstring,missing-final-newline,no-init,no-member,no-name-in-module,no-self-use,no-self-use,not-callable,old-style-class,protected-access,reimported,star-args,super-on-old-class,superfluous-parens,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-public-methods,too-many-return-statements,too-many-statements,trailing-whitespace,unnecessary-semicolon,unpacking-non-sequence,useless-else-on-loop,unused-argument,unused-import +# TODO(perf-owners): Reduce this list to as small as possible. +disable=I0010,I0011,abstract-class-little-used,abstract-class-not-used,anomalous-backslash-in-string,bad-builtin,bad-context-manager,bad-continuation,bad-indentation,bad-str-strip-call,bad-whitespace,broad-except,cell-var-from-loop,deprecated-lambda,deprecated-module,duplicate-code,eval-used,exec-used,fixme,function-redefined,global-statement,interface-not-implemented,invalid-name,locally-enabled,logging-not-lazy,missing-docstring,missing-final-newline,no-init,no-member,no-name-in-module,no-self-use,no-self-use,not-callable,old-style-class,protected-access,reimported,star-args,super-on-old-class,superfluous-parens,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-public-methods,too-many-return-statements,too-many-statements,trailing-whitespace,unnecessary-semicolon,unpacking-non-sequence,useless-else-on-loop,unused-argument [REPORTS] diff --git a/tools/perf/update_reference_build.py b/tools/perf/update_reference_build.py index d538f17677e2..6997c481049a 100755 --- a/tools/perf/update_reference_build.py +++ b/tools/perf/update_reference_build.py @@ -26,8 +26,6 @@ import os import shutil import subprocess import sys -import time -import urllib import urllib2 import zipfile -- 2.11.4.GIT